@wisemen/wise-invoicing-web 0.0.7 → 0.1.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.
@@ -4,7 +4,7 @@ import { n as g, r as _, t as v } from "./useCurrencyFormat.composable-MtZaqKnO.
4
4
  import { r as y, t as b } from "./invoice.service-Bb8VqQvc.js";
5
5
  import { t as x } from "./customFieldValue.util-BwsX8exl.js";
6
6
  import { t as ee } from "./percentage.util-Bl78kSSk.js";
7
- import { n as te } from "./invoicingConfig.composable-D8HuO3Sl.js";
7
+ import { n as te } from "./invoicingConfig.composable-DTmad1fe.js";
8
8
  import { t as ne } from "./dist-BFx8U4Su.js";
9
9
  import { A as S, B as C, E as re, F as ie, H as ae, J as oe, K as se, M as ce, N as le, P as ue, R as de, Y as fe, _ as pe, b as me, et as he, f as ge, k as _e, m as ve, n as ye, o as be, p as xe, r as Se, s as Ce, t as we, tt as Te, u as Ee, w as De, y as Oe, z as ke } from "./dist-D9lp7NDv.js";
10
10
  import { n as Ae } from "./dist-boJIIxnT.js";
@@ -13,7 +13,7 @@ import { t as Ne } from "./DataProvider-Dj34ljUX.js";
13
13
  import { t as Pe } from "./formango.util-D5c2ql--.js";
14
14
  import { t as Fe } from "./_plugin-vue_export-helper-B3ysoDQm.js";
15
15
  import { t as Ie } from "./dashboard-BaWGNEek.js";
16
- import { n as Le, r as Re, t as ze } from "./BillingDocumentPdf-Dj_s1l_p.js";
16
+ import { n as Le, r as Re, t as ze } from "./BillingDocumentPdf-5vi2pgRM.js";
17
17
  import { useViewModels as Be } from "@wisemen/vue-core-actions";
18
18
  import { RouterLink as Ve, useRouter as He } from "vue-router";
19
19
  import Ue, { z as w } from "zod";
@@ -1,6 +1,6 @@
1
1
  import "./api.util-BCSgCfpS.js";
2
2
  import { g as e, h as t } from "./documentTitle.composable-4ApFl9TZ.js";
3
- import { n } from "./invoicingConfig.composable-D8HuO3Sl.js";
3
+ import { n } from "./invoicingConfig.composable-DTmad1fe.js";
4
4
  import { n as r } from "./address.transformer-jGddczLV.js";
5
5
  import { Z as i } from "./dist-D9lp7NDv.js";
6
6
  import { useI18n as a } from "vue-i18n";
@@ -8,7 +8,7 @@ import { n as _, t as ee } from "./dist-boJIIxnT.js";
8
8
  import { i as te, r as v } from "./CustomFieldValueText-BGbQwhON.js";
9
9
  import { t as y } from "./formango.util-D5c2ql--.js";
10
10
  import { n as b, r as x, t as S } from "./creditNoteDetail.query-BcPsB96h.js";
11
- import { C, S as ne, _ as w, a as T, b as re, c as E, d as D, f as O, g as k, h as ie, i as ae, m as oe, n as se, o as ce, p as le, r as ue, s as de, t as fe, u as pe, v as me, w as A, x as he, y as ge } from "./BillingDocumentDetailViewDataProvider-CmHbMXp0.js";
11
+ import { C, S as ne, _ as w, a as T, b as re, c as E, d as D, f as O, g as k, h as ie, i as ae, m as oe, n as se, o as ce, p as le, r as ue, s as de, t as fe, u as pe, v as me, w as A, x as he, y as ge } from "./BillingDocumentDetailViewDataProvider-BemnzVNY.js";
12
12
  import { useRouter as _e } from "vue-router";
13
13
  import ve, { z as j } from "zod";
14
14
  import { useI18n as M } from "vue-i18n";
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./DataProvider-Dj34ljUX.js";
2
- import { t } from "./InvoicePdfView-Desmlys1.js";
2
+ import { t } from "./InvoicePdfView-C-7m2g3b.js";
3
3
  import { t as n } from "./creditNoteDetail.query-BcPsB96h.js";
4
4
  import { useI18n as r } from "vue-i18n";
