@wisemen/wise-invoicing-web 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/{ApprovalReminderSettingsViewDataProvider-BZBuz6EF.js → ApprovalReminderSettingsViewDataProvider-C1cI6KQq.js} +7 -7
  2. package/dist/{BillingDocumentDetailViewDataProvider-BCADHPFR.js → BillingDocumentDetailViewDataProvider-BZCFhsjA.js} +1526 -1506
  3. package/dist/{BillingDocumentPdf-ddBlGdIN.js → BillingDocumentPdf-DMTwOlzG.js} +76 -76
  4. package/dist/{DunningCaseSendDialog-fgL9OsV8.js → DunningCaseSendDialog-DfMYo2LV.js} +21 -21
  5. package/dist/{InvoiceApprovalOutOfSyncIndicator-BoPBNXx1.js → InvoiceApprovalOutOfSyncIndicator-BjlBhzNg.js} +1 -1
  6. package/dist/{InvoiceApprovalOverviewView-BIiJ6gen.js → InvoiceApprovalOverviewView-BH5rJgk6.js} +18 -18
  7. package/dist/{InvoicePdfView-BRJaAErd.js → InvoicePdfView-DRqX3P-X.js} +1 -1
  8. package/dist/{InvoicePublicProFormaPdfViewDataProvider-mZaggXYf.js → InvoicePublicProFormaPdfViewDataProvider-Dz2jGWVg.js} +2 -2
  9. package/dist/{InvoiceApproveDialogDataProvider-C9NhZX-D.js → InvoiceRejectDialog-_5i8eFuk.js} +175 -175
  10. package/dist/{invoiceDeliveryStatus.util-Dp9hD1Tj.js → InvoiceStatusBadge-BI41yxpr.js} +70 -70
  11. package/dist/{IssuerSettingsViewDataProvider-D13f6rvi.js → IssuerSettingsViewDataProvider-nNg0lR7Y.js} +198 -198
  12. package/dist/{PeppolSettingsViewDataProvider-DymLdaRM.js → PeppolSettingsViewDataProvider-CFelH70Q.js} +30 -30
  13. package/dist/{billingDocumentDetail.transformer-DcNMzl46.js → billingDocumentDetail.transformer-Ifa6tWtE.js} +11 -11
  14. package/dist/{creditNoteDetail.query-DiS_-xFz.js → creditNoteDetail.query-C4DvgGFR.js} +1 -1
  15. package/dist/{InvoiceDeliverySendDialog-BICcd6Cf.js → customFieldDefinitionIndex.query-BBqxMfvT.js} +214 -217
  16. package/dist/{dist-C99_-gWv.js → dist-47-1LAzT.js} +6 -6
  17. package/dist/index.d.ts +4 -0
  18. package/dist/index.js +5978 -3013
  19. package/dist/{invoice.service-2QiktTs9.js → invoice.service-v9uIoFgR.js} +111 -111
  20. package/dist/{invoiceCustomer.service-BNQJt1KV.js → invoiceCustomer.service-Bl4vN_U5.js} +1 -1
  21. package/dist/{invoiceDetail.query-MIrBYgNS.js → invoiceDetail.query-MElhxTMM.js} +1 -1
  22. package/dist/modules/invoice/use-cases/overview/components/InvoiceOverviewBulkActionBar.vue.d.ts +2 -2
  23. package/dist/ui/billing-document/table/field/BillingDocumentLineItemsTableField.vue.d.ts +1 -1
  24. package/package.json +1 -1
  25. package/dist/CreditNoteDetailViewDataProvider-Donn5pVv.js +0 -816
  26. package/dist/CreditNotePdfViewDataProvider-c-apCeCW.js +0 -22
  27. package/dist/InvoiceDetailViewDataProvider-BppXFT6D.js +0 -2176
  28. package/dist/InvoicePdfViewDataProvider-J7NP1Dhh.js +0 -22
  29. package/dist/download.util-LyRpGWKA.js +0 -25
@@ -3,8 +3,8 @@ import { S as s, f as c, u as l, x as u } from "./documentTitle.composable-Dl8Cm
3
3
  import { r as d } from "./useCurrencyFormat.composable-MtZaqKnO.js";
4
4
  import { n as f } from "./invoicingConfig.composable-D-hxnEnh.js";
5
5
  import { r as p } from "./dist-CyUNvdkD.js";
6
- import { t as m } from "./formango.util-D5c2ql--.js";
7
6
  import { n as ee, t as te } from "./deliveryReason.util-KBh3q_-P.js";
7
+ import { t as m } from "./formango.util-D5c2ql--.js";
8
8
  import h from "zod";
9
9
  import { useI18n as g } from "vue-i18n";
10
10
  import { Fragment as _, computed as v, createBlock as y, createCommentVNode as b, createElementBlock as x, createElementVNode as S, createTextVNode as C, createVNode as w, defineComponent as T, mergeProps as E, normalizeClass as D, onMounted as ne, openBlock as O, ref as k, renderList as A, toDisplayString as j, unref as M, withCtx as N } from "vue";
