@wisemen/wise-invoicing-web 1.1.0 → 1.2.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 (91) hide show
  1. package/dist/AccountingSettingsViewDataProvider-BtDPqr_P.js +981 -0
  2. package/dist/{ApprovalReminderSettingsViewDataProvider-DyrHExKn.js → ApprovalReminderSettingsViewDataProvider-CuFo2JF5.js} +287 -287
  3. package/dist/{BillingDocumentDetailViewDataProvider-BsMGrki9.js → BillingDocumentDetailViewDataProvider-qKW6LiRR.js} +1629 -1604
  4. package/dist/{BillingDocumentPdf-DFKxdbZX.js → BillingDocumentPdf-CgnrE4eq.js} +5 -5
  5. package/dist/{DataProvider-BtnD-BzI.js → DataProvider-Dj5ckiN2.js} +6 -9
  6. package/dist/{DunningCaseSendDialog-S1W7M38u.js → DunningCaseSendDialog-CQ1yvbUt.js} +36 -36
  7. package/dist/{InvoiceApprovalOutOfSyncIndicator-DaM5hQVT.js → InvoiceApprovalOutOfSyncIndicator-BeqzoD3H.js} +2 -2
  8. package/dist/{InvoiceApprovalOverviewView-DM_LiO19.js → InvoiceApprovalOverviewView-B0ulYsYy.js} +230 -230
  9. package/dist/{InvoiceApprovalStatusBadge-mbYHYU3x.js → InvoiceApprovalStatusBadge-BZuyVHKk.js} +4 -4
  10. package/dist/{InvoicePdfView-qHeP8BNd.js → InvoicePdfView-BBTa7EaO.js} +2 -2
  11. package/dist/{InvoicePublicProFormaPdfViewDataProvider-BZVlYijT.js → InvoicePublicProFormaPdfViewDataProvider-_Tbt2pTv.js} +4 -4
  12. package/dist/{InvoiceRejectDialogDataProvider-yegAlkDB.js → InvoiceRejectDialogDataProvider-ma2UsSzC.js} +33 -33
  13. package/dist/{InvoiceStatusBadge-CRfN5LpT.js → InvoiceStatusBadge-JIR1gUDL.js} +3 -3
  14. package/dist/{InvoicingFileUploadProvider-DVh22OUB.js → InvoicingFileUploadProvider-B-eq6i9v.js} +14 -14
  15. package/dist/{IssuerSettingsViewDataProvider-BgSFemZr.js → IssuerSettingsViewDataProvider-CHyCCy9K.js} +66 -66
  16. package/dist/{PeppolSettingsViewDataProvider-_Bx0xx9e.js → PeppolSettingsViewDataProvider-j1btvXOf.js} +4 -4
  17. package/dist/{api.util-lGbimoKL.js → api.util-BkwbrwEm.js} +1026 -800
  18. package/dist/billingDocumentDetail.transformer-B-GSRQc0.js +324 -0
  19. package/dist/client/index.d.ts +2 -2
  20. package/dist/client/sdk.gen.d.ts +10 -1
  21. package/dist/client/types.gen.d.ts +452 -1
  22. package/dist/client/zod.gen.d.ts +524 -0
  23. package/dist/{creditNoteDetail.query-CqJeWeRV.js → creditNoteDetail.query-Tg4s5B8Q.js} +34 -34
  24. package/dist/{customFieldDefinitionIndex.query-BPNS8LMx.js → customFieldDefinitionIndex.query-DtMibcTn.js} +28 -28
  25. package/dist/{deliveryReason.util-ny1rA7Sm.js → deliveryReason.util-BuCD1Fuz.js} +6 -6
  26. package/dist/{dist-CrNFh-CR.js → dist-AbMUaDf-.js} +93 -93
  27. package/dist/{dist-DmVrfBOT.js → dist-DaJ08k0k.js} +231 -119
  28. package/dist/{documentTitle.composable-aTEYXgaZ.js → documentTitle.composable-Bxu0YL71.js} +27 -19
  29. package/dist/{i18n.lib-B1H9r0km.js → i18n.lib-C8TA6PCf.js} +162 -2
  30. package/dist/index.d.ts +160 -0
  31. package/dist/index.js +1576 -1554
  32. package/dist/instant.transformer-KmBsH3E9.js +18 -0
  33. package/dist/{invoice.service-D9ubyWPb.js → invoice.service-BtgRZKrv.js} +152 -151
  34. package/dist/{invoiceApproval.service-BtDIOHIo.js → invoiceApproval.service-DEvaL-MH.js} +22 -21
  35. package/dist/invoiceApprovalStatus.util-NpxAuQ0t.js +83 -0
  36. package/dist/{invoiceCustomer.service-D0AtVrLg.js → invoiceCustomer.service-Cowdna7o.js} +6 -6
  37. package/dist/{invoiceDetail.query-BNL6MkvC.js → invoiceDetail.query-nEhWRrdL.js} +1 -1
  38. package/dist/{invoicingConfig.composable-D2bnX7HW.js → invoicingConfig.composable-CW47czLa.js} +2 -2
  39. package/dist/{issuerSettings.query-Cu-I6OAg.js → issuerSettings.query-CIWw1Zku.js} +27 -27
  40. package/dist/libs/i18n.lib.d.ts +160 -0
  41. package/dist/locales/en-US.json.d.ts +81 -1
  42. package/dist/locales/nl-BE.json.d.ts +81 -1
  43. package/dist/models/billing-document/billingDocumentDetail.model.d.ts +7 -1
  44. package/dist/modules/accounting/api/mutations/accountingConnectionDisconnect.mutation.d.ts +4 -0
  45. package/dist/modules/accounting/api/mutations/accountingPostingProfileUpdate.mutation.d.ts +15 -0
  46. package/dist/modules/accounting/api/mutations/exactAccountingConnect.mutation.d.ts +6 -0
  47. package/dist/modules/accounting/api/queries/accountingConnection.query.d.ts +1 -0
  48. package/dist/modules/accounting/api/queries/exactAuthorizationConfig.query.d.ts +1 -0
  49. package/dist/modules/accounting/api/queries/exactGlAccounts.query.d.ts +3 -0
  50. package/dist/modules/accounting/api/queries/exactJournals.query.d.ts +3 -0
  51. package/dist/modules/accounting/api/query-keys/accounting.queryKeys.d.ts +24 -0
  52. package/dist/modules/accounting/api/services/accountingConnection.service.d.ts +19 -0
  53. package/dist/modules/accounting/components/AccountingPostingProfileFields.vue.d.ts +14 -0
  54. package/dist/modules/accounting/components/AccountingSyncStatusBadge.vue.d.ts +7 -0
  55. package/dist/modules/accounting/components/ExactGlAccountField.vue.d.ts +12 -0
  56. package/dist/modules/accounting/components/ExactLogo.vue.d.ts +3 -0
  57. package/dist/modules/accounting/composables/exactLookupError.composable.d.ts +19 -0
  58. package/dist/modules/accounting/models/accountingConnection.model.d.ts +34 -0
  59. package/dist/modules/accounting/models/accountingConnection.transformer.d.ts +23 -0
  60. package/dist/modules/accounting/models/accountingConnection.transformer.spec.d.ts +1 -0
  61. package/dist/modules/accounting/models/accountingConnectionReadiness.util.d.ts +10 -0
  62. package/dist/modules/accounting/models/accountingConnectionUuid.model.d.ts +3 -0
  63. package/dist/modules/accounting/models/accountingError.util.d.ts +13 -0
  64. package/dist/modules/accounting/models/accountingError.util.spec.d.ts +1 -0
  65. package/dist/modules/accounting/models/accountingPostingProfileForm.model.d.ts +14 -0
  66. package/dist/modules/accounting/models/accountingPostingProfileForm.model.spec.d.ts +1 -0
  67. package/dist/modules/accounting/models/accountingPostingProfileUpdateForm.model.d.ts +17 -0
  68. package/dist/modules/accounting/models/exactAccountingConnectForm.model.d.ts +9 -0
  69. package/dist/modules/accounting/models/exactAccountingConnectForm.model.spec.d.ts +1 -0
  70. package/dist/modules/accounting/models/exactLookupOption.model.d.ts +5 -0
  71. package/dist/modules/accounting/models/exactLookupOption.util.d.ts +4 -0
  72. package/dist/modules/accounting/models/exactRegion.util.d.ts +5 -0
  73. package/dist/modules/accounting/models/exactRegion.util.spec.d.ts +1 -0
  74. package/dist/modules/accounting/routes/accounting.routes.d.ts +9 -0
  75. package/dist/modules/accounting/use-cases/settings/components/AccountingConnectionDetails.vue.d.ts +7 -0
  76. package/dist/modules/accounting/use-cases/settings/components/AccountingConnectionNotice.vue.d.ts +11 -0
  77. package/dist/modules/accounting/use-cases/settings/components/AccountingPostingProfileForm.vue.d.ts +8 -0
  78. package/dist/modules/accounting/use-cases/settings/components/ExactAccountingConnectForm.vue.d.ts +12 -0
  79. package/dist/modules/accounting/use-cases/settings/composables/accountingAuthorizationResult.composable.d.ts +5 -0
  80. package/dist/modules/accounting/use-cases/settings/composables/exactConnect.composable.d.ts +11 -0
  81. package/dist/modules/accounting/use-cases/settings/dialogs/AccountingConnectionDisconnectDialog.vue.d.ts +11 -0
  82. package/dist/modules/accounting/use-cases/settings/views/AccountingSettingsView.vue.d.ts +9 -0
  83. package/dist/modules/accounting/use-cases/settings/views/AccountingSettingsViewDataProvider.vue.d.ts +3 -0
  84. package/dist/modules/settings/routes/settings.routes.d.ts +7 -0
  85. package/dist/{plainDate.transformer-Bhiz9jW7.js → plainDate.transformer-BxvJpJOv.js} +4 -17
  86. package/dist/{reminderConfig.query-DHMHVOeX.js → reminderConfig.query-nb1P7ufx.js} +38 -37
  87. package/dist/types/queryKey.type.d.ts +3 -2
  88. package/dist/ui/data-provider/DataProvider.vue.d.ts +5 -1
  89. package/package.json +1 -1
  90. package/dist/billingDocumentDetail.transformer-C5-zjIhL.js +0 -319
  91. package/dist/invoiceApprovalStatus.util-Bqq_bILG.js +0 -83