5
5
  import { computed as i, createBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, openBlock as l, unref as u, withCtx as d } from "vue";
@@ -2,10 +2,10 @@ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
2
  import "./api.util-BCSgCfpS.js";
3
3
  import { b as t, t as n } from "./documentTitle.composable-4ApFl9TZ.js";
4
4
  import { r } from "./useCurrencyFormat.composable-MtZaqKnO.js";
5
- import { n as i } from "./invoicingConfig.composable-D8HuO3Sl.js";
5
+ import { n as i } from "./invoicingConfig.composable-DTmad1fe.js";
6
6
  import { n as a } from "./reminderConfig.query-DsJNqqi7.js";
7
7
  import { Q as o, R as ee, U as s, q as te, tt as c, x as l } from "./dist-D9lp7NDv.js";
8
- import { a as u, i as ne, n as re, r as ie, t as ae } from "./DunningCaseSendDialog-DISQ1Fs3.js";
8
+ import { a as u, i as ne, n as re, r as ie, t as ae } from "./DunningCaseSendDialog-DyvA5R1p.js";
9
9
  import { n as oe } from "./dist-boJIIxnT.js";
10
10
  import { t as d } from "./DataProvider-Dj34ljUX.js";
11
11
  import { useViewModels as se } from "@wisemen/vue-core-actions";
@@ -2,10 +2,10 @@ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
2
  import { t } from "./documentTitle.composable-4ApFl9TZ.js";
3
3
  import { r as n } from "./useCurrencyFormat.composable-MtZaqKnO.js";
4
4
  import { t as r } from "./search.composable-BCtYqudV.js";
5
- import { n as i } from "./invoicingConfig.composable-D8HuO3Sl.js";
5
+ import { n as i } from "./invoicingConfig.composable-DTmad1fe.js";
6
6
  import { n as a, r as o } from "./reminderConfig.query-DsJNqqi7.js";
7
7
  import { $ as s, N as c, S as l, c as u, k as d, l as f, tt as p } from "./dist-D9lp7NDv.js";
8
- import { i as m, o as h, r as g, t as _ } from "./DunningCaseSendDialog-DISQ1Fs3.js";
8
+ import { i as m, o as h, r as g, t as _ } from "./DunningCaseSendDialog-DyvA5R1p.js";
9
9
  import { f as v, i as y, n as ee, o as te, r as b, s as ne } from "./dist-BBjpqvUl.js";
10
10
  import { createAction as x } from "@wisemen/vue-core-actions";
11
11
  import { useRouter as S } from "vue-router";
@@ -1,6 +1,6 @@
1
1
  import { R as e, t, z as n } from "./api.util-BCSgCfpS.js";
2
2
  import { r } from "./useCurrencyFormat.composable-MtZaqKnO.js";
3
- import { n as i } from "./invoicingConfig.composable-D8HuO3Sl.js";
3
+ import { n as i } from "./invoicingConfig.composable-DTmad1fe.js";
4
4
  import { n as a, r as o, t as s } from "./reminderConfig.query-DsJNqqi7.js";
5
5
  import { K as c, d as l, tt as u } from "./dist-D9lp7NDv.js";
6
6
  import { t as d } from "./customerUuid.model-GUFYq3O2.js";
@@ -5,7 +5,7 @@ import { r as d } from "./useCurrencyFormat.composable-MtZaqKnO.js";
5
5
  import { t as f } from "./search.composable-BCtYqudV.js";
6
6
  import { a as p, i as m, n as h, o as g, t as _ } from "./invoice.service-Bb8VqQvc.js";
7
7
  import { n as v, t as y } from "./customFieldValue.util-BwsX8exl.js";
8
- import { n as b } from "./invoicingConfig.composable-D8HuO3Sl.js";
8
+ import { n as b } from "./invoicingConfig.composable-DTmad1fe.js";
9
9
  import { n as x } from "./address.transformer-jGddczLV.js";
10
10
  import { D as ee, I as S, M as te, O as ne, Q as re, W as ie, X as C, f as ae, g as oe, h as se, i as ce, j as le, l as w, t as ue, tt as de, v as fe, w as pe } from "./dist-D9lp7NDv.js";
11
11
  import { n as T, t as E } from "./dist-boJIIxnT.js";
