Files
InvoiceShelf/resources/scripts-v2/api/services/module.service.ts
Darko Gjorgjijoski a46cca5cd8 Complete scripts-v2 TypeScript migration — all imports resolved,
build passes

Create all missing components (modals, dropdowns, icons, tabs, mail
drivers, customer partials), fix all @/scripts/ imports to @v2/,
wire up vite entry point and blade template. 382 files, 48883 lines.

- 27 settings components: modals (tax, payment, custom field, note,
  category, role, exchange rate, unit, mail test), dropdowns (6),
  customization tabs (4), mail driver forms (4)
- 22 icon components: 5 utility icons, 4 dashboard icons, 13 editor
  toolbar icons with typed barrel export
- 3 customer components: info, chart placeholder, custom fields single
- Fixed usePopper composable, client/format-money import patterns
- Zero remaining @/scripts/ imports in scripts-v2/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 09:30:00 +02:00

78 lines
2.1 KiB
TypeScript

import { client } from '../client'
import { API } from '../endpoints'
import type { ApiResponse } from '@v2/types/api'
export interface Module {
name: string
slug: string
description: string
version: string
enabled: boolean
installed: boolean
[key: string]: unknown
}
export interface ModuleCheckResponse {
error?: string
success?: boolean
}
export interface ModuleInstallPayload {
module: string
version: string
api_token?: string
}
export const moduleService = {
async list(): Promise<ApiResponse<Module[]>> {
const { data } = await client.get(API.MODULES)
return data
},
async get(module: string): Promise<Module> {
const { data } = await client.get(`${API.MODULES}/${module}`)
return data
},
async checkToken(apiToken: string): Promise<ModuleCheckResponse> {
const { data } = await client.get(`${API.MODULES_CHECK}?api_token=${apiToken}`)
return data
},
async enable(module: string): Promise<{ success: boolean }> {
const { data } = await client.post(`${API.MODULES}/${module}/enable`)
return data
},
async disable(module: string): Promise<{ success: boolean }> {
const { data } = await client.post(`${API.MODULES}/${module}/disable`)
return data
},
// Installation flow
async download(payload: ModuleInstallPayload): Promise<{ success: boolean }> {
const { data } = await client.post(API.MODULES_DOWNLOAD, payload)
return data
},
async upload(payload: FormData): Promise<{ success: boolean }> {
const { data } = await client.post(API.MODULES_UPLOAD, payload)
return data
},
async unzip(payload: ModuleInstallPayload): Promise<{ success: boolean }> {
const { data } = await client.post(API.MODULES_UNZIP, payload)
return data
},
async copy(payload: ModuleInstallPayload): Promise<{ success: boolean }> {
const { data } = await client.post(API.MODULES_COPY, payload)
return data
},
async complete(payload: ModuleInstallPayload): Promise<{ success: boolean }> {
const { data } = await client.post(API.MODULES_COMPLETE, payload)
return data
},
}