@@ -12,71 +12,8 @@ import { QueryClient as P, getTanstackQueryClient as F, useMutation as I, useQue
12
12
  import { RouterLink as R } from "vue-router";
13
13
  import { UIButton as re, UICheckbox as z, UIDialogFooter as ie, UIDialogFooterCancel as ae, UIDialogFooterSubmit as oe, UIDialogHeader as se, UIFormDialog as ce, UIText as B, useToast as le } from "@wisemen/vue-core-design-system";
14
14
  import { useForm as ue } from "formango";
15
- //#region src/modules/custom-field/models/custom-field-definition/customFieldViewKey.model.ts
16
- var V = /* @__PURE__ */ function(e) {
17
- return e.CREDIT_NOTE_DETAIL = "credit-note-detail", e.INVOICE_DETAIL = "invoice-detail", e.INVOICE_OVERVIEW = "invoice-overview", e;
18
- }({}), de = class {
19
- static fromDto(e) {
20
- return {
21
- uuid: e.uuid,
22
- isRequired: e.isRequired,
23
- choices: e.choices?.map((e) => ({
24
- label: e.label,
25
- order: e.order,
26
- value: e.value
27
- })).toSorted((e, t) => e.order - t.order) ?? [],
28
- description: e.description,
29
- entityType: e.entityType,
30
- key: e.key,
31
- label: e.label,
32
- rules: e.rules,
33
- type: e.type,
34
- views: e.views.filter((e) => Object.values(V).includes(e.key)).map((e) => ({
35
- key: e.key,
36
- order: e.order
37
- }))
38
- };
39
- }
40
- }, fe = class {
41
- static async getAll(e) {
42
- return (await a.fromPromise(o({ query: e?.entityTypes === void 0 ? void 0 : { filter: { entityTypes: e.entityTypes } } }))).map((e) => e.data.map(de.fromDto));
43
- }
44
- };
45
- //#endregion
46
- //#region src/modules/custom-field/api/queries/customFieldDefinitionIndex.query.ts
47
- function pe(e) {
48
- return L("customFieldDefinitionIndex", {
49
- params: { queryParams: e },
50
- queryFn: () => fe.getAll(e?.value)
51
- });
52
- }
53
- //#endregion
54
- //#region src/modules/custom-field/models/custom-field-definition/customFieldDefinition.util.ts
55
- var H = class {
56
- static filterByEntityType(e, t) {
57
- return e.filter((e) => e.entityType === t);
58
- }
59
- static filterByView(e, t) {
60
- return e.flatMap((e) => {
61
- let n = e.views.find((e) => e.key === t);
62
- return n === void 0 ? [] : [{
63
- definition: e,
64
- order: n.order
65
- }];
66
- }).toSorted((e, t) => e.order - t.order).map(({ definition: e }) => e);
67
- }
68
- static getChoiceLabel(e, t, n) {
69
- let r = e.choices.find((e) => e.value === t);
70
- return r === void 0 ? t : this.getLocalizedValue(r.label, n) || t;
71
- }
72
- static getLabel(e, t) {
73
- return this.getLocalizedValue(e.label, t) || e.key;
74
- }
75
- static getLocalizedValue(e, t) {
76
- let n = t.toLowerCase(), r = n.split("-")[0], i = e.items.find((e) => e.locale.toLowerCase() === n), a = e.items.find((e) => e.locale.toLowerCase().split("-")[0] === r);
77
- return i?.value ?? a?.value ?? e.items[0]?.value ?? "";
78
- }
79
- }, U = {
15
+ //#region src/modules/invoice/models/invoice/invoiceStatus.util.ts
16
+ var V = {
80
17
  [s.CREDITED]: {
81
18
  isEditable: !1,
82
19
  isRefreshable: !1,
@@ -161,136 +98,21 @@ var H = class {
161
98
  tone: "purple",
162
99
  translationKey: "wise_invoicing.invoice.status.sent"
163
100
  }
164
- }, me = {
165
- [u.DRAFT]: U[s.DRAFT],
166
- [u.FINALIZED]: U[s.FINALIZED],
167
- [u.READY]: U[s.READY]
168
- }, he = class {
101
+ }, de = {
102
+ [u.DRAFT]: V[s.DRAFT],
103
+ [u.FINALIZED]: V[s.FINALIZED],
104
+ [u.READY]: V[s.READY]
105
+ }, fe = class {
169
106
  static getLifecycleMetadata(e) {
170
- return me[e];
107
+ return de[e];
171
108
  }
172
109
  static getMetadata(e) {
173
- return U[e];
110
+ return V[e];
174
111
  }
175
112
  static isEditable(e) {
176
- return U[e].isEditable;
177
- }
178
- }, ge = /* @__PURE__ */ T({
179
- __name: "CustomFieldValueText",
180
- props: {
181
- definition: {},
182
- size: {},
183
- value: {}
184
- },
185
- setup(e) {
186
- let t = e, n = g(), r = d(), i = p(), a = f(), o = v(() => {
187
- switch (t.value.type) {
188
- case l.BOOLEAN: return t.value.value ? n.t("wise_invoicing.common.yes") : n.t("wise_invoicing.common.no");
189
- case l.DATE: return t.value.value === "infinity" ? n.t("wise_invoicing.custom_field.date.infinity") : t.value.value === "-infinity" ? n.t("wise_invoicing.custom_field.date.negative_infinity") : i.formatPlainDate(t.value.value);
190
- case l.MONETARY: return r.formatMonetary(t.value.value);
191
- case l.MULTI_SELECT: return t.value.value.map((e) => u(e)).join(", ");
192
- case l.NUMBER: return new Intl.NumberFormat(n.locale.value, { maximumFractionDigits: 20 }).format(t.value.value);
193
- case l.REFERENCE: return t.value.value;
194
- case l.SINGLE_SELECT: return u(t.value.value);
195
- case l.TEXT: return t.value.value;
196
- case l.TEXT_ARRAY: return t.value.value.join(", ");
197
- case l.TIMESTAMP: return i.toDateTime(t.value.value);
198
- default: throw TypeError("Unsupported custom field value type");
199
- }
200
- }), s = v(() => t.value.type !== l.REFERENCE || t.definition === void 0 ? null : a.getCustomFieldReferenceRoute({
201
- entityType: t.definition.entityType,
202
- key: t.definition.key,
203
- value: t.value.value
204
- })), c = v(() => t.size === "md" ? "min-w-0 text-sm/5 text-primary" : "min-w-0 text-xs text-primary");
205
- function u(e) {
206
- return t.definition === void 0 ? e : H.getChoiceLabel(t.definition, e, n.locale.value);
207
- }
208
- return (e, r) => s.value !== null && t.definition !== void 0 ? (O(), y(M(R), {
209
- key: 0,
210
- to: s.value,
211
- class: D([c.value, "underline underline-offset-2 transition-colors hover:text-brand-700 focus-visible:text-brand-700 focus-visible:outline-none"])
212
- }, {
213
- default: N(() => [C(j(M(H).getLabel(t.definition, M(n).locale.value)), 1)]),
214
- _: 1
215
- }, 8, ["to", "class"])) : (O(), y(M(B), {
216
- key: 1,
217
- text: o.value || "-",
218
- class: D(c.value)
219
- }, null, 8, ["text", "class"]));
220
- }
221
- }), _e = 3e5, W = /* @__PURE__ */ new Map(), G = null, K = null;
222
- function ve(e) {
223
- return typeof e == "object" && !!e && "pages" in e && Array.isArray(e.pages);
224
- }
225
- function q(e) {
226
- return ve(e) ? e.pages.flatMap((e) => e.isOk() ? e.getValue().data : []) : [];
227
- }
228
- function J(e) {
229
- return Object.keys(e);
230
- }
231
- function Y(e, t) {
232
- return JSON.stringify(e) === JSON.stringify(t);
233
- }
234
- function ye(e, t) {
235
- let n = J(t.patch);
236
- return n.every((n) => Y(e[n], t.patch[n])) ? !0 : n.some((n) => n in t.serverValues && !Y(e[n], t.serverValues[n]));
237
- }
238
- function be() {
239
- return F().getQueryCache().findAll({ predicate: (e) => e.queryKey[0] === "invoiceIndex" }).flatMap((e) => q(e.state.data));
240
- }
241
- function xe(e, t) {
242
- return e === void 0 ? {} : Object.fromEntries(J(t).map((t) => [t, e[t]]));
243
- }
244
- function X() {
245
- new P(F()).update("invoiceIndex", {
246
- by: (e) => W.has(e.uuid),
247
- value: (e) => ({
248
- ...e,
249
- ...W.get(e.uuid)?.patch
250
- })
251
- });
252
- }
253
- function Se(e) {
254
- let t = Date.now() - _e;
255
- for (let [e, n] of W) n.patchedAt <= t && W.delete(e);
256
- for (let t of e) {
257
- let e = W.get(t.uuid);
258
- e !== void 0 && ye(t, e) && W.delete(t.uuid);
113
+ return V[e].isEditable;
259
114
  }
260
- }
261
- function Z() {
262
- K?.(), K = null, G = null;
263
- }
264
- function Ce(e) {
265
- if (e.type !== "updated" || e.action.type !== "success" || e.action.manual === !0 || e.query.queryKey[0] !== "invoiceIndex") return;
266
- let t = e.query.state.data;
267
- Se(q(t)), W.size === 0 ? Z() : X();
268
- }
269
- function we() {
270
- let e = F().getQueryCache();
271
- G !== e && (Z(), G = e, K = e.subscribe(Ce));
272
- }
273
- var Te = class {
274
- static reflectBulkAction(e, t) {
275
- if (e.length === 0) return;
276
- let n = Date.now(), r = new Map(be().map((e) => [e.uuid, e]));
277
- for (let i of e) {
278
- let e = W.get(i);
279
- W.set(i, {
280
- patchedAt: n,
281
- patch: {
282
- ...e?.patch,
283
- ...t
284
- },
285
- serverValues: {
286
- ...xe(r.get(i), t),
287
- ...e?.serverValues
288
- }
289
- });
290
- }
291
- X(), we();
292
- }
293
- }, Q = class {
115
+ }, H = class {
294
116
  static eligibilityFromDto(e) {
295
117
  return {
296
118
  ...e,
@@ -307,9 +129,9 @@ var Te = class {
307
129
  totalDocuments: e.totalDocuments
308
130
  };
309
131
  }
310
- }, $ = class {
132
+ }, U = class {
311
133
  static async get(e) {
312
- return (await a.fromPromise(r({ path: { uuid: e } }))).map((e) => e.data.deliveries.map((e) => Q.fromDto(e)));
134
+ return (await a.fromPromise(r({ path: { uuid: e } }))).map((e) => e.data.deliveries.map((e) => H.fromDto(e)));
313
135
  }
314
136
  static async preview(e) {
315
137
  return (await a.fromPromise(t({
@@ -318,7 +140,7 @@ var Te = class {
318
140
  invoiceUuids: e.invoiceUuids
319
141
  },
320
142
  query: e.query
321
- }))).map((e) => Q.resultFromDto(e.data));
143
+ }))).map((e) => H.resultFromDto(e.data));
322
144
  }
323
145
  static async send(e) {
324
146
  return (await a.fromPromise(i({
@@ -327,13 +149,13 @@ var Te = class {
327
149
  invoiceUuids: e.invoiceUuids
328
150
  },
329
151
  query: e.query
330
- }))).map((e) => Q.resultFromDto(e.data));
152
+ }))).map((e) => H.resultFromDto(e.data));
331
153
  }