@@ -13,7 +13,7 @@ import { i as D, n as me, r as he } from "./CustomFieldValueText-BGbQwhON.js";
13
13
  import { t as O } from "./formango.util-D5c2ql--.js";
14
14
  import { a as ge, c as _e, i as ve, n as ye, o as be, r as xe, s as Se, t as Ce, u as we } from "./invoiceDeliveryStatus.util-BPkGCQM6.js";
15
15
  import { t as Te } from "./issuerSettings.query-Bvz-Oj5D.js";
16
- import { C as Ee, S as De, _ as Oe, a as ke, b as Ae, c as je, d as Me, f as Ne, g as Pe, h as Fe, i as Ie, l as Le, m as Re, n as ze, o as Be, p as Ve, r as He, s as Ue, t as We, u as Ge, v as Ke, w as qe, x as Je, y as Ye } from "./BillingDocumentDetailViewDataProvider-CmHbMXp0.js";
16
+ import { C as Ee, S as De, _ as Oe, a as ke, b as Ae, c as je, d as Me, f as Ne, g as Pe, h as Fe, i as Ie, l as Le, m as Re, n as ze, o as Be, p as Ve, r as He, s as Ue, t as We, u as Ge, v as Ke, w as qe, x as Je, y as Ye } from "./BillingDocumentDetailViewDataProvider-BemnzVNY.js";
17
17
  import { t as Xe } from "./invoiceDetail.query-Cek8nyaw.js";
18
18
  import { RouterLink as Ze, useRouter as Qe } from "vue-router";
19
19
  import $e, { z as k } from "zod";
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./documentTitle.composable-4ApFl9TZ.js";
2
- import { t } from "./BillingDocumentPdf-Dj_s1l_p.js";
2
+ import { t } from "./BillingDocumentPdf-5vi2pgRM.js";
3
3
  import { useI18n as n } from "vue-i18n";
4
4
  import { computed as r, createElementBlock as i, createVNode as a, defineComponent as o, openBlock as s } from "vue";
5
5
  //#region src/modules/invoice/use-cases/pdf/views/InvoicePdfView.vue?vue&type=script&setup=true&lang.ts
