{"version":3,"file":"D6gbMboZ.js","sources":["../../../../src/composables/dialogs/useCollectiveInvoiceDialog.ts"],"sourcesContent":["import { DialogIdent, useDialogStore } from '@/stores/useDialogStore';\nimport { DialogResponses } from '~/stores/useDialogStore';\nimport { useUserContext } from '~/stores/useUserContext';\nimport { useSecureSessionPost } from '../dataFetching/genericFetchers';\nimport type {\n Result,\n PostBody,\n} from '~/server/api/[site]/user/account/collectiveInvoice.post';\n\nexport default function useCollectiveInvoiceDialog() {\n const dialogStore = useDialogStore();\n const userContext = useUserContext();\n\n const site = useSiteIdent();\n type openOptions = { activate: boolean };\n return {\n open: async (options: openOptions) => {\n return dialogStore.openDialog(DialogIdent.COLLECTIVE_INVOICE, options);\n },\n getData: () => {\n return dialogStore.getDialogData(\n DialogIdent.COLLECTIVE_INVOICE,\n );\n },\n close: (data?: any) => {\n dialogStore.closeDialog(data ?? DialogResponses.SUCCESS);\n },\n cancel: () => {\n dialogStore.closeDialog(DialogResponses.CANCEL);\n },\n async changeCollectiveInvoice(nv: boolean) {\n const postData: PostBody = {\n bank: userContext.maskedBankData.bankName,\n maskedIban: userContext.maskedBankData.iban,\n maskedBic: userContext.maskedBankData.bic,\n collectiveInvoice: nv,\n };\n const result = await useSecureSessionPost(\n `/api/${site}/user/account/collectiveInvoice`,\n postData,\n );\n if (result) {\n await userContext.loadAccountData(true);\n }\n },\n };\n}\n"],"names":["useCollectiveInvoiceDialog","dialogStore","useDialogStore","userContext","useUserContext","site","useSiteIdent","options","DialogIdent","data","DialogResponses","nv","postData","useSecureSessionPost"],"mappings":"wEASA,SAAwBA,GAA6B,CACnD,MAAMC,EAAcC,IACdC,EAAcC,IAEdC,EAAOC,IAEN,MAAA,CACL,KAAM,MAAOC,GACJN,EAAY,WAAWO,EAAY,mBAAoBD,CAAO,EAEvE,QAAS,IACAN,EAAY,cACjBO,EAAY,kBAAA,EAGhB,MAAQC,GAAe,CACTR,EAAA,YAAYQ,GAAQC,EAAgB,OAAO,CACzD,EACA,OAAQ,IAAM,CACAT,EAAA,YAAYS,EAAgB,MAAM,CAChD,EACA,MAAM,wBAAwBC,EAAa,CACzC,MAAMC,EAAqB,CACzB,KAAMT,EAAY,eAAe,SACjC,WAAYA,EAAY,eAAe,KACvC,UAAWA,EAAY,eAAe,IACtC,kBAAmBQ,CAAA,EAEN,MAAME,EACnB,QAAQR,CAAI,kCACZO,CAAA,GAGM,MAAAT,EAAY,gBAAgB,EAAI,CAE1C,CAAA,CAEJ"}