mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-27 11:02:16 +01:00
chore: update openapi (#10747)
This commit is contained in:
parent
3393bb35e5
commit
f01f747c9b
@ -9,7 +9,7 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
||||
import { formatCurrency } from './types.ts';
|
||||
import { Badge } from 'component/common/Badge/Badge.tsx';
|
||||
import type { FC, ReactNode } from 'react';
|
||||
import type { DetailedInvoicesResponseSchemaInvoicesItem } from 'openapi/index.ts';
|
||||
import type { DetailedInvoicesSchemaInvoicesItem } from 'openapi/index.ts';
|
||||
import { BillingInvoiceRow } from './BillingInvoiceRow/BillingInvoiceRow.tsx';
|
||||
import { BillingInvoiceFooter } from './BillingInvoiceFooter/BillingInvoiceFooter.tsx';
|
||||
import { StyledSubgrid } from './BillingInvoice.styles.tsx';
|
||||
@ -146,8 +146,8 @@ export const BillingInvoice = ({
|
||||
invoicePDF,
|
||||
invoiceURL,
|
||||
totalAmount,
|
||||
lines,
|
||||
}: DetailedInvoicesResponseSchemaInvoicesItem) => {
|
||||
mainLines,
|
||||
}: DetailedInvoicesSchemaInvoicesItem) => {
|
||||
const title = invoiceDate
|
||||
? new Date(invoiceDate).toLocaleDateString(undefined, {
|
||||
month: 'long',
|
||||
@ -198,7 +198,7 @@ export const BillingInvoice = ({
|
||||
<HeaderCell>Quantity</HeaderCell>
|
||||
<HeaderCell>Amount</HeaderCell>
|
||||
</StyledSubgrid>
|
||||
{lines.map((line) => (
|
||||
{mainLines.map((line) => (
|
||||
<TableBody
|
||||
key={line.description}
|
||||
// TODO: split into "usage" category
|
||||
|
||||
@ -16,9 +16,7 @@ const StyledHeader = styled(Typography)(({ theme }) => ({
|
||||
marginBottom: theme.spacing(2),
|
||||
}));
|
||||
|
||||
type BillingInvoicesProps = {};
|
||||
|
||||
export const BillingInvoices: FC<BillingInvoicesProps> = () => {
|
||||
export const BillingInvoices: FC = () => {
|
||||
const { invoices } = useDetailedInvoices();
|
||||
|
||||
return (
|
||||
|
||||
@ -2,7 +2,7 @@ import useSWR, { type SWRConfiguration } from 'swr';
|
||||
import { useMemo } from 'react';
|
||||
import { formatApiPath } from 'utils/formatPath';
|
||||
import handleErrorResponses from '../httpErrorResponseHandler.js';
|
||||
import type { DetailedInvoicesResponseSchema } from 'openapi';
|
||||
import type { DetailedInvoicesSchema } from 'openapi';
|
||||
|
||||
const KEY = `api/admin/invoices/list`;
|
||||
const path = formatApiPath(KEY);
|
||||
@ -13,7 +13,7 @@ export const useDetailedInvoices = (options: SWRConfiguration = {}) => {
|
||||
.then(handleErrorResponses('Detailed invoices'))
|
||||
.then((res) => res.json());
|
||||
|
||||
const { data, error, isLoading } = useSWR<DetailedInvoicesResponseSchema>(
|
||||
const { data, error, isLoading } = useSWR<DetailedInvoicesSchema>(
|
||||
KEY,
|
||||
fetcher,
|
||||
options,
|
||||
@ -32,8 +32,17 @@ export const useDetailedInvoices = (options: SWRConfiguration = {}) => {
|
||||
invoiceDate: '2023-08-01',
|
||||
invoicePDF: 'https://example.com/invoice/1.pdf',
|
||||
invoiceURL: 'https://example.com/invoice/1',
|
||||
totalAmount: 100,
|
||||
lines: [
|
||||
totalAmount: 400,
|
||||
mainLines: [
|
||||
{
|
||||
currency: 'USD',
|
||||
description: 'Service C',
|
||||
lookupKey: 'service-c',
|
||||
quantity: 1,
|
||||
totalAmount: 200,
|
||||
},
|
||||
],
|
||||
usageLines: [
|
||||
{
|
||||
currency: 'USD',
|
||||
description: 'Service A',
|
||||
@ -58,7 +67,7 @@ export const useDetailedInvoices = (options: SWRConfiguration = {}) => {
|
||||
invoicePDF: 'https://example.com/invoice/2.pdf',
|
||||
invoiceURL: 'https://example.com/invoice/2',
|
||||
totalAmount: 200,
|
||||
lines: [
|
||||
mainLines: [
|
||||
{
|
||||
currency: 'USD',
|
||||
description: 'Service C',
|
||||
@ -67,8 +76,9 @@ export const useDetailedInvoices = (options: SWRConfiguration = {}) => {
|
||||
totalAmount: 200,
|
||||
},
|
||||
],
|
||||
usageLines: [],
|
||||
},
|
||||
],
|
||||
] satisfies DetailedInvoicesSchema['invoices'],
|
||||
error,
|
||||
loading: isLoading,
|
||||
};
|
||||
|
||||
@ -4,7 +4,9 @@
|
||||
* See `gen:api` script in package.json
|
||||
*/
|
||||
|
||||
export type DetailedInvoicesResponseSchemaInvoicesItemLinesItem = {
|
||||
export interface DetailedInvoicesLineSchema {
|
||||
/** Optional consumption associated with the line item */
|
||||
consumption?: number;
|
||||
/** Currency code */
|
||||
currency: string;
|
||||
/** Description of the line item */
|
||||
@ -17,5 +19,4 @@ export type DetailedInvoicesResponseSchemaInvoicesItemLinesItem = {
|
||||
quantity: number;
|
||||
/** Total amount for this line item in minor currency units */
|
||||
totalAmount: number;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Generated by Orval
|
||||
* Do not edit manually.
|
||||
* See `gen:api` script in package.json
|
||||
*/
|
||||
import type { DetailedInvoicesResponseSchemaInvoicesItem } from './detailedInvoicesResponseSchemaInvoicesItem.js';
|
||||
|
||||
/**
|
||||
* Detailed invoices response with nested line items
|
||||
*/
|
||||
export interface DetailedInvoicesResponseSchema {
|
||||
/** List of invoices with their line items */
|
||||
invoices: DetailedInvoicesResponseSchemaInvoicesItem[];
|
||||
[key: string]: unknown;
|
||||
}
|
||||
14
frontend/src/openapi/models/detailedInvoicesSchema.ts
Normal file
14
frontend/src/openapi/models/detailedInvoicesSchema.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Generated by Orval
|
||||
* Do not edit manually.
|
||||
* See `gen:api` script in package.json
|
||||
*/
|
||||
import type { DetailedInvoicesSchemaInvoicesItem } from './detailedInvoicesSchemaInvoicesItem.js';
|
||||
|
||||
/**
|
||||
* Detailed invoices response with nested line items
|
||||
*/
|
||||
export interface DetailedInvoicesSchema {
|
||||
/** List of invoices with their line items */
|
||||
invoices: DetailedInvoicesSchemaInvoicesItem[];
|
||||
}
|
||||
@ -3,9 +3,9 @@
|
||||
* Do not edit manually.
|
||||
* See `gen:api` script in package.json
|
||||
*/
|
||||
import type { DetailedInvoicesResponseSchemaInvoicesItemLinesItem } from './detailedInvoicesResponseSchemaInvoicesItemLinesItem.js';
|
||||
import type { DetailedInvoicesLineSchema } from './detailedInvoicesLineSchema.js';
|
||||
|
||||
export type DetailedInvoicesResponseSchemaInvoicesItem = {
|
||||
export type DetailedInvoicesSchemaInvoicesItem = {
|
||||
/** When the invoice is due */
|
||||
dueDate?: string;
|
||||
/** When the invoice was created */
|
||||
@ -14,11 +14,12 @@ export type DetailedInvoicesResponseSchemaInvoicesItem = {
|
||||
invoicePDF?: string;
|
||||
/** A URL pointing to where the invoice can be found. */
|
||||
invoiceURL?: string;
|
||||
/** Line items included in the invoice */
|
||||
lines: DetailedInvoicesResponseSchemaInvoicesItemLinesItem[];
|
||||
/** Primary line items (packages, seats, etc.) */
|
||||
mainLines: DetailedInvoicesLineSchema[];
|
||||
/** The current status of the invoice */
|
||||
status: string;
|
||||
/** Total amount for the invoice in minor currency units */
|
||||
totalAmount: number;
|
||||
[key: string]: unknown;
|
||||
/** Usage line items (traffic, consumption usage, overages) */
|
||||
usageLines: DetailedInvoicesLineSchema[];
|
||||
};
|
||||
@ -604,9 +604,9 @@ export * from './dependentFeatureSchema.js';
|
||||
export * from './deprecateStrategy401.js';
|
||||
export * from './deprecateStrategy403.js';
|
||||
export * from './deprecateStrategy404.js';
|
||||
export * from './detailedInvoicesResponseSchema.js';
|
||||
export * from './detailedInvoicesResponseSchemaInvoicesItem.js';
|
||||
export * from './detailedInvoicesResponseSchemaInvoicesItemLinesItem.js';
|
||||
export * from './detailedInvoicesLineSchema.js';
|
||||
export * from './detailedInvoicesSchema.js';
|
||||
export * from './detailedInvoicesSchemaInvoicesItem.js';
|
||||
export * from './disableBanner401.js';
|
||||
export * from './disableBanner403.js';
|
||||
export * from './disableBanner404.js';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user