@@ -0,0 +1,22 @@
1
+ import { n as e } from "./invoicingConfig.composable-DTmad1fe.js";
2
+ import { t } from "./DataProvider-Dj34ljUX.js";
3
+ import { t as n } from "./InvoicePdfView-C-7m2g3b.js";
4
+ import { t as r } from "./invoiceDetail.query-Cek8nyaw.js";
5
+ import { useI18n as i } from "vue-i18n";
6
+ import { computed as a, createBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, openBlock as u, resolveDynamicComponent as d, unref as f, withCtx as p } from "vue";
7
+ import { UIText as m } from "@wisemen/vue-core-design-system";
8
+ //#region src/modules/invoice/use-cases/pdf/views/InvoicePdfViewDataProvider.vue?vue&type=script&setup=true&lang.ts
9
+ var h = { class: "flex min-h-screen items-center justify-center bg-secondary" }, g = /* @__PURE__ */ l({
10
+ __name: "InvoicePdfViewDataProvider",
11
+ props: { invoiceUuid: {} },
12
+ setup(l) {
13
+ let g = l, _ = i(), v = e(), y = a(() => v.invoicePdfComponent.value ?? n), b = r(a(() => g.invoiceUuid));
14
+ return (e, n) => (u(), o(t, { queries: { invoice: f(b) } }, {
15
+ default: p(({ data: e }) => [(u(), o(d(y.value), { invoice: e.invoice }, null, 8, ["invoice"]))]),
16
+ loading: p(() => [s("div", h, [c(f(m), { text: f(_).t("wise_invoicing.common.loading") }, null, 8, ["text"])])]),
17
+ _: 1
18
+ }, 8, ["queries"]));
19
+ }
20
+ });
21
+ //#endregion
22
+ export { g as default };
@@ -0,0 +1,45 @@
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ import { t } from "./invoice.service-Bb8VqQvc.js";
3
+ import { n } from "./invoicingConfig.composable-DTmad1fe.js";
4
+ import { t as r } from "./DataProvider-Dj34ljUX.js";
5
+ import { t as i } from "./InvoicePdfView-C-7m2g3b.js";
6
+ import { useRouter as a } from "vue-router";
7
+ import { useI18n as o } from "vue-i18n";
8
+ import { computed as s, createBlock as c, createElementBlock as l, createElementVNode as u, createVNode as d, defineComponent as f, openBlock as p, resolveDynamicComponent as m, unref as h, watch as g, withCtx as _ } from "vue";
9
+ import { useQuery as v } from "@wisemen/vue-core-api-utils";
10
+ import { UIText as y } from "@wisemen/vue-core-design-system";
11
+ import { useRouteQuery as b } from "@vueuse/router";
12
+ //#region src/modules/invoice/api/queries/invoicePublicDetail.query.ts
13
+ function x(e) {
14
+ return v("invoicePublicDetail", {
15
+ isEnabled: s(() => e.value !== null),
16
+ params: { token: e },
17
+ queryFn: () => {
18
+ if (e.value === null) throw Error("Token is required to fetch invoice public detail");
19
+ return t.getPublicDetail(e.value);
20
+ }
21
+ });
22
+ }
23
+ //#endregion
24
+ //#region src/modules/invoice/use-cases/pdf/views/InvoicePublicPdfViewDataProvider.vue?vue&type=script&setup=true&lang.ts
25
+ var S = { class: "flex min-h-screen items-center justify-center bg-secondary" }, C = {
26
+ key: 1,
27
+ class: "flex min-h-screen items-center justify-center bg-secondary"
28
+ }, w = /*@__PURE__*/ f({
29
+ __name: "InvoicePublicPdfViewDataProvider",
30
+ setup(e) {
31
+ let t = o(), f = n(), v = s(() => f.invoicePdfComponent.value ?? i), w = a(), T = b("token", null), E = x(s(() => T.value));
32
+ return g(s(() => T.value === null || E.result.value?.isErr() === !0), async (e) => {
33
+ e && await w.replace({ name: "index" });
34
+ }, { immediate: !0 }), (e, n) => h(T) === null ? (p(), l("div", C, [d(h(y), { text: h(t).t("wise_invoicing.common.loading") }, null, 8, ["text"])])) : (p(), c(r, {
35
+ key: 0,
36
+ queries: { invoice: h(E) }
37
+ }, {
38
+ default: _(({ data: e }) => [(p(), c(m(v.value), { invoice: e.invoice }, null, 8, ["invoice"]))]),
39
+ loading: _(() => [u("div", S, [d(h(y), { text: h(t).t("wise_invoicing.common.loading") }, null, 8, ["text"])])]),
40
+ _: 1
41
+ }, 8, ["queries"]));
42
+ }
43
+ }), T = /* @__PURE__ */ e({ default: () => E }), E = w;
44
+ //#endregion
45
+ export { T as n, x as r, E as t };
@@ -1,4 +1,4 @@
1
- import { MaybeRefOrGetter } from 'vue';
1
+ import { Component, MaybeRefOrGetter } from 'vue';
2
2
  import { RouteLocationRaw } from 'vue-router';