332
154
  static async sendInvoice(e, t) {
333
155
  return (await a.fromPromise(n({
334
156
  body: { channels: t },
335
157
  path: { uuid: e }
336
- }))).map((e) => Q.resultFromDto(e.data));
158
+ }))).map((e) => H.resultFromDto(e.data));
337
159
  }
338
160
  static async sendReminder(t) {
339
161
  return (await a.fromPromise(e({ path: { uuid: t } }))).map((e) => e.data.uuid);
@@ -341,9 +163,9 @@ var Te = class {
341
163
  };
342
164
  //#endregion
343
165
  //#region src/modules/invoice-delivery/api/mutations/invoiceDeliverySend.mutation.ts
344
- function Ee() {
166
+ function pe() {
345
167
  return I({
346
- queryFn: (e) => e.params.invoiceUuid === void 0 ? $.send(e.body) : $.sendInvoice(e.params.invoiceUuid, e.body.channels),
168
+ queryFn: (e) => e.params.invoiceUuid === void 0 ? U.send(e.body) : U.sendInvoice(e.params.invoiceUuid, e.body.channels),
347
169
  queryKeysToInvalidate: {
348
170
  creditNoteDetail: {},
349
171
  invoiceDeliveries: {},
@@ -354,14 +176,14 @@ function Ee() {
354
176
  }
355
177
  //#endregion
356
178
  //#region src/modules/invoice-delivery/components/form/InvoiceDeliveryFormEmailField.vue
357
- var De = /* @__PURE__ */ T({
179
+ var me = /* @__PURE__ */ T({
358
180
  __name: "InvoiceDeliveryFormEmailField",
359
181
  props: { field: {} },
360
182
  setup(e) {
361
183
  let t = e, n = g();
362
184
  return (e, r) => (O(), y(M(z), E(M(m)(t.field), { label: M(n).t("wise_invoicing.delivery.channel.email") }), null, 16, ["label"]));
363
185
  }
364
- }), Oe = /* @__PURE__ */ T({
186
+ }), he = /* @__PURE__ */ T({
365
187
  __name: "InvoiceDeliveryFormPeppolField",
366
188
  props: {
367
189
  connection: {},
@@ -371,20 +193,20 @@ var De = /* @__PURE__ */ T({
371
193
  let t = e, n = g();
372
194
  return (e, r) => (O(), y(M(z), E(M(m)(t.field), { label: M(n).t("wise_invoicing.delivery.send.peppol_label", { provider: M(n).t(`wise_invoicing.delivery.provider.${t.connection.provider}`) }) }), null, 16, ["label"]));
373
195
  }
374
- }), ke = h.object({
196
+ }), ge = h.object({
375
197
  email: h.boolean(),
376
198
  peppol: h.boolean()
377
- }).refine((e) => e.email || e.peppol), Ae = { class: "flex flex-col gap-lg p-lg" }, je = { key: 1 }, Me = {
199
+ }).refine((e) => e.email || e.peppol), _e = { class: "flex flex-col gap-lg p-lg" }, ve = { key: 1 }, ye = {
378
200
  key: 3,
379
201
  role: "alert"
380
- }, Ne = {
202
+ }, be = {
381
203
  key: 4,
382
204
  role: "alert"
383
- }, Pe = {
205
+ }, xe = {
384
206
  key: 5,
385
207
  class: "flex max-h-80 flex-col gap-md overflow-y-auto",
386
208
  "aria-live": "polite"
387
- }, Fe = { key: 0 }, Ie = { key: 1 }, Le = { key: 0 }, Re = { key: 3 }, ze = /* @__PURE__ */ T({
209
+ }, Se = { key: 0 }, Ce = { key: 1 }, we = { key: 0 }, Te = { key: 3 }, Ee = /* @__PURE__ */ T({
388
210
  __name: "InvoiceDeliverySendDialog",
389
211
  props: {
390
212
  invoiceUuid: {},
@@ -396,12 +218,12 @@ var De = /* @__PURE__ */ T({
396
218
  },
397
219
  emits: ["close"],
398
220
  setup(e, { emit: t }) {
399
- let n = e, r = t, i = g(), a = le(), o = Ee(), s = ee(), l = k(null), u = k(!1), d = 0, f = k(!1), p = k(""), m = k(!1), h = ue({
221
+ let n = e, r = t, i = g(), a = le(), o = pe(), s = ee(), l = k(null), u = k(!1), d = 0, f = k(!1), p = k(""), m = k(!1), h = ue({
400
222
  initialState: {
401
223
  email: !0,
402
224
  peppol: !1
403
225
  },
404
- schema: ke,
226
+ schema: ge,
405
227
  onSubmit: L,
406
228
  onSubmitError: () => a.unableToSave()
407
229
  }), C = h.register("email", !0), T = h.register("peppol", !1), E = v(() => {
@@ -447,7 +269,7 @@ var De = /* @__PURE__ */ T({
447
269
  if (D.value.channels.length === 0) return;
448
270
  let e = P.value, t = ++d;
449
271
  f.value = !0, m.value = !1;
450
- let n = await $.preview(D.value);
272
+ let n = await U.preview(D.value);
451
273
  t === d && (f.value = !1, e === P.value && (p.value = e, n.isErr() ? (m.value = !0, l.value = null) : l.value = n.value));
452
274
  }
453
275
  return ne(V), (e, t) => (O(), y(M(ce), {
@@ -459,7 +281,7 @@ var De = /* @__PURE__ */ T({
459
281
  title: M(i).t("wise_invoicing.delivery.send.title"),
460
282
  description: M(i).t("wise_invoicing.delivery.send.description")
461
283
  }, null, 8, ["title", "description"]),
462
- S("div", Ae, [
284
+ S("div", _e, [
463
285
  n.query === void 0 ? b("", !0) : (O(), y(M(z), {
464
286
  key: 0,
465
287
  modelValue: u.value,
@@ -471,15 +293,15 @@ var De = /* @__PURE__ */ T({
471
293
  "label",
472
294
  "is-disabled"
473
295
  ])),
474
- n.query !== void 0 && !u.value ? (O(), x("p", je, j(M(i).t("wise_invoicing.delivery.send.selected_count", { count: n.selectedCount ?? n.documents.length })), 1)) : b("", !0),
475
- w(De, { field: M(C) }, null, 8, ["field"]),
476
- E.value?.enabled ? (O(), y(Oe, {
296
+ n.query !== void 0 && !u.value ? (O(), x("p", ve, j(M(i).t("wise_invoicing.delivery.send.selected_count", { count: n.selectedCount ?? n.documents.length })), 1)) : b("", !0),
297
+ w(me, { field: M(C) }, null, 8, ["field"]),
298
+ E.value?.enabled ? (O(), y(he, {
477
299
  key: 2,
478
300
  field: M(T),
479
301
  connection: E.value
480
302
  }, null, 8, ["field", "connection"])) : b("", !0),
481
- M(s).result.value.isErr() ? (O(), x("p", Me, j(M(i).t("wise_invoicing.delivery.send.connection_error")), 1)) : b("", !0),
482
- m.value ? (O(), x("p", Ne, j(M(i).t("wise_invoicing.delivery.send.preview_error")), 1)) : b("", !0),
303
+ M(s).result.value.isErr() ? (O(), x("p", ye, j(M(i).t("wise_invoicing.delivery.send.connection_error")), 1)) : b("", !0),
304
+ m.value ? (O(), x("p", be, j(M(i).t("wise_invoicing.delivery.send.preview_error")), 1)) : b("", !0),
483
305
  w(M(re), {
484
306
  label: M(i).t("wise_invoicing.delivery.send.preview"),
485
307
  "is-loading": f.value,
@@ -492,13 +314,13 @@ var De = /* @__PURE__ */ T({
492
314
  "is-loading",
493
315
  "is-disabled"
494
316
  ]),
495
- F.value && l.value !== null ? (O(), x("div", Pe, [
317
+ F.value && l.value !== null ? (O(), x("div", xe, [
496
318
  S("p", null, j(M(i).t("wise_invoicing.delivery.send.document_count", { count: l.value.totalDocuments })), 1),
497
319
  (O(!0), x(_, null, A(l.value.channels, (e) => (O(), x("p", { key: e.channel }, j(M(i).t(`wise_invoicing.delivery.channel.${e.channel}`)) + ": " + j(M(i).t("wise_invoicing.delivery.send.summary", e)), 1))), 128)),
498
320
  (O(!0), x(_, null, A(l.value.items, (e) => (O(), x("div", {
499
321
  key: `${e.invoiceUuid}-${e.channel}`,
500
322
  class: "flex flex-col gap-xs border-b border-secondary pb-md text-sm"
501
- }, [S("strong", null, j(R(e.invoiceUuid)) + " · " + j(M(i).t(`wise_invoicing.delivery.channel.${e.channel}`)), 1), e.queued ? (O(), x("span", Fe, j(M(i).t("wise_invoicing.delivery.send.queued")), 1)) : e.reason === null ? e.delivery === null ? (O(), x("span", Re, j(M(i).t("wise_invoicing.delivery.send.ready")), 1)) : (O(), x(_, { key: 2 }, [S("span", null, j(M(i).t(`wise_invoicing.delivery.state.${e.delivery.state}`)), 1), e.delivery.errorCode === null ? b("", !0) : (O(), x("span", Le, j(B(e.delivery.errorCode)), 1))], 64)) : (O(), x("span", Ie, j(B(e.reason)), 1))]))), 128))
323
+ }, [S("strong", null, j(R(e.invoiceUuid)) + " · " + j(M(i).t(`wise_invoicing.delivery.channel.${e.channel}`)), 1), e.queued ? (O(), x("span", Se, j(M(i).t("wise_invoicing.delivery.send.queued")), 1)) : e.reason === null ? e.delivery === null ? (O(), x("span", Te, j(M(i).t("wise_invoicing.delivery.send.ready")), 1)) : (O(), x(_, { key: 2 }, [S("span", null, j(M(i).t(`wise_invoicing.delivery.state.${e.delivery.state}`)), 1), e.delivery.errorCode === null ? b("", !0) : (O(), x("span", we, j(B(e.delivery.errorCode)), 1))], 64)) : (O(), x("span", Ce, j(B(e.reason)), 1))]))), 128))
502
324
  ])) : b("", !0)
503
325
  ]),
504
326
  w(M(ie), null, {
@@ -512,6 +334,181 @@ var De = /* @__PURE__ */ T({
512
334
  _: 1
513
335
  }, 8, ["form"]));
514
336
  }
515
- });
337
+ }), De = 3e5, W = /* @__PURE__ */ new Map(), G = null, K = null;
338
+ function Oe(e) {
339
+ return typeof e == "object" && !!e && "pages" in e && Array.isArray(e.pages);
340
+ }
341
+ function q(e) {
342
+ return Oe(e) ? e.pages.flatMap((e) => e.isOk() ? e.getValue().data : []) : [];
343
+ }
344
+ function J(e) {
345
+ return Object.keys(e);
346
+ }
347
+ function Y(e, t) {
348
+ return JSON.stringify(e) === JSON.stringify(t);
349
+ }
350
+ function ke(e, t) {
351
+ let n = J(t.patch);
352
+ return n.every((n) => Y(e[n], t.patch[n])) ? !0 : n.some((n) => n in t.serverValues && !Y(e[n], t.serverValues[n]));
353
+ }
354
+ function Ae() {
355
+ return F().getQueryCache().findAll({ predicate: (e) => e.queryKey[0] === "invoiceIndex" }).flatMap((e) => q(e.state.data));
356
+ }
357
+ function je(e, t) {
358
+ return e === void 0 ? {} : Object.fromEntries(J(t).map((t) => [t, e[t]]));
359
+ }
360
+ function X() {
361
+ new P(F()).update("invoiceIndex", {
362
+ by: (e) => W.has(e.uuid),
363
+ value: (e) => ({
364
+ ...e,
365
+ ...W.get(e.uuid)?.patch
366
+ })
367
+ });
368
+ }
369
+ function Me(e) {
370
+ let t = Date.now() - De;
371
+ for (let [e, n] of W) n.patchedAt <= t && W.delete(e);
372
+ for (let t of e) {
373
+ let e = W.get(t.uuid);
374
+ e !== void 0 && ke(t, e) && W.delete(t.uuid);
375
+ }
376
+ }
377
+ function Z() {
378
+ K?.(), K = null, G = null;
379
+ }
380
+ function Ne(e) {
381
+ if (e.type !== "updated" || e.action.type !== "success" || e.action.manual === !0 || e.query.queryKey[0] !== "invoiceIndex") return;
382
+ let t = e.query.state.data;
383
+ Me(q(t)), W.size === 0 ? Z() : X();
384
+ }
385
+ function Pe() {
386
+ let e = F().getQueryCache();
387
+ G !== e && (Z(), G = e, K = e.subscribe(Ne));
388
+ }
389
+ var Fe = class {
390
+ static reflectBulkAction(e, t) {
391
+ if (e.length === 0) return;
392
+ let n = Date.now(), r = new Map(Ae().map((e) => [e.uuid, e]));
393
+ for (let i of e) {
394
+ let e = W.get(i);
395
+ W.set(i, {
396
+ patchedAt: n,
397
+ patch: {
398
+ ...e?.patch,
399
+ ...t
400
+ },
401
+ serverValues: {
402
+ ...je(r.get(i), t),
403
+ ...e?.serverValues
404
+ }
405
+ });
406
+ }
407
+ X(), Pe();
408
+ }
409
+ }, Q = class {
410
+ static filterByEntityType(e, t) {
411
+ return e.filter((e) => e.entityType === t);
412
+ }
413
+ static filterByView(e, t) {
414
+ return e.flatMap((e) => {
415
+ let n = e.views.find((e) => e.key === t);
416
+ return n === void 0 ? [] : [{
417
+ definition: e,
418
+ order: n.order
419
+ }];
420
+ }).toSorted((e, t) => e.order - t.order).map(({ definition: e }) => e);
421
+ }
422
+ static getChoiceLabel(e, t, n) {
423
+ let r = e.choices.find((e) => e.value === t);
424
+ return r === void 0 ? t : this.getLocalizedValue(r.label, n) || t;
425
+ }
426
+ static getLabel(e, t) {
427
+ return this.getLocalizedValue(e.label, t) || e.key;
428
+ }
429
+ static getLocalizedValue(e, t) {
430
+ let n = t.toLowerCase(), r = n.split("-")[0], i = e.items.find((e) => e.locale.toLowerCase() === n), a = e.items.find((e) => e.locale.toLowerCase().split("-")[0] === r);
431
+ return i?.value ?? a?.value ?? e.items[0]?.value ?? "";
432
+ }
433
+ }, Ie = /* @__PURE__ */ T({
434
+ __name: "CustomFieldValueText",
435
+ props: {
436
+ definition: {},
437
+ size: {},
438
+ value: {}
439
+ },
440
+ setup(e) {
441
+ let t = e, n = g(), r = d(), i = p(), a = f(), o = v(() => {
442
+ switch (t.value.type) {
443
+ case l.BOOLEAN: return t.value.value ? n.t("wise_invoicing.common.yes") : n.t("wise_invoicing.common.no");
444
+ case l.DATE: return t.value.value === "infinity" ? n.t("wise_invoicing.custom_field.date.infinity") : t.value.value === "-infinity" ? n.t("wise_invoicing.custom_field.date.negative_infinity") : i.formatPlainDate(t.value.value);
445
+ case l.MONETARY: return r.formatMonetary(t.value.value);
446
+ case l.MULTI_SELECT: return t.value.value.map((e) => u(e)).join(", ");
447
+ case l.NUMBER: return new Intl.NumberFormat(n.locale.value, { maximumFractionDigits: 20 }).format(t.value.value);
448
+ case l.REFERENCE: return t.value.value;
449
+ case l.SINGLE_SELECT: return u(t.value.value);
450
+ case l.TEXT: return t.value.value;
451
+ case l.TEXT_ARRAY: return t.value.value.join(", ");
452
+ case l.TIMESTAMP: return i.toDateTime(t.value.value);
453
+ default: throw TypeError("Unsupported custom field value type");
454
+ }
455
+ }), s = v(() => t.value.type !== l.REFERENCE || t.definition === void 0 ? null : a.getCustomFieldReferenceRoute({
456
+ entityType: t.definition.entityType,
457
+ key: t.definition.key,
458
+ value: t.value.value
459
+ })), c = v(() => t.size === "md" ? "min-w-0 text-sm/5 text-primary" : "min-w-0 text-xs text-primary");
460
+ function u(e) {
461
+ return t.definition === void 0 ? e : Q.getChoiceLabel(t.definition, e, n.locale.value);
462
+ }
463
+ return (e, r) => s.value !== null && t.definition !== void 0 ? (O(), y(M(R), {
464
+ key: 0,
465
+ to: s.value,
466
+ class: D([c.value, "underline underline-offset-2 transition-colors hover:text-brand-700 focus-visible:text-brand-700 focus-visible:outline-none"])
467
+ }, {
468
+ default: N(() => [C(j(M(Q).getLabel(t.definition, M(n).locale.value)), 1)]),
469
+ _: 1
470
+ }, 8, ["to", "class"])) : (O(), y(M(B), {
471
+ key: 1,
472
+ text: o.value || "-",
473
+ class: D(c.value)
474
+ }, null, 8, ["text", "class"]));
475
+ }
476
+ }), $ = /* @__PURE__ */ function(e) {
477
+ return e.CREDIT_NOTE_DETAIL = "credit-note-detail", e.INVOICE_DETAIL = "invoice-detail", e.INVOICE_OVERVIEW = "invoice-overview", e;
478
+ }({}), Le = class {
479
+ static fromDto(e) {
480
+ return {
481
+ uuid: e.uuid,
482
+ isRequired: e.isRequired,
483
+ choices: e.choices?.map((e) => ({
484
+ label: e.label,
485
+ order: e.order,
486
+ value: e.value
487
+ })).toSorted((e, t) => e.order - t.order) ?? [],
488
+ description: e.description,
489
+ entityType: e.entityType,
490
+ key: e.key,
491
+ label: e.label,
492
+ rules: e.rules,
493
+ type: e.type,
494
+ views: e.views.filter((e) => Object.values($).includes(e.key)).map((e) => ({
495
+ key: e.key,
496
+ order: e.order
497
+ }))
498
+ };
499
+ }
500
+ }, Re = class {
501
+ static async getAll(e) {
502
+ return (await a.fromPromise(o({ query: e?.entityTypes === void 0 ? void 0 : { filter: { entityTypes: e.entityTypes } } }))).map((e) => e.data.map(Le.fromDto));
503
+ }
504
+ };
505
+ //#endregion
506
+ //#region src/modules/custom-field/api/queries/customFieldDefinitionIndex.query.ts
507
+ function ze(e) {
508
+ return L("customFieldDefinitionIndex", {
509
+ params: { queryParams: e },
510
+ queryFn: () => Re.getAll(e?.value)
511
+ });
512
+ }
516
513
  //#endregion
517
- export { he as a, V as c, ge as i, $ as n, H as o, Te as r, pe as s, ze as t };
514
+ export { Fe as a, fe as c, Q as i, $ as n, Ee as o, Ie as r, U as s, ze as t };
@@ -4,8 +4,8 @@ import c from "zod";
4
4
  import { useI18n as l } from "vue-i18n";
5
5
  import { Fragment as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createVNode as g, defineComponent as _, inject as v, mergeProps as y, normalizeClass as ee, onUnmounted as te, openBlock as b, provide as ne, ref as x, renderList as S, renderSlot as C, resolveDynamicComponent as re, toDisplayString as ie, unref as w, useId as ae, watch as oe, withCtx as T } from "vue";
6
6
  import { UIActionDropdownMenu as se, UIActionFocus as ce, UIActionTooltip as le, UIActionTrigger as E, UIButton as ue, UIClickableElement as D, UIDatePicker as de, UIDateRangePicker as fe, UIDialog as pe, UIDialogBody as me, UIDialogFooter as he, UIDialogFooterCancel as ge, UIDialogFooterPrimary as _e, UIDialogFooterSecondary as ve, UIDialogFooterSubmit as ye, UIDialogHeader as be, UIDropdownMenu as xe, UIDropdownMenuGroup as Se, UIDropdownMenuRadioGroup as Ce, UIDropdownMenuRadioItem as we, UIFormDialog as Te, UIIconButton as Ee, UINumberField as De, UIRowLayout as Oe, UISeparator as ke, UIText as O, toFormField as Ae, useNumberFormat as je, useOverlay as Me } from "@wisemen/vue-core-design-system";
7
- import { GroupPriority as Ne, createAction as k, useTemporaryActions as Pe } from "@wisemen/vue-core-actions";
8
- import { useForm as Fe } from "formango";
7
+ import { useForm as Ne } from "formango";
8
+ import { GroupPriority as Pe, createAction as k, useTemporaryActions as Fe } from "@wisemen/vue-core-actions";
9
9
  //#region ../../../node_modules/.pnpm/@wisemen+vue-core-filters@10.0.2_bdd5d16a1f6811ef5a3276c645cea355/node_modules/@wisemen/vue-core-filters/dist/index.js
10
10
  function Ie(e) {
11
11
  let t = Symbol(e);
@@ -54,7 +54,7 @@ var [Le, A] = Ie("filtersContext"), Re = /* @__PURE__ */ _({
54
54
  group: {
55
55
  name: () => r.filter.label,
56
56
  category: () => i.t("component.filters.action_category"),
57
- priority: Ne.HOVER
57
+ priority: Pe.HOVER
58
58
  },
59
59
  icon: () => t,
60
60
  keyboardShortcut: { key: "Backspace" }
@@ -259,7 +259,7 @@ var [Le, A] = Ie("filtersContext"), Re = /* @__PURE__ */ _({
259
259
  icon: () => i,
260
260
  keyboardShortcut: { key: "ArrowRight" }
261
261
  });
262
- return Pe(k({
262
+ return Fe(k({
263
263
  id: `${a.filterId}-today`,
264
264
  isApplicable: (e) => e.menuType === void 0,
265
265
  name: () => c.t("component.filters_date_navigation.today"),
@@ -942,7 +942,7 @@ var qt = /* @__PURE__ */ _({
942
942
  },
943
943
  emits: ["submit"],
944
944
  setup(t, { emit: n }) {
945
- let r = t, i = n, a = l(), o = ae(), s = Fe({
945
+ let r = t, i = n, a = l(), o = ae(), s = Ne({
946
946
  schema: c.object({ value: c.number().min(r.filter.min ?? -(2 ** 53 - 1)).max(r.filter.max ?? 2 ** 53 - 1).nullable() }),
947
947
  onSubmit: (e) => {
948
948
  i("submit", {
@@ -1267,7 +1267,7 @@ function sn(e) {
1267
1267
  function re() {
1268
1268
  for (let t of e.filters) t.isPersistent !== !0 && (u.value[t.key] = te(t.key), p.value.delete(t.key));
1269
1269
  }
1270
- Pe(h);
1270
+ Fe(h);
1271
1271
  let ie = {
1272
1272
  action: g,
1273
1273
  actionGroup: e.actionGroup,
package/dist/index.d.ts CHANGED
@@ -17,6 +17,8 @@ export { addressFormSchema } from './models/address/addressForm.model.ts';
17
17
  export type { CreditNoteQueryKeys as WiseInvoicingCreditNoteQueryKeys } from './modules/credit-note/api/query-keys/creditNote.queryKeys.ts';
18
18
  export type { CreditNoteUuid as WiseInvoicingCreditNoteUuid } from './modules/credit-note/models/creditNoteUuid.model.ts';
19
19
  export { creditNoteUuidSchema } from './modules/credit-note/models/creditNoteUuid.model.ts';
20
+ export { default as WiseInvoicingCreditNoteDetailView } from './modules/credit-note/use-cases/detail/views/CreditNoteDetailViewDataProvider.vue';
21
+ export { default as WiseInvoicingCreditNotePdfView } from './modules/credit-note/use-cases/pdf/views/CreditNotePdfViewDataProvider.vue';
20
22
  export type { CustomFieldDefinitionQueryKeys as WiseInvoicingCustomFieldDefinitionQueryKeys } from './modules/custom-field/api/query-keys/customFieldDefinition.queryKeys.ts';
21
23
  export type { CustomFieldDefinitionUuid as WiseInvoicingCustomFieldDefinitionUuid } from './modules/custom-field/models/custom-field-definition/customFieldDefinitionUuid.model.ts';
22
24
  export { CustomFieldViewKey as WiseInvoicingCustomFieldViewKey } from './modules/custom-field/models/custom-field-definition/customFieldViewKey.model.ts';
@@ -38,7 +40,9 @@ export type { InvoiceQueryKeys as WiseInvoicingInvoiceQueryKeys } from './module
38
40
  export type { InvoicePdfDetail as WiseInvoicingInvoicePdfDetail, InvoicePdfGroup as WiseInvoicingInvoicePdfGroup, InvoicePdfLine as WiseInvoicingInvoicePdfLine, } from './modules/invoice/models/invoice/pdf/invoicePdfDetail.model.ts';
39
41
  export type { InvoiceUuid as WiseInvoicingInvoiceUuid } from './modules/invoice/models/invoiceUuid.model.ts';
40
42
  export { invoiceUuidSchema } from './modules/invoice/models/invoiceUuid.model.ts';
43
+ export { default as WiseInvoicingInvoiceDetailView } from './modules/invoice/use-cases/detail/views/InvoiceDetailViewDataProvider.vue';
41
44
  export { default as WiseInvoicingInvoiceOverviewView } from './modules/invoice/use-cases/overview/views/InvoiceOverviewViewDataProvider.vue';
45
+ export { default as WiseInvoicingInvoicePdfView } from './modules/invoice/use-cases/pdf/views/InvoicePdfViewDataProvider.vue';
42
46
  export { default as WiseInvoicingInvoicePublicPdfViewDataProvider } from './modules/invoice/use-cases/pdf/views/InvoicePublicPdfViewDataProvider.vue';
43
47
  export type { InvoiceApprovalActionModel } from './modules/invoice-approval/actions/invoiceApproval.actions.ts';
44
48
  export type { InvoiceApprovalQueryKeys as WiseInvoicingInvoiceApprovalQueryKeys } from './modules/invoice-approval/api/query-keys/invoiceApproval.queryKeys.ts';