@@ -0,0 +1,981 @@
1
+ import { t as e } from "./i18n.lib-C8TA6PCf.js";
2
+ import { S as t, _t as n, f as r, ot as i, q as a, st as o, t as s, vt as c, yt as l } from "./api.util-BkwbrwEm.js";
3
+ import { b as u, n as d, r as f, t as p, z as m } from "./documentTitle.composable-Bxu0YL71.js";
4
+ import { t as h } from "./instant.transformer-KmBsH3E9.js";
5
+ import { At as ee, N as te, at as ne, bt as re, d as g, i as ie, rt as ae, tt as oe, xt as se } from "./dist-DaJ08k0k.js";
6
+ import { t as _ } from "./formango.util-D5c2ql--.js";
7
+ import { t as ce } from "./DataProvider-Dj5ckiN2.js";
8
+ import { t as le } from "./issuerSettings.query-CIWw1Zku.js";
9
+ import v, { z as ue } from "zod";
10
+ import { useI18n as y } from "vue-i18n";
11
+ import { Fragment as b, Teleport as x, computed as S, createBlock as C, createCommentVNode as w, createElementBlock as T, createElementVNode as E, createVNode as D, defineComponent as O, mergeProps as k, normalizeClass as de, onScopeDispose as fe, openBlock as A, reactive as pe, ref as j, renderList as me, resolveDynamicComponent as he, toDisplayString as ge, unref as M, watch as _e, withCtx as N } from "vue";
12
+ import { useQueryClient as ve } from "@tanstack/vue-query";
13
+ import { ApiErrorUtil as ye, QueryClient as be, useMutation as P, useQuery as F } from "@wisemen/vue-core-api-utils";
14
+ import { refAutoReset as xe, refDebounced as Se } from "@vueuse/core";
15
+ import { useRoute as Ce, useRouter as we } from "vue-router";
16
+ import { err as Te, ok as Ee } from "neverthrow";
17
+ import { UIAutocomplete as De, UIBadge as I, UIButton as L, UICheckbox as Oe, UIDashboardPage as ke, UIDashboardPageContent as Ae, UIDetailList as je, UIDetailListGroup as Me, UIDetailListGroupItem as R, UIDetailListGroupItemLabel as z, UIDetailListGroupItemValueText as B, UIDialogFooter as Ne, UIDialogFooterCancel as Pe, UIDialogFooterSubmit as Fe, UIDialogHeader as Ie, UIForm as Le, UIFormDialog as Re, UIFormFieldGrid as V, UIFormFieldGroup as H, UIFormFieldSeperator as ze, UIFormFieldSet as U, UIFormLayout as Be, UIFormSubmitButton as Ve, UIIconButton as He, UISelect as W, UIText as G, UITextField as K, createAutocompleteOptions as Ue, createSelectOptions as q, useOverlay as We, useToast as J } from "@wisemen/vue-core-design-system";
18
+ import { useForm as Y } from "formango";
19
+ //#region src/modules/accounting/models/accountingConnection.transformer.ts
20
+ var Ge = {
21
+ six: "",
22
+ twelve: "",
23
+ twentyOne: "",
24
+ zero: ""
25
+ }, X = class {
26
+ static fromDto(e) {
27
+ return {
28
+ uuid: e.uuid,
29
+ clientId: e.clientId,
30
+ createdAt: h.fromDto(e.createdAt),
31
+ updatedAt: h.fromDto(e.updatedAt),
32
+ companyName: e.companyName,
33
+ defaultPostingProfile: e.defaultPostingProfile === null ? null : this.postingProfileFromDto(e.defaultPostingProfile),
34
+ division: e.division,
35
+ provider: e.provider,
36
+ readiness: e.readiness,
37
+ region: e.region
38
+ };
39
+ }
40
+ static ledgerCodeByRateToDto(e) {
41
+ return {
42
+ [m._0]: e.zero,
43
+ [m._6]: e.six,
44
+ [m._12]: e.twelve,
45
+ [m._21]: e.twentyOne
46
+ };
47
+ }
48
+ static postingProfileFromDto(e) {
49
+ return {
50
+ resolvedAt: h.fromNullableDto(e.resolvedAt),
51
+ defaultLedgerCode: e.defaultLedgerCode,
52
+ ledgerCodeByRate: e.ledgerCodeByRate === null ? null : {
53
+ six: e.ledgerCodeByRate[m._6] ?? "",
54
+ twelve: e.ledgerCodeByRate[m._12] ?? "",
55
+ twentyOne: e.ledgerCodeByRate[m._21] ?? "",
56
+ zero: e.ledgerCodeByRate[m._0] ?? ""
57
+ },
58
+ resolutionError: e.resolutionError,
59
+ resolutionStatus: e.resolutionStatus,
60
+ salesEntryCreditNoteJournal: e.salesEntryCreditNoteJournal,
61
+ salesEntryInvoiceJournal: e.salesEntryInvoiceJournal
62
+ };
63
+ }
64
+ static toConnectDto(e) {
65
+ return {
66
+ clientId: e.clientId,
67
+ clientSecret: e.clientSecret.trim() === "" ? void 0 : e.clientSecret,
68
+ region: e.region
69
+ };
70
+ }
71
+ static toConnectForm(e, t) {
72
+ return {
73
+ clientId: e?.clientId ?? "",
74
+ hasSavedClientSecret: e !== null,
75
+ clientSecret: "",
76
+ region: e?.region ?? t
77
+ };
78
+ }
79
+ static toPostingProfileDto(e) {
80
+ return {
81
+ defaultLedgerCode: e.defaultLedgerCode,
82
+ ledgerCodeByRate: e.hasLedgerCodeByRate ? this.ledgerCodeByRateToDto(e.ledgerCodeByRate) : void 0,
83
+ salesEntryCreditNoteJournal: e.salesEntryCreditNoteJournal === "" ? null : e.salesEntryCreditNoteJournal,
84
+ salesEntryInvoiceJournal: e.salesEntryInvoiceJournal
85
+ };
86
+ }
87
+ static toPostingProfileForm(e) {
88
+ return {
89
+ hasLedgerCodeByRate: e?.ledgerCodeByRate != null,
90
+ defaultLedgerCode: e?.defaultLedgerCode ?? "",
91
+ ledgerCodeByRate: e?.ledgerCodeByRate ?? Ge,
92
+ salesEntryCreditNoteJournal: e?.salesEntryCreditNoteJournal ?? "",
93
+ salesEntryInvoiceJournal: e?.salesEntryInvoiceJournal ?? ""
94
+ };
95
+ }
96
+ }, Z = class {
97
+ static async connectExact(e) {
98
+ return (await s.fromPromise(r({ body: X.toConnectDto(e) }))).map((e) => e.data.loginUrl);
99
+ }
100
+ static async disconnect(e) {
101
+ return s.void(await s.fromPromise(t({ path: { uuid: e } })));
102
+ }
103
+ static async getCurrent() {
104
+ let e = await s.fromPromise(o());
105
+ if (e.isErr()) return Te(e.error);
106
+ let t = e.value.data.items.at(0);
107
+ return t === void 0 ? Ee(null) : (await s.fromPromise(i({ path: { uuid: t.uuid } }))).map((e) => X.fromDto(e.data));
108
+ }
109
+ static async getExactAuthorizationConfig() {
110
+ return (await s.fromPromise(n())).map((e) => ({ redirectUri: e.data.redirectUri }));
111
+ }
112
+ static async getExactJournals(e) {
113
+ return (await s.fromPromise(l({ path: { uuid: e } }))).map((e) => e.data.items.map((e) => ({
114
+ code: e.code,
115
+ description: e.description
116
+ })));
117
+ }
118
+ static async searchExactGlAccounts(e, t) {
119
+ return (await s.fromPromise(c({
120
+ query: { search: t === "" ? void 0 : t },
121
+ path: { uuid: e }
122
+ }))).map((e) => e.data.items.map((e) => ({
123
+ code: e.code,
124
+ description: e.description
125
+ })));
126
+ }
127
+ static async updatePostingProfile(e, t) {
128
+ return s.void(await s.fromPromise(a({
129
+ body: X.toPostingProfileDto(t),
130
+ path: { uuid: e }
131
+ })));
132
+ }
133
+ };
134
+ //#endregion
135
+ //#region src/modules/accounting/api/queries/accountingConnection.query.ts
136
+ function Ke() {
137
+ return F("accountingConnection", { queryFn: () => Z.getCurrent() });
138
+ }
139
+ //#endregion
140
+ //#region src/modules/accounting/api/queries/exactAuthorizationConfig.query.ts
141
+ function qe() {
142
+ return F("exactAuthorizationConfig", { queryFn: () => Z.getExactAuthorizationConfig() });
143
+ }
144
+ //#endregion
145
+ //#region src/modules/accounting/components/ExactLogo.vue?vue&type=script&setup=true&lang.ts
146
+ var Je = ["aria-label"], Ye = /* @__PURE__ */ O({
147
+ __name: "ExactLogo",
148
+ setup(e) {
149
+ let t = y();
150
+ return (e, n) => (A(), T("svg", {
151
+ "aria-label": M(t).t("wise_invoicing.accounting.provider.EXACT_ONLINE"),
152
+ viewBox: "0 0 842 179",
153
+ xmlns: "http://www.w3.org/2000/svg",
154
+ role: "img"
155
+ }, [...n[0] ||= [E("path", {
156
+ fill: "#D9252A",
157
+ "fill-rule": "evenodd",
158
+ d: "M112.97 58.348H0v33.794h128.574V58.348H112.97M111.616 116.693H0v33.794h16.958v-.001h94.658v.001h16.958v-33.794h-16.958M566.017 146.261h-50.69c-8.447 0-13.465-4.492-13.465-12.677 0-8.181 5.018-12.668 13.465-12.668h50.69v25.345zM542.521 29.045h-46.878v-.001h-20.734v33.791h20.734v-.001h44.761c20.032 0 25.448 7.694 25.603 25.346H513.74c-30.887 0-47.784 15.84-47.784 45.404 0 29.31 16.897 45.414 47.784 45.414h82.11l.032-.002h6.566v-92.13c0-39.079-14.785-57.821-59.927-57.821zM732.45 145.204h-42.503c-22.97 0-31.424-11.086-31.424-41.181 0-30.094 8.454-41.185 31.424-41.185h41.973l.065-.003h6.556V29.044h-52.293c-46.724 0-64.681 23.233-64.681 74.979 0 51.742 17.957 74.973 64.681 74.973h52.796v-33.791h-6.562l-.032-.001M269.888 145.205h-39.992c-19.092 0-27.963-6.758-30.417-23.753h59.03v.022h20.732v-6.021c.014-.2.026-.401.026-.609V94.253c0-.207-.012-.409-.026-.609v-5.961h-5.827a8.685 8.685 0 0 0-.747-.033h-73.324c2.254-17.607 11.101-24.815 30.553-24.815h60.194V29.044h-18.099v.003h-45.789c-46.733 0-64.677 23.228-64.677 74.973 0 51.741 17.944 74.979 64.677 74.979h57.819c.022 0 .043-.002.065-.003h6.535v-33.791h-20.733M835.286 145.205H805.98c-7.125 0-11.358-5.012-11.358-13.99v-68.38h44.091V29.047h-44.091V.529h-36.426v133.323c0 30.894 14.521 45.147 44.616 45.147h32.474l.066-.003h6.538v-33.791h-6.604M456.904 172.136l-53.323-70.381 49.893-65.848v-.001l5.199-6.862h-42.787l-3.597 4.749-.001.001-30.095 39.725-30.1-39.725-.001-.002-3.598-4.748h-44.367l55.879 73.758-57.729 76.197 14.575-.003h28.211l3.598-4.747.002-.002 32.737-43.209 32.738 43.209v.001l3.598 4.748h44.367l-5.199-6.86"
159
+ }, null, -1)]], 8, Je));
160
+ }
161
+ }), Xe = class {
162
+ static fromCountryCode(e) {
163
+ return Object.values(u).find((t) => t === e) ?? null;
164
+ }
165
+ }, Ze = {
166
+ [d.DISCONNECTED]: {
167
+ color: "error",
168
+ labelKey: "wise_invoicing.accounting.settings.readiness.disconnected"
169
+ },
170
+ [d.PENDING_AUTHORIZATION]: {
171
+ color: "warning",
172
+ labelKey: "wise_invoicing.accounting.settings.readiness.pending_authorization"
173
+ },
174
+ [d.READY]: {
175
+ color: "success",
176
+ labelKey: "wise_invoicing.accounting.settings.readiness.ready"
177
+ }
178
+ }, Qe = class {
179
+ static getBadge(e) {
180
+ return Ze[e];
181
+ }
182
+ };
183
+ //#endregion
184
+ //#region src/modules/accounting/api/mutations/accountingConnectionDisconnect.mutation.ts
185
+ function $e() {
186
+ return P({
187
+ queryFn: (e) => Z.disconnect(e.params.connectionUuid),
188
+ queryKeysToInvalidate: { accountingConnection: {} }
189
+ });
190
+ }
191
+ //#endregion
192
+ //#region src/modules/accounting/use-cases/settings/dialogs/AccountingConnectionDisconnectDialog.vue
193
+ var et = /* @__PURE__ */ O({
194
+ __name: "AccountingConnectionDisconnectDialog",
195
+ props: { connectionUuid: {} },
196
+ emits: ["close"],
197
+ setup(e, { emit: t }) {
198
+ let n = e, r = t, i = y(), a = J(), o = $e(), s = Y({
199
+ initialState: {},
200
+ schema: ue.object({}),
201
+ onSubmit: async () => {
202
+ let e = await o.execute({ params: { connectionUuid: n.connectionUuid } });
203
+ e.isErr() ? a.apiError(e.error) : (a.show({ message: i.t("wise_invoicing.accounting.settings.disconnect.success") }), r("close"));
204
+ },
205
+ onSubmitError: () => {
206
+ a.unableToSave();
207
+ }
208
+ });
209
+ return (e, t) => (A(), C(M(Re), {
210
+ form: M(s),
211
+ size: "sm",
212
+ onClose: t[0] ||= (e) => r("close")
213
+ }, {
214
+ default: N(() => [D(M(Ie), {
215
+ title: M(i).t("wise_invoicing.accounting.settings.disconnect.title"),
216
+ description: M(i).t("wise_invoicing.accounting.settings.disconnect.description"),
217
+ icon: M(oe),
218
+ "icon-variant": "error"
219
+ }, null, 8, [
220
+ "title",
221
+ "description",
222
+ "icon"
223
+ ]), D(M(Ne), null, {
224
+ default: N(() => [D(M(Pe)), D(M(Fe), { label: M(i).t("wise_invoicing.accounting.settings.disconnect.submit") }, null, 8, ["label"])]),
225
+ _: 1
226
+ })]),
227
+ _: 1
228
+ }, 8, ["form"]));
229
+ }
230
+ }), tt = { class: "flex w-full flex-col gap-lg" }, nt = /* @__PURE__ */ O({
231
+ __name: "AccountingConnectionDetails",
232
+ props: { connection: {} },
233
+ setup(e) {
234
+ let t = e, n = y(), r = We().create(et), i = S(() => Qe.getBadge(t.connection.readiness)), a = S(() => [t.connection.companyName, t.connection.division?.toString()].filter((e) => e != null).join(" · ") || "-");
235
+ async function o() {
236
+ await r.open({ connectionUuid: t.connection.uuid });
237
+ }
238
+ return (e, r) => (A(), C(M(U), {
239
+ title: M(n).t("wise_invoicing.accounting.settings.connection.title"),
240
+ description: M(n).t("wise_invoicing.accounting.settings.connection.description")
241
+ }, {
242
+ default: N(() => [E("div", tt, [D(M(je), null, {
243
+ default: N(() => [D(M(Me), null, {
244
+ default: N(() => [
245
+ D(M(R), null, {
246
+ default: N(() => [D(M(z), {
247
+ icon: M(re),
248
+ label: M(n).t("wise_invoicing.accounting.settings.connection.status")
249
+ }, null, 8, ["icon", "label"]), D(M(I), {
250
+ label: M(n).t(i.value.labelKey),
251
+ color: i.value.color,
252
+ size: "sm",
253
+ variant: "translucent"
254
+ }, null, 8, ["label", "color"])]),
255
+ _: 1
256
+ }),
257
+ D(M(R), null, {
258
+ default: N(() => [D(M(z), {
259
+ icon: M(ae),
260
+ label: M(n).t("wise_invoicing.accounting.settings.connection.company")
261
+ }, null, 8, ["icon", "label"]), D(M(B), { text: a.value }, null, 8, ["text"])]),
262
+ _: 1
263
+ }),
264
+ D(M(R), null, {
265
+ default: N(() => [D(M(z), {
266
+ icon: M(ne),
267
+ label: M(n).t("wise_invoicing.accounting.settings.connection.region")
268
+ }, null, 8, ["icon", "label"]), D(M(B), { text: M(n).t(`wise_invoicing.accounting.region.${t.connection.region}`) }, null, 8, ["text"])]),
269
+ _: 1
270
+ }),
271
+ D(M(R), null, {
272
+ default: N(() => [D(M(z), {
273
+ icon: M(ee),
274
+ label: M(n).t("wise_invoicing.accounting.settings.fields.client_id.label")
275
+ }, null, 8, ["icon", "label"]), D(M(B), { text: t.connection.clientId }, null, 8, ["text"])]),
276
+ _: 1
277
+ })
278
+ ]),
279
+ _: 1
280
+ })]),
281
+ _: 1
282
+ }), E("div", null, [D(M(L), {
283
+ "icon-left": M(oe),
284
+ label: M(n).t("wise_invoicing.accounting.settings.connection.disconnect"),
285
+ variant: "tertiary",
286
+ onClick: o
287
+ }, null, 8, ["icon-left", "label"])])])]),
288
+ _: 1
289
+ }, 8, ["title", "description"]));
290
+ }
291
+ });
292
+ //#endregion
293
+ //#region src/modules/accounting/api/mutations/exactAccountingConnect.mutation.ts
294
+ function rt() {
295
+ return P({
296
+ queryFn: (e) => Z.connectExact(e.body),
297
+ queryKeysToInvalidate: { accountingConnection: {} }
298
+ });
299
+ }
300
+ //#endregion
301
+ //#region src/modules/accounting/models/accountingError.util.ts
302
+ var Q = "wise_invoicing.accounting.errors.exact_unavailable", it = "wise_invoicing.accounting.errors.exact_reconnect_required", at = /* @__PURE__ */ new Set([
303
+ .../* @__PURE__ */ new Set(["exact_authorization_revoked", "exact_connection_token_not_found"]),
304
+ "exact_connection_not_found",
305
+ "exact_connection_not_ready"
306
+ ]), ot = /* @__PURE__ */ new Set([
307
+ "exact_invalid_token_response",
308
+ "exact_network_error",
309
+ "exact_rate_limit",
310
+ "exact_request_failed"
311
+ ]), st = "exact_rate_limit", ct = {
312
+ accounting_connection_already_exists: "wise_invoicing.accounting.errors.accounting_connection_already_exists",
313
+ exact_authorization_denied: "wise_invoicing.accounting.errors.exact_authorization_denied",
314
+ exact_authorization_revoked: it,
315
+ exact_client_secret_required: "wise_invoicing.accounting.errors.exact_client_secret_required",
316
+ exact_connection_not_ready: "wise_invoicing.accounting.errors.exact_connection_not_ready",
317
+ exact_connection_token_not_found: it,
318
+ exact_current_division_not_found: "wise_invoicing.accounting.errors.exact_current_division_not_found",
319
+ exact_invalid_token_response: Q,
320
+ exact_network_error: Q,
321
+ exact_rate_limit: "wise_invoicing.accounting.errors.exact_rate_limit",
322
+ exact_request_failed: Q,
323
+ token_validation_failed: "wise_invoicing.accounting.errors.token_validation_failed"
324
+ }, $ = class {
325
+ static code(e) {
326
+ if (!ye.isExpectedApiError(e)) return null;
327
+ let t = v.object({ code: v.string() }).safeParse(e.errors[0]);
328
+ return t.success ? t.data.code : null;
329
+ }
330
+ static fromApiError(e) {
331
+ let t = this.code(e);
332
+ return t === null ? null : ct[t] ?? null;
333
+ }
334
+ static isConnectionChanged(e) {
335
+ let t = this.code(e);
336
+ return t !== null && at.has(t);
337
+ }
338
+ static isTemporary(e) {
339
+ let t = this.code(e);
340
+ return t !== null && ot.has(t);
341
+ }
342
+ static rateLimitResetAt(e) {
343
+ if (!ye.isExpectedApiError(e) || this.code(e) !== st) return null;
344
+ let t = v.object({ meta: v.object({ resetAt: v.iso.datetime().nullable() }) }).safeParse(e.errors[0]);
345
+ return !t.success || t.data.meta.resetAt === null ? null : new Date(t.data.meta.resetAt);
346
+ }
347
+ static translationKey(e) {
348
+ return ct[e] ?? "wise_invoicing.accounting.errors.unknown";
349
+ }
350
+ };
351
+ //#endregion
352
+ //#region src/modules/accounting/use-cases/settings/composables/exactConnect.composable.ts
353
+ function lt() {
354
+ let e = y(), t = J(), n = rt(), r = j(!1);
355
+ async function i(i) {
356
+ r.value = !0;
357
+ let a = await n.execute({ body: i });
358
+ if (a.isErr()) {
359
+ r.value = !1;
360
+ let n = $.fromApiError(a.error);
361
+ if (n === null) {
362
+ t.apiError(a.error);
363
+ return;
364
+ }
365
+ t.show({
366
+ message: e.t(n),
367
+ variant: "error"
368
+ });
369
+ } else a.value !== null && window.location.assign(a.value);
370
+ }
371
+ async function a(e) {
372
+ await i({
373
+ clientId: e.clientId,
374
+ hasSavedClientSecret: !0,
375
+ clientSecret: "",
376
+ region: e.region
377
+ });
378
+ }
379
+ return {
380
+ isConnecting: r,
381
+ connect: i,
382
+ reconnect: a
383
+ };
384
+ }
385
+ //#endregion
386
+ //#region src/modules/accounting/use-cases/settings/components/AccountingConnectionNotice.vue?vue&type=script&setup=true&lang.ts
387
+ var ut = { class: "flex flex-col items-start gap-lg" }, dt = { class: "flex flex-col gap-xxs" }, ft = /* @__PURE__ */ O({
388
+ __name: "AccountingConnectionNotice",
389
+ props: { connection: {} },
390
+ setup(e) {
391
+ let t = e, n = y(), r = lt(), i = S(() => t.connection.readiness === d.DISCONNECTED ? {
392
+ isDisconnected: !0,
393
+ descriptionKey: "wise_invoicing.accounting.settings.disconnected.description",
394
+ icon: g,
395
+ titleKey: "wise_invoicing.accounting.settings.readiness.disconnected"
396
+ } : {
397
+ isDisconnected: !1,
398
+ descriptionKey: "wise_invoicing.accounting.settings.pending.description",
399
+ icon: g,
400
+ titleKey: "wise_invoicing.accounting.settings.readiness.pending_authorization"
401
+ });
402
+ async function a() {
403
+ await r.reconnect(t.connection);
404
+ }
405
+ return (e, t) => (A(), T("div", {
406
+ class: de([i.value.isDisconnected ? "bg-error-primary" : "bg-warning-primary", "mx-auto flex w-full max-w-3xl items-start gap-md rounded-lg p-lg"]),
407
+ role: "status"
408
+ }, [(A(), C(he(i.value.icon), { class: de([i.value.isDisconnected ? "text-error-primary" : "\n text-warning-primary\n ", "mt-xxs size-5 shrink-0"]) }, null, 8, ["class"])), E("div", ut, [E("div", dt, [D(M(G), {
409
+ text: M(n).t(i.value.titleKey),
410
+ class: "text-sm font-semibold text-primary"
411
+ }, null, 8, ["text"]), D(M(G), {
412
+ text: M(n).t(i.value.descriptionKey),
413
+ truncate: !1,
414
+ class: "text-sm text-secondary"
415
+ }, null, 8, ["text"])]), D(M(L), {
416
+ "icon-left": M(se),
417
+ "is-loading": M(r).isConnecting.value,
418
+ label: M(n).t("wise_invoicing.accounting.settings.connect.reconnect"),
419
+ size: "sm",
420
+ variant: "secondary",
421
+ onClick: a
422
+ }, null, 8, [
423
+ "icon-left",
424
+ "is-loading",
425
+ "label"
426
+ ])])], 2));
427
+ }
428
+ });
429
+ //#endregion
430
+ //#region src/modules/accounting/api/mutations/accountingPostingProfileUpdate.mutation.ts
431
+ function pt() {
432
+ return P({
433
+ queryFn: (e) => Z.updatePostingProfile(e.params.connectionUuid, e.body),
434
+ queryKeysToInvalidate: { accountingConnection: {} }
435
+ });
436
+ }
437
+ //#endregion
438
+ //#region src/modules/accounting/api/queries/exactJournals.query.ts
439
+ function mt(e) {
440
+ return F("exactJournals", {
441
+ params: { connectionUuid: e },
442
+ queryFn: () => Z.getExactJournals(e.value)
443
+ });
444
+ }
445
+ //#endregion
446
+ //#region src/modules/accounting/api/queries/exactGlAccounts.query.ts
447
+ function ht(e, t) {
448
+ return F("exactGlAccounts", {
449
+ params: {
450
+ connectionUuid: e,
451
+ search: t
452
+ },
453
+ queryFn: () => Z.searchExactGlAccounts(e.value, t.value)
454
+ });
455
+ }
456
+ //#endregion
457
+ //#region src/modules/accounting/composables/exactLookupError.composable.ts
458
+ var gt = 1e3;
459
+ function _t(e, t) {
460
+ let n = new be(ve()), r = null, i = S(() => e.result.value.isErr() ? e.result.value.getError() : null), a = S(() => i.value === null ? null : $.fromApiError(i.value) ?? t), o = S(() => i.value !== null && !$.isConnectionChanged(i.value));
461
+ function s() {
462
+ r !== null && (clearTimeout(r), r = null);
463
+ }
464
+ function c(t) {
465
+ s(), r = setTimeout(() => {
466
+ r = null, e.refetch();
467
+ }, Math.max(t.getTime() - Date.now(), 0) + gt);
468
+ }
469
+ return _e(i, async (e) => {
470
+ if (e === null) {
471
+ s();
472
+ return;
473
+ }
474
+ if ($.isConnectionChanged(e)) {
475
+ await n.invalidate("accountingConnection");
476
+ return;
477
+ }
478
+ let t = $.rateLimitResetAt(e);
479
+ t !== null && c(t);
480
+ }, { immediate: !0 }), fe(s), {
481
+ isRetryable: o,
482
+ errorKey: a
483
+ };
484
+ }
485
+ //#endregion
486
+ //#region src/modules/accounting/models/exactLookupOption.util.ts
487
+ var vt = class {
488
+ static format(e, t) {
489
+ return t == null || t === "" ? e : `${e} – ${t}`;
490
+ }
491
+ }, yt = 250, bt = /* @__PURE__ */ O({
492
+ __name: "ExactGlAccountField",
493
+ props: {
494
+ connectionUuid: {},
495
+ isDisabled: { type: Boolean },
496
+ isRequired: { type: Boolean },
497
+ field: {},
498
+ label: {}
499
+ },
500
+ setup(e) {
501
+ let t = e, n = y(), r = j(""), i = Se(r, yt), a = ht(S(() => t.connectionUuid), i), o = _t(a, "wise_invoicing.accounting.settings.fields.gl_account.unavailable"), s = S(() => {
502
+ let e = _(t.field);
503
+ return e.errorMessage === null ? t.isDisabled || o.errorKey.value === null ? null : n.t(o.errorKey.value) : e.errorMessage;
504
+ }), c = S(() => a.result.value.match({
505
+ err: () => [],
506
+ loading: () => [],
507
+ ok: (e) => e
508
+ })), l = pe(/* @__PURE__ */ new Map());
509
+ _e(c, (e) => {
510
+ for (let t of e) l.set(t.code, t.description);
511
+ }, { immediate: !0 });
512
+ let u = S(() => Ue(c.value.map((e) => e.code)));
513
+ function d(e) {
514
+ return vt.format(e, l.get(e));
515
+ }
516
+ return (e, o) => (A(), C(M(De), k(M(_)(t.field), {
517
+ "error-message": s.value,
518
+ "is-disabled": t.isDisabled,
519
+ "display-fn": d,
520
+ "is-loading": M(a).isLoading.value || r.value !== M(i),
521
+ "is-required": t.isRequired,
522
+ items: u.value,
523
+ label: t.label,
524
+ placeholder: M(n).t("wise_invoicing.accounting.settings.fields.gl_account.placeholder"),
525
+ "search-mode": "remote",
526
+ "onUpdate:search": o[0] ||= (e) => r.value = e
527
+ }), null, 16, [
528
+ "error-message",
529
+ "is-disabled",
530
+ "is-loading",
531
+ "is-required",
532
+ "items",
533
+ "label",
534
+ "placeholder"
535
+ ]));
536
+ }
537
+ }), xt = "", St = /* @__PURE__ */ O({
538
+ __name: "AccountingPostingProfileFields",
539
+ props: {
540
+ connectionUuid: {},
541
+ isLookupUnavailable: { type: Boolean },
542
+ field: {},
543
+ journals: {}
544
+ },
545
+ setup(e) {
546
+ let t = e, n = y(), r = t.field.register("salesEntryInvoiceJournal"), i = t.field.register("salesEntryCreditNoteJournal"), a = t.field.register("defaultLedgerCode"), o = t.field.register("hasLedgerCodeByRate", !1), s = [
547
+ {
548
+ field: t.field.register("ledgerCodeByRate.zero"),
549
+ rate: 0
550
+ },
551
+ {
552
+ field: t.field.register("ledgerCodeByRate.six"),
553
+ rate: 6
554
+ },
555
+ {
556
+ field: t.field.register("ledgerCodeByRate.twelve"),
557
+ rate: 12
558
+ },
559
+ {
560
+ field: t.field.register("ledgerCodeByRate.twentyOne"),
561
+ rate: 21
562
+ }
563
+ ], c = S(() => t.journals.map((e) => e.code)), l = S(() => q(c.value)), u = S(() => q([xt, ...c.value]));
564
+ function d(e) {
565
+ if (e === xt) return n.t("wise_invoicing.accounting.settings.fields.credit_note_journal.same_as_invoice");
566
+ let r = t.journals.find((t) => t.code === e);
567
+ return vt.format(e, r?.description);
568
+ }
569
+ return (e, c) => (A(), C(M(H), null, {
570
+ default: N(() => [
571
+ D(M(V), {
572
+ lg: 1,
573
+ sm: 1
574
+ }, {
575
+ default: N(() => [
576
+ D(M(W), k({
577
+ "is-required": !0,
578
+ "is-disabled": t.isLookupUnavailable
579
+ }, M(_)(M(r)), {
580
+ "display-fn": d,
581
+ items: l.value,
582
+ label: M(n).t("wise_invoicing.accounting.settings.fields.invoice_journal.label")
583
+ }), null, 16, [
584
+ "is-disabled",
585
+ "items",
586
+ "label"
587
+ ]),
588
+ D(M(W), k({ "is-disabled": t.isLookupUnavailable }, M(_)(M(i)), {
589
+ "display-fn": d,
590
+ items: u.value,
591
+ label: M(n).t("wise_invoicing.accounting.settings.fields.credit_note_journal.label")
592
+ }), null, 16, [
593
+ "is-disabled",
594
+ "items",
595
+ "label"
596
+ ]),
597
+ D(bt, {
598
+ "is-required": !0,
599
+ "is-disabled": t.isLookupUnavailable,
600
+ "connection-uuid": t.connectionUuid,
601
+ field: M(a),
602
+ label: M(n).t("wise_invoicing.accounting.settings.fields.default_ledger.label")
603
+ }, null, 8, [
604
+ "is-disabled",
605
+ "connection-uuid",
606
+ "field",
607
+ "label"
608
+ ])
609
+ ]),
610
+ _: 1
611
+ }),
612
+ D(M(Oe), k(M(_)(M(o)), {
613
+ label: M(n).t("wise_invoicing.accounting.settings.fields.has_ledger_by_rate.label"),
614
+ hint: M(n).t("wise_invoicing.accounting.settings.fields.has_ledger_by_rate.hint")
615
+ }), null, 16, ["label", "hint"]),
616
+ M(o).modelValue.value ? (A(), C(M(V), {
617
+ key: 0,
618
+ lg: 2,
619
+ sm: 1
620
+ }, {
621
+ default: N(() => [(A(), T(b, null, me(s, (e) => D(bt, {
622
+ key: e.rate,
623
+ "is-required": !0,
624
+ "is-disabled": t.isLookupUnavailable,
625
+ "connection-uuid": t.connectionUuid,
626
+ field: e.field,
627
+ label: M(n).t("wise_invoicing.accounting.settings.fields.ledger_by_rate.label", { rate: e.rate })
628
+ }, null, 8, [
629
+ "is-disabled",
630
+ "connection-uuid",
631
+ "field",
632
+ "label"
633
+ ])), 64))]),
634
+ _: 1
635
+ })) : w("", !0)
636
+ ]),
637
+ _: 1
638
+ }));
639
+ }
640
+ }), Ct = [
641
+ "zero",
642
+ "six",
643
+ "twelve",
644
+ "twentyOne"
645
+ ], wt = v.object({
646
+ hasLedgerCodeByRate: v.boolean(),
647
+ defaultLedgerCode: v.string().min(1),
648
+ ledgerCodeByRate: v.object({
649
+ six: v.string(),
650
+ twelve: v.string(),
651
+ twentyOne: v.string(),
652
+ zero: v.string()
653
+ }),
654
+ salesEntryCreditNoteJournal: v.string(),
655
+ salesEntryInvoiceJournal: v.string().min(1)
656
+ }).superRefine((e, t) => {
657
+ if (e.hasLedgerCodeByRate) for (let n of Ct) e.ledgerCodeByRate[n].trim() === "" && t.addIssue({
658
+ code: "custom",
659
+ path: ["ledgerCodeByRate", n]
660
+ });
661
+ }), Tt = v.object({ postingProfile: wt }), Et = { class: "flex w-full flex-col gap-lg" }, Dt = {
662
+ key: 1,
663
+ class: "flex flex-col gap-xs"
664
+ }, Ot = { class: "flex w-full flex-col gap-lg" }, kt = {
665
+ class: "flex w-full items-start gap-sm rounded-lg bg-error-primary p-md",
666
+ role: "alert"
667
+ }, At = { class: "flex flex-col items-start gap-md" }, jt = { class: "flex flex-col gap-xxs" }, Mt = /* @__PURE__ */ O({
668
+ __name: "AccountingPostingProfileForm",
669
+ props: { connection: {} },
670
+ setup(e) {
671
+ let t = e, n = {
672
+ [f.FAILED]: {
673
+ color: "error",
674
+ labelKey: "wise_invoicing.accounting.settings.resolution.failed"
675
+ },
676
+ [f.PENDING]: {
677
+ color: "warning",
678
+ labelKey: "wise_invoicing.accounting.settings.resolution.pending"
679
+ }
680
+ }, r = y(), i = J(), a = pt(), o = mt(S(() => t.connection.uuid)), s = _t(o, "wise_invoicing.accounting.settings.posting.journals_unavailable"), c = S(() => t.connection.defaultPostingProfile), l = S(() => {
681
+ let e = [c.value?.salesEntryInvoiceJournal, c.value?.salesEntryCreditNoteJournal].filter((e) => e != null && e !== "");
682
+ return Array.from(new Set(e), (e) => ({
683
+ code: e,
684
+ description: null
685
+ }));
686
+ }), u = S(() => c.value === null ? null : n[c.value.resolutionStatus] ?? null), d = Y({
687
+ initialState: S(() => ({ postingProfile: X.toPostingProfileForm(c.value) })),
688
+ schema: Tt,
689
+ onSubmit: async (e) => {
690
+ let n = await a.execute({
691
+ body: e.postingProfile,
692
+ params: { connectionUuid: t.connection.uuid }
693
+ });
694
+ n.isErr() ? i.apiError(n.error) : i.show({ message: r.t("wise_invoicing.accounting.settings.posting.saved") });
695
+ },
696
+ onSubmitError: () => i.unableToSave()
697
+ }), p = d.register("postingProfile");
698
+ return (e, n) => (A(), C(M(Le), {
699
+ form: M(d),
700
+ "prompt-on-unsaved-changes": !0
701
+ }, {
702
+ default: N(() => [D(M(U), {
703
+ title: M(r).t("wise_invoicing.accounting.settings.sections.posting.title"),
704
+ description: M(r).t("wise_invoicing.accounting.settings.sections.posting.description")
705
+ }, {
706
+ default: N(() => [E("div", Et, [c.value === null ? (A(), C(M(G), {
707
+ key: 0,
708
+ text: M(r).t("wise_invoicing.accounting.settings.posting.not_configured"),
709
+ truncate: !1,
710
+ class: "text-sm text-secondary"
711
+ }, null, 8, ["text"])) : u.value === null ? w("", !0) : (A(), T("div", Dt, [D(M(I), {
712
+ label: M(r).t(u.value.labelKey),
713
+ color: u.value.color,
714
+ class: "self-start",
715
+ size: "sm",
716
+ variant: "translucent"
717
+ }, null, 8, ["label", "color"]), c.value?.resolutionError == null ? w("", !0) : (A(), C(M(G), {
718
+ key: 0,
719
+ text: c.value.resolutionError,
720
+ truncate: !1,
721
+ class: "text-xs text-error-primary",
722
+ role: "alert"
723
+ }, null, 8, ["text"]))])), D(ce, { queries: { journals: M(o) } }, {
724
+ default: N(({ data: e }) => [D(St, {
725
+ "connection-uuid": t.connection.uuid,
726
+ field: M(p),
727
+ journals: e.journals,
728
+ "is-lookup-unavailable": !1
729
+ }, null, 8, [
730
+ "connection-uuid",
731
+ "field",
732
+ "journals"
733
+ ])]),
734
+ error: N(() => [E("div", Ot, [E("div", kt, [D(M(g), { class: "mt-xxs size-4 shrink-0 text-error-primary" }), E("div", At, [E("div", jt, [M(s).errorKey.value === null ? w("", !0) : (A(), C(M(G), {
735
+ key: 0,
736
+ text: M(r).t(M(s).errorKey.value),
737
+ truncate: !1,
738
+ class: "text-sm text-primary"
739
+ }, null, 8, ["text"])), D(M(G), {
740
+ text: M(r).t("wise_invoicing.accounting.settings.posting.saved_values_shown"),
741
+ truncate: !1,
742
+ class: "text-sm text-secondary"
743
+ }, null, 8, ["text"])]), M(s).isRetryable.value ? (A(), C(M(L), {
744
+ key: 0,
745
+ "icon-left": M(se),
746
+ "is-loading": M(o).isFetching.value,
747
+ label: M(r).t("wise_invoicing.accounting.settings.posting.retry"),
748
+ size: "sm",
749
+ variant: "secondary",
750
+ onClick: M(o).refetch
751
+ }, null, 8, [
752
+ "icon-left",
753
+ "is-loading",
754
+ "label",
755
+ "onClick"
756
+ ])) : w("", !0)])]), D(St, {
757
+ "connection-uuid": t.connection.uuid,
758
+ field: M(p),
759
+ journals: l.value,
760
+ "is-lookup-unavailable": !0
761
+ }, null, 8, [
762
+ "connection-uuid",
763
+ "field",
764
+ "journals"
765
+ ])])]),
766
+ _: 1
767
+ }, 8, ["queries"])])]),
768
+ _: 1
769
+ }, 8, ["title", "description"]), (A(), C(x, {
770
+ to: "#page-actions",
771
+ defer: ""
772
+ }, [D(M(Ve), {
773
+ "is-disabled": !M(d).isDirty.value,
774
+ label: M(r).t("wise_invoicing.common.save")
775
+ }, null, 8, ["is-disabled", "label"])]))]),
776
+ _: 1
777
+ }, 8, ["form"]));
778
+ }
779
+ }), Nt = v.object({
780
+ clientId: v.string().min(1),
781
+ hasSavedClientSecret: v.boolean(),
782
+ clientSecret: v.string(),
783
+ region: v.enum(u, { error: () => e.global.t("wise_invoicing.accounting.settings.fields.region.required") })
784
+ }).superRefine((t, n) => {
785
+ !t.hasSavedClientSecret && t.clientSecret.trim() === "" && n.addIssue({
786
+ code: "custom",
787
+ message: e.global.t("wise_invoicing.accounting.settings.fields.client_secret.required"),
788
+ path: ["clientSecret"]
789
+ });
790
+ }), Pt = { class: "flex w-full flex-col gap-sm" }, Ft = { class: "flex items-center gap-sm rounded-md bg-secondary p-sm pl-md" }, It = { class: "min-w-0 flex-1 overflow-x-auto font-mono text-xs whitespace-nowrap text-primary" }, Lt = 2e3, Rt = "••••••••", zt = /* @__PURE__ */ O({
791
+ __name: "ExactAccountingConnectForm",
792
+ props: {
793
+ connection: {},
794
+ redirectUri: {},
795
+ suggestedRegion: {}
796
+ },
797
+ setup(e) {
798
+ let t = e, n = y(), r = lt(), i = xe(!1, Lt), a = j(!1), o = Y({
799
+ initialState: S(() => X.toConnectForm(t.connection, t.suggestedRegion)),
800
+ schema: Nt,
801
+ onSubmit: async (e) => {
802
+ await r.connect(e);
803
+ }
804
+ }), s = o.register("region"), c = o.register("clientId"), l = o.register("clientSecret"), d = o.register("hasSavedClientSecret", !1), f = S(() => d.modelValue.value && !a.value), p = S(() => t.connection === null ? "wise_invoicing.accounting.settings.connect.submit" : "wise_invoicing.accounting.settings.connect.save_and_reconnect"), m = S(() => q(Object.values(u)));
805
+ function h(e) {
806
+ return n.t(`wise_invoicing.accounting.region.${e}`);
807
+ }
808
+ async function ee() {
809
+ await navigator.clipboard.writeText(t.redirectUri), i.value = !0;
810
+ }
811
+ return (e, r) => (A(), C(M(Le), { form: M(o) }, {
812
+ default: N(() => [D(M(Be), null, {
813
+ default: N(() => [
814
+ D(M(U), {
815
+ title: M(n).t("wise_invoicing.accounting.settings.steps.region.title"),
816
+ description: M(n).t("wise_invoicing.accounting.settings.steps.region.description")
817
+ }, {
818
+ default: N(() => [D(M(H), null, {
819
+ default: N(() => [D(M(W), k({ "is-required": !0 }, M(_)(M(s)), {
820
+ "display-fn": h,
821
+ items: m.value,
822
+ label: M(n).t("wise_invoicing.accounting.settings.fields.region.label")
823
+ }), null, 16, ["items", "label"])]),
824
+ _: 1
825
+ })]),
826
+ _: 1
827
+ }, 8, ["title", "description"]),
828
+ D(M(U), {
829
+ title: M(n).t("wise_invoicing.accounting.settings.steps.app.title"),
830
+ description: M(n).t("wise_invoicing.accounting.settings.steps.app.description")
831
+ }, {
832
+ default: N(() => [E("div", Pt, [D(M(G), {
833
+ text: M(n).t("wise_invoicing.accounting.settings.fields.redirect_uri.label"),
834
+ class: "text-sm font-medium text-secondary"
835
+ }, null, 8, ["text"]), E("div", Ft, [E("code", It, ge(t.redirectUri), 1), D(M(He), {
836
+ icon: M(i) ? M(ie) : M(te),
837
+ label: M(n).t(M(i) ? "wise_invoicing.accounting.settings.fields.redirect_uri.copied" : "wise_invoicing.accounting.settings.fields.redirect_uri.copy"),
838
+ size: "sm",
839
+ variant: "tertiary",
840
+ onClick: ee
841
+ }, null, 8, ["icon", "label"])])])]),
842
+ _: 1
843
+ }, 8, ["title", "description"]),
844
+ D(M(U), {
845
+ title: M(n).t("wise_invoicing.accounting.settings.steps.credentials.title"),
846
+ description: M(n).t("wise_invoicing.accounting.settings.steps.credentials.description")
847
+ }, {
848
+ default: N(() => [D(M(H), null, {
849
+ default: N(() => [D(M(V), {
850
+ lg: 1,
851
+ sm: 1
852
+ }, {
853
+ default: N(() => [D(M(K), k({ "is-required": !0 }, M(_)(M(c)), { label: M(n).t("wise_invoicing.accounting.settings.fields.client_id.label") }), null, 16, ["label"]), f.value ? (A(), C(M(K), {
854
+ key: 0,
855
+ "model-value": Rt,
856
+ "is-readonly": !0,
857
+ label: M(n).t("wise_invoicing.accounting.settings.fields.client_secret.label"),
858
+ hint: M(n).t("wise_invoicing.accounting.settings.fields.client_secret.saved")
859
+ }, {
860
+ right: N(() => [D(M(L), {
861
+ label: M(n).t("wise_invoicing.accounting.settings.fields.client_secret.change"),
862
+ size: "sm",
863
+ variant: "secondary",
864
+ onClick: r[0] ||= (e) => a.value = !0
865
+ }, null, 8, ["label"])]),
866
+ _: 1
867
+ }, 8, ["label", "hint"])) : (A(), C(M(K), k({
868
+ key: 1,
869
+ "is-required": !M(d).modelValue.value
870
+ }, M(_)(M(l)), {
871
+ label: M(n).t("wise_invoicing.accounting.settings.fields.client_secret.label"),
872
+ hint: M(n).t(M(d).modelValue.value ? "wise_invoicing.accounting.settings.fields.client_secret.replace_hint" : "wise_invoicing.accounting.settings.fields.client_secret.hint"),
873
+ type: "password",
874
+ autocomplete: "new-password"
875
+ }), null, 16, [
876
+ "is-required",
877
+ "label",
878
+ "hint"
879
+ ]))]),
880
+ _: 1
881
+ })]),
882
+ _: 1
883
+ })]),
884
+ _: 1
885
+ }, 8, ["title", "description"])
886
+ ]),
887
+ _: 1
888
+ }), (A(), C(x, {
889
+ to: "#page-actions",
890
+ defer: ""
891
+ }, [D(M(Ve), {
892
+ "is-disabled": !M(o).isDirty.value,
893
+ label: M(n).t(p.value)
894
+ }, null, 8, ["is-disabled", "label"])]))]),
895
+ _: 1
896
+ }, 8, ["form"]));
897
+ }
898
+ });
899
+ //#endregion
900
+ //#region src/modules/accounting/use-cases/settings/composables/accountingAuthorizationResult.composable.ts
901
+ function Bt() {
902
+ let e = Ce(), t = we(), n = J(), r = y(), i = e.query, a = i.status, o = i.error;
903
+ if (a === "success") n.show({ message: r.t("wise_invoicing.accounting.settings.authorization.success") });
904
+ else if (a === "error") n.show({
905
+ message: r.t($.translationKey(o ?? "")),
906
+ variant: "error"
907
+ });
908
+ else return;
909
+ t.replace({ query: {} });
910
+ }
911
+ //#endregion
912
+ //#region src/modules/accounting/use-cases/settings/views/AccountingSettingsView.vue?vue&type=script&setup=true&lang.ts
913
+ var Vt = { class: "mx-auto flex w-full max-w-3xl flex-col gap-md" }, Ht = /* @__PURE__ */ O({
914
+ __name: "AccountingSettingsView",
915
+ props: {
916
+ issuerCountryCode: {},
917
+ connection: {},
918
+ exactAuthorizationConfig: {}
919
+ },
920
+ setup(e) {
921
+ let t = e, n = y();
922
+ p().set(() => n.t("wise_invoicing.accounting.settings.page_title")), Bt();
923
+ let r = S(() => [{ label: n.t("wise_invoicing.accounting.settings.title") }, { label: n.t("wise_invoicing.accounting.settings.page_title") }]), i = S(() => Xe.fromCountryCode(t.issuerCountryCode)), a = S(() => t.connection?.readiness === d.READY ? t.connection : null);
924
+ return (e, o) => (A(), C(M(ke), {
925
+ title: M(n).t("wise_invoicing.accounting.settings.page_title"),
926
+ breadcrumbs: r.value
927
+ }, {
928
+ "page-actions-right": N(() => [...o[0] ||= [E("div", { id: "page-actions" }, null, -1)]]),
929
+ default: N(() => [D(M(Ae), null, {
930
+ default: N(() => [D(M(Be), null, {
931
+ default: N(() => [E("header", Vt, [D(Ye, { class: "h-6 w-auto self-start" }), D(M(G), {
932
+ text: M(n).t("wise_invoicing.accounting.settings.booking_moment"),
933
+ truncate: !1,
934
+ class: "text-sm text-secondary"
935
+ }, null, 8, ["text"])]), a.value === null ? (A(), T(b, { key: 1 }, [t.connection === null ? w("", !0) : (A(), C(ft, {
936
+ key: 0,
937
+ connection: t.connection
938
+ }, null, 8, ["connection"])), D(zt, {
939
+ connection: t.connection,
940
+ "redirect-uri": t.exactAuthorizationConfig.redirectUri,
941
+ "suggested-region": i.value
942
+ }, null, 8, [
943
+ "connection",
944
+ "redirect-uri",
945
+ "suggested-region"
946
+ ])], 64)) : (A(), T(b, { key: 0 }, [
947
+ D(nt, { connection: a.value }, null, 8, ["connection"]),
948
+ D(M(ze)),
949
+ D(Mt, { connection: a.value }, null, 8, ["connection"])
950
+ ], 64))]),
951
+ _: 1
952
+ })]),
953
+ _: 1
954
+ })]),
955
+ _: 1
956
+ }, 8, ["title", "breadcrumbs"]));
957
+ }
958
+ }), Ut = /* @__PURE__ */ O({
959
+ __name: "AccountingSettingsViewDataProvider",
960
+ setup(e) {
961
+ let t = Ke(), n = qe(), r = le();
962
+ return (e, i) => (A(), C(ce, { queries: {
963
+ connection: M(t),
964
+ exactAuthorizationConfig: M(n),
965
+ issuerSettings: M(r)
966
+ } }, {
967
+ default: N(({ data: e }) => [D(Ht, {
968
+ connection: e.connection,
969
+ "exact-authorization-config": e.exactAuthorizationConfig,
970
+ "issuer-country-code": e.issuerSettings.address?.countryCode ?? null
971
+ }, null, 8, [
972
+ "connection",
973
+ "exact-authorization-config",
974
+ "issuer-country-code"
975
+ ])]),
976
+ _: 1
977
+ }, 8, ["queries"]));
978
+ }
979
+ });
980
+ //#endregion
981
+ export { Ut as default };