3
3
  export interface InvoicingConfig {
4
4
  isDeliveryDateVisible?: boolean;
@@ -11,6 +11,12 @@ export interface InvoicingInitProps {
11
11
  environment?: string;
12
12
  getAccessToken?: () => Promise<string | null>;
13
13
  getCustomerDetailRoute?: (customerUuid: string) => RouteLocationRaw | null;
14
+ /**
15
+ * Renders the invoice PDF instead of the built-in layout, on both the in-app preview and the
16
+ * public token route. It receives a single `invoice: InvoicePdfDetail` prop, so a host app can
17
+ * ship its own invoice design without re-implementing the fetching or the token handling.
18
+ */
19
+ invoicePdfComponent?: Component;
14
20
  locale: MaybeRefOrGetter<string>;
15
21
  }
16
22
  export declare function initInvoicingConfig(props: InvoicingInitProps): Promise<void>;
@@ -21,4 +27,5 @@ export declare function useInvoicingConfig(): {
21
27
  isLineDiscountEnabled: import('vue').ComputedRef<boolean>;
22
28
  getCustomerDetailRoute: (customerUuid: string) => RouteLocationRaw | null;
23
29
  init: (props: InvoicingInitProps) => Promise<void>;
30
+ invoicePdfComponent: import('vue').ComputedRef<Component | null>;
24
31
  };
package/dist/index.js CHANGED
@@ -8,17 +8,17 @@ import { r as ee, t as p } from "./InvoiceOverviewViewDataProvider-i8tXATJE.js";
8
8
  import { n as m, t as h } from "./customFieldValue.util-BwsX8exl.js";
9
9
  import { n as g } from "./plainDate.transformer-BxvJpJOv.js";
10
10
  import { n as _, t as v } from "./percentage.util-Bl78kSSk.js";
11
- import { n as y, t as b } from "./invoicingConfig.composable-D8HuO3Sl.js";
11
+ import { n as y, t as b } from "./invoicingConfig.composable-DTmad1fe.js";
12
12
  import { n as x } from "./address.transformer-jGddczLV.js";
13
13
  import { t as S } from "./addressForm.model-C853zEtX.js";
14
- import { r as C, t as te } from "./DunningCaseOverviewView-DvOmEcJY.js";
15
- import { r as ne, t as re } from "./InvoicePublicPdfViewDataProvider-DoNBZsmi.js";
14
+ import { r as C, t as te } from "./DunningCaseOverviewView-aWttPLrC.js";
15
+ import { r as ne, t as re } from "./InvoicePublicPdfViewDataProvider-BJe-8hC5.js";
16
16
  import { C as w, L as ie, T } from "./dist-D9lp7NDv.js";
17
- import { o as ae } from "./DunningCaseSendDialog-DISQ1Fs3.js";
17
+ import { o as ae } from "./DunningCaseSendDialog-DyvA5R1p.js";
18
18
  import { n as oe } from "./dist-boJIIxnT.js";
19
19
  import { a as se, i as ce, l as E, n as le, o as ue, r as de, s as fe, t as D } from "./dist-BBjpqvUl.js";
20
20
  import { i as O } from "./CustomFieldValueText-BGbQwhON.js";
21
- import { t as pe } from "./DunningCaseDetailViewDataProvider-CInwZwMc.js";
21
+ import { t as pe } from "./DunningCaseDetailViewDataProvider-DKuuysqS.js";
22
22
  import { t as me } from "./DunningCaseReminderPdfViewDataProvider-I0I_WQQB.js";
23
23
  import { t as he } from "./ReminderSettingsViewDataProvider-Dys4bUU7.js";
24
24
  import { createAction as ge } from "@wisemen/vue-core-actions";
@@ -216,13 +216,13 @@ var Le = Y([{
216
216
  children: [{
217
217
  name: "dunning-case-overview",
218
218
  path: "",
219
- component: () => import("./DunningCaseOverviewView-DvOmEcJY.js").then((e) => e.n),
219
+ component: () => import("./DunningCaseOverviewView-aWttPLrC.js").then((e) => e.n),
220
220
  meta: { permission: "dunning-case.read" }
221
221
  }, {
222
222
  name: "dunning-case-detail",
223
223
  props: !0,
224
224
  path: ":dunningCaseUuid",
225
- component: () => import("./DunningCaseDetailViewDataProvider-CInwZwMc.js").then((e) => e.n),
225
+ component: () => import("./DunningCaseDetailViewDataProvider-DKuuysqS.js").then((e) => e.n),
226
226
  meta: { permission: "dunning-case.read" }
227
227
  }]
228
228
  }]), Re = Y([{
@@ -677,7 +677,7 @@ function ht(e) {
677
677
  name: "invoicing-invoice-detail",
678
678
  props: !0,
679
679
  path: ":invoiceUuid",
680
- component: () => import("./InvoiceDetailViewDataProvider-YOlvUavt.js"),
680
+ component: () => import("./InvoiceDetailViewDataProvider-D6E7YVV1.js"),
681
681
  meta: { permission: "invoice.read" }
682
682
  }]
683
683
  }]);
@@ -686,12 +686,12 @@ var gt = Y([{
686
686
  name: "invoicing-invoice-pdf-preview",
687
687
  props: !0,
688
688
  path: "/invoicing/invoices/:invoiceUuid/pdf",
689
- component: () => import("./InvoicePdfViewDataProvider--CHm0HAM.js"),
689
+ component: () => import("./InvoicePdfViewDataProvider-BPiK110e.js"),
690
690
  meta: { permission: "invoice.read" }
691
691
  }]), _t = Y([{
692
692
  name: "invoicing-invoice-public-pdf-preview",
693
693
  path: "/pdf",
694
- component: () => import("./InvoicePublicPdfViewDataProvider-DoNBZsmi.js").then((e) => e.n)
694
+ component: () => import("./InvoicePublicPdfViewDataProvider-BJe-8hC5.js").then((e) => e.n)
695
695
  }]);
696
696
  //#endregion
697
697
  //#region src/routes/invoicingPublicRoutes.composable.ts
@@ -708,14 +708,14 @@ var yt = [{
708
708
  name: "invoicing-credit-note-detail",
709
709
  props: !0,
710
710
  path: ":creditNoteUuid",
711
- component: () => import("./CreditNoteDetailViewDataProvider-DPePmzgn.js"),
711
+ component: () => import("./CreditNoteDetailViewDataProvider-BuY9ELoK.js"),
712
712
  meta: { permission: "invoice.read" }
713
713
  }]
714
714
  }], bt = [{
715
715
  name: "invoicing-credit-note-pdf-preview",
716
716
  props: !0,
717
717
  path: "/invoicing/credit-notes/:creditNoteUuid/pdf",
718
- component: () => import("./CreditNotePdfViewDataProvider-Dp0zI0fB.js"),
718
+ component: () => import("./CreditNotePdfViewDataProvider-DI4eQkpM.js"),
719
719
  meta: { permission: "invoice.read" }
720
720
  }];
721
721
  //#endregion
@@ -0,0 +1,61 @@
1
+ import { t as e } from "./i18n.lib-C6eb-F-e.js";
2
+ import { Z as t } from "./api.util-BCSgCfpS.js";
3
+ import { useI18n as n } from "vue-i18n";
4
+ import { computed as r, ref as i, shallowRef as a, toValue as o, watch as s } from "vue";
5
+ //#region src/libs/http.lib.ts
6
+ var c = !1, l = null, u = null;
7
+ function d(e, t = "") {
8
+ return Object.keys(e).map((n) => {
9
+ let r = e[n], i = t ? `${t}[${n}]` : n;
10
+ return typeof r == "object" && r && !Array.isArray(r) ? d(r, i) : Array.isArray(r) ? r.map((e, t) => typeof e == "object" ? d(e, `${i}[${t}]`) : `${encodeURIComponent(`${i}[${t}]`)}=${encodeURIComponent(e)}`).join("&") : r == null ? "" : `${encodeURIComponent(i)}=${encodeURIComponent(r)}`;
11
+ }).filter((e) => e !== "").join("&");
12
+ }
13
+ function f(e) {
14
+ l = e.getAccessToken ?? null, u = e.getLocale ?? null, t.setConfig({
15
+ baseUrl: e.apiInvoicingBaseUrl,
16
+ headers: { "Accept-Language": u?.() ?? "en-US" },
17
+ querySerializer: d
18
+ }), !c && (c = !0, t.interceptors.request.use(async (e) => {
19
+ if (u && e.headers.set("Accept-Language", u()), l) {
20
+ let t = await l();
21
+ t !== null && e.headers.set("Authorization", `Bearer ${t}`);
22
+ }
23
+ return e;
24
+ }));
25
+ }
26
+ //#endregion
27
+ //#region src/composables/invoicingConfig.composable.ts
28
+ var p = i(!1), m = i(!0), h = i(!0), g = i(!0);
29
+ function _(e) {
30
+ return null;
31
+ }
32
+ var v = i(_), y = a(null);
33
+ function b(t) {
34
+ return s(() => o(t.locale), (t) => {
35
+ e.global.locale.value = t;
36
+ }), f({
37
+ apiInvoicingBaseUrl: t.apiInvoicingBaseUrl,
38
+ getAccessToken: t.getAccessToken,
39
+ getLocale: () => o(t.locale)
40
+ }), m.value = t.config?.isDeliveryDateVisible ?? !0, h.value = t.config?.isGlobalDiscountEnabled ?? !0, g.value = t.config?.isLineDiscountEnabled ?? !0, v.value = t.getCustomerDetailRoute ?? _, y.value = t.invoicePdfComponent ?? null, p.value = !0, Promise.resolve();
41
+ }
42
+ function x() {
43
+ let e = n();
44
+ function t(t) {
45
+ return b({
46
+ ...t,
47
+ locale: e.locale
48
+ });
49
+ }
50
+ return {
51
+ isDeliveryDateVisible: r(() => m.value),
52
+ isGlobalDiscountEnabled: r(() => h.value),
53
+ isInitialized: r(() => p.value),
54
+ isLineDiscountEnabled: r(() => g.value),
55
+ getCustomerDetailRoute: (e) => v.value(e),
56
+ init: t,
57
+ invoicePdfComponent: r(() => y.value)
58
+ };
59
+ }
60
+ //#endregion
61
+ export { x as n, b as t };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wisemen/wise-invoicing-web",
3
3
  "type": "module",
4
- "version": "0.0.7",
4
+ "version": "0.1.0",
5
5
  "private": false,
6
6
  "description": "Invoicing frontend package with Vue 3 components, composables and types",
7
7
  "author": "Wisemen",
@@ -1,21 +0,0 @@
1
- import { t as e } from "./DataProvider-Dj34ljUX.js";
2
- import { t } from "./InvoicePdfView-Desmlys1.js";
3
- import { t as n } from "./invoiceDetail.query-Cek8nyaw.js";
4
- import { useI18n as r } from "vue-i18n";
5
- import { computed as i, createBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, openBlock as l, unref as u, withCtx as d } from "vue";
6
- import { UIText as f } from "@wisemen/vue-core-design-system";
7
- //#region src/modules/invoice/use-cases/pdf/views/InvoicePdfViewDataProvider.vue?vue&type=script&setup=true&lang.ts
8
- var p = { class: "flex min-h-screen items-center justify-center bg-secondary" }, m = /* @__PURE__ */ c({
9
- __name: "InvoicePdfViewDataProvider",
10
- props: { invoiceUuid: {} },
11
- setup(c) {
12
- let m = c, h = r(), g = n(i(() => m.invoiceUuid));
13
- return (n, r) => (l(), a(e, { queries: { invoice: u(g) } }, {
14
- default: d(({ data: e }) => [s(t, { invoice: e.invoice }, null, 8, ["invoice"])]),
15
- loading: d(() => [o("div", p, [s(u(f), { text: u(h).t("wise_invoicing.common.loading") }, null, 8, ["text"])])]),
16
- _: 1
17
- }, 8, ["queries"]));
18
- }
19
- });
20
- //#endregion
21
- export { m as default };
@@ -1,44 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { t } from "./invoice.service-Bb8VqQvc.js";
3
- import { t as n } from "./DataProvider-Dj34ljUX.js";
4
- import { t as r } from "./InvoicePdfView-Desmlys1.js";
5
- import { useRouter as i } from "vue-router";
6
- import { useI18n as a } from "vue-i18n";
7
- import { computed as o, createBlock as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, openBlock as f, unref as p, watch as m, withCtx as h } from "vue";
8
- import { useQuery as g } from "@wisemen/vue-core-api-utils";
9
- import { UIText as _ } from "@wisemen/vue-core-design-system";
10
- import { useRouteQuery as v } from "@vueuse/router";
11
- //#region src/modules/invoice/api/queries/invoicePublicDetail.query.ts
12
- function y(e) {
13
- return g("invoicePublicDetail", {
14
- isEnabled: o(() => e.value !== null),
15
- params: { token: e },
16
- queryFn: () => {
17
- if (e.value === null) throw Error("Token is required to fetch invoice public detail");
18
- return t.getPublicDetail(e.value);
19
- }
20
- });
21
- }
22
- //#endregion
23
- //#region src/modules/invoice/use-cases/pdf/views/InvoicePublicPdfViewDataProvider.vue?vue&type=script&setup=true&lang.ts
24
- var b = { class: "flex min-h-screen items-center justify-center bg-secondary" }, x = {
25
- key: 1,
26
- class: "flex min-h-screen items-center justify-center bg-secondary"
27
- }, S = /*@__PURE__*/ d({
28
- __name: "InvoicePublicPdfViewDataProvider",
29
- setup(e) {
30
- let t = a(), d = i(), g = v("token", null), S = y(o(() => g.value));
31
- return m(o(() => g.value === null || S.result.value?.isErr() === !0), async (e) => {
32
- e && await d.replace({ name: "index" });
33
- }, { immediate: !0 }), (e, i) => p(g) === null ? (f(), c("div", x, [u(p(_), { text: p(t).t("wise_invoicing.common.loading") }, null, 8, ["text"])])) : (f(), s(n, {
34
- key: 0,
35
- queries: { invoice: p(S) }
36
- }, {
37
- default: h(({ data: e }) => [u(r, { invoice: e.invoice }, null, 8, ["invoice"])]),
38
- loading: h(() => [l("div", b, [u(p(_), { text: p(t).t("wise_invoicing.common.loading") }, null, 8, ["text"])])]),
39
- _: 1
40
- }, 8, ["queries"]));
41
- }
42
- }), C = /* @__PURE__ */ e({ default: () => w }), w = S;
43
- //#endregion
44
- export { C as n, y as r, w as t };
@@ -1,60 +0,0 @@
1
- import { t as e } from "./i18n.lib-C6eb-F-e.js";
2
- import { Z as t } from "./api.util-BCSgCfpS.js";
3
- import { useI18n as n } from "vue-i18n";
4
- import { computed as r, ref as i, toValue as a, watch as o } from "vue";
5
- //#region src/libs/http.lib.ts
6
- var s = !1, c = null, l = null;
7
- function u(e, t = "") {
8
- return Object.keys(e).map((n) => {
9
- let r = e[n], i = t ? `${t}[${n}]` : n;
10
- return typeof r == "object" && r && !Array.isArray(r) ? u(r, i) : Array.isArray(r) ? r.map((e, t) => typeof e == "object" ? u(e, `${i}[${t}]`) : `${encodeURIComponent(`${i}[${t}]`)}=${encodeURIComponent(e)}`).join("&") : r == null ? "" : `${encodeURIComponent(i)}=${encodeURIComponent(r)}`;
11
- }).filter((e) => e !== "").join("&");
12
- }
13
- function d(e) {
14
- c = e.getAccessToken ?? null, l = e.getLocale ?? null, t.setConfig({
15
- baseUrl: e.apiInvoicingBaseUrl,
16
- headers: { "Accept-Language": l?.() ?? "en-US" },
17
- querySerializer: u
18
- }), !s && (s = !0, t.interceptors.request.use(async (e) => {
19
- if (l && e.headers.set("Accept-Language", l()), c) {
20
- let t = await c();
21
- t !== null && e.headers.set("Authorization", `Bearer ${t}`);
22
- }
23
- return e;
24
- }));
25
- }
26
- //#endregion
27
- //#region src/composables/invoicingConfig.composable.ts
28
- var f = i(!1), p = i(!0), m = i(!0), h = i(!0);
29
- function g(e) {
30
- return null;
31
- }
32
- var _ = i(g);
33
- function v(t) {
34
- return o(() => a(t.locale), (t) => {
35
- e.global.locale.value = t;
36
- }), d({
37
- apiInvoicingBaseUrl: t.apiInvoicingBaseUrl,
38
- getAccessToken: t.getAccessToken,
39
- getLocale: () => a(t.locale)
40
- }), p.value = t.config?.isDeliveryDateVisible ?? !0, m.value = t.config?.isGlobalDiscountEnabled ?? !0, h.value = t.config?.isLineDiscountEnabled ?? !0, _.value = t.getCustomerDetailRoute ?? g, f.value = !0, Promise.resolve();
41
- }
42
- function y() {
43
- let e = n();
44
- function t(t) {
45
- return v({
46
- ...t,
47
- locale: e.locale
48
- });
49
- }
50
- return {
51
- isDeliveryDateVisible: r(() => p.value),
52
- isGlobalDiscountEnabled: r(() => m.value),
53
- isInitialized: r(() => f.value),
54
- isLineDiscountEnabled: r(() => h.value),
55
- getCustomerDetailRoute: (e) => _.value(e),
56
- init: t
57
- };
58
- }
59
- //#endregion
60
- export { y as n, v as t };