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 { formatCurrency } from './types.ts';
|
||||||
import { Badge } from 'component/common/Badge/Badge.tsx';
|
import { Badge } from 'component/common/Badge/Badge.tsx';
|
||||||
import type { FC, ReactNode } from 'react';
|
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 { BillingInvoiceRow } from './BillingInvoiceRow/BillingInvoiceRow.tsx';
|
||||||
import { BillingInvoiceFooter } from './BillingInvoiceFooter/BillingInvoiceFooter.tsx';
|
import { BillingInvoiceFooter } from './BillingInvoiceFooter/BillingInvoiceFooter.tsx';
|
||||||
import { StyledSubgrid } from './BillingInvoice.styles.tsx';
|
import { StyledSubgrid } from './BillingInvoice.styles.tsx';
|
||||||
@ -146,8 +146,8 @@ export const BillingInvoice = ({
|
|||||||
invoicePDF,
|
invoicePDF,
|
||||||
invoiceURL,
|
invoiceURL,
|
||||||
totalAmount,
|
totalAmount,
|
||||||
lines,
|
mainLines,
|
||||||
}: DetailedInvoicesResponseSchemaInvoicesItem) => {
|
}: DetailedInvoicesSchemaInvoicesItem) => {
|
||||||
const title = invoiceDate
|
const title = invoiceDate
|
||||||
? new Date(invoiceDate).toLocaleDateString(undefined, {
|
? new Date(invoiceDate).toLocaleDateString(undefined, {
|
||||||
month: 'long',
|
month: 'long',
|
||||||
@ -198,7 +198,7 @@ export const BillingInvoice = ({
|
|||||||
<HeaderCell>Quantity</HeaderCell>
|
<HeaderCell>Quantity</HeaderCell>
|
||||||
<HeaderCell>Amount</HeaderCell>
|
<HeaderCell>Amount</HeaderCell>
|
||||||
</StyledSubgrid>
|
</StyledSubgrid>
|
||||||
{lines.map((line) => (
|
{mainLines.map((line) => (
|
||||||
<TableBody
|
<TableBody
|
||||||
key={line.description}
|
key={line.description}
|
||||||
// TODO: split into "usage" category
|
// TODO: split into "usage" category
|
||||||
|
|||||||
@ -16,9 +16,7 @@ const StyledHeader = styled(Typography)(({ theme }) => ({
|
|||||||
marginBottom: theme.spacing(2),
|
marginBottom: theme.spacing(2),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
type BillingInvoicesProps = {};
|
export const BillingInvoices: FC = () => {
|
||||||
|
|
||||||
export const BillingInvoices: FC<BillingInvoicesProps> = () => {
|
|
||||||
const { invoices } = useDetailedInvoices();
|
const { invoices } = useDetailedInvoices();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import useSWR, { type SWRConfiguration } from 'swr';
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { formatApiPath } from 'utils/formatPath';
|
import { formatApiPath } from 'utils/formatPath';
|
||||||
import handleErrorResponses from '../httpErrorResponseHandler.js';
|
import handleErrorResponses from '../httpErrorResponseHandler.js';
|
||||||
import type { DetailedInvoicesResponseSchema } from 'openapi';
|
import type { DetailedInvoicesSchema } from 'openapi';
|
||||||
|
|
||||||
const KEY = `api/admin/invoices/list`;
|
const KEY = `api/admin/invoices/list`;
|
||||||
const path = formatApiPath(KEY);
|
const path = formatApiPath(KEY);
|
||||||
@ -13,7 +13,7 @@ export const useDetailedInvoices = (options: SWRConfiguration = {}) => {
|
|||||||
.then(handleErrorResponses('Detailed invoices'))
|
.then(handleErrorResponses('Detailed invoices'))
|
||||||
.then((res) => res.json());
|
.then((res) => res.json());
|
||||||
|
|
||||||
const { data, error, isLoading } = useSWR<DetailedInvoicesResponseSchema>(
|
const { data, error, isLoading } = useSWR<DetailedInvoicesSchema>(
|
||||||
KEY,
|
KEY,
|
||||||
fetcher,
|
fetcher,
|
||||||
options,
|
options,
|
||||||
@ -32,8 +32,17 @@ export const useDetailedInvoices = (options: SWRConfiguration = {}) => {
|
|||||||
invoiceDate: '2023-08-01',
|
invoiceDate: '2023-08-01',
|
||||||
invoicePDF: 'https://example.com/invoice/1.pdf',
|
invoicePDF: 'https://example.com/invoice/1.pdf',
|
||||||
invoiceURL: 'https://example.com/invoice/1',
|
invoiceURL: 'https://example.com/invoice/1',
|
||||||
totalAmount: 100,
|
totalAmount: 400,
|
||||||
lines: [
|
mainLines: [
|
||||||
|
{
|
||||||
|
currency: 'USD',
|
||||||
|
description: 'Service C',
|
||||||
|
lookupKey: 'service-c',
|
||||||
|
quantity: 1,
|
||||||
|
totalAmount: 200,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
usageLines: [
|
||||||
{
|
{
|
||||||
currency: 'USD',
|
currency: 'USD',
|
||||||
description: 'Service A',
|
description: 'Service A',
|
||||||
@ -58,7 +67,7 @@ export const useDetailedInvoices = (options: SWRConfiguration = {}) => {
|
|||||||
invoicePDF: 'https://example.com/invoice/2.pdf',
|
invoicePDF: 'https://example.com/invoice/2.pdf',
|
||||||
invoiceURL: 'https://example.com/invoice/2',
|
invoiceURL: 'https://example.com/invoice/2',
|
||||||
totalAmount: 200,
|
totalAmount: 200,
|
||||||
lines: [
|
mainLines: [
|
||||||
{
|
{
|
||||||
currency: 'USD',
|
currency: 'USD',
|
||||||
description: 'Service C',
|
description: 'Service C',
|
||||||
@ -67,8 +76,9 @@ export const useDetailedInvoices = (options: SWRConfiguration = {}) => {
|
|||||||
totalAmount: 200,
|
totalAmount: 200,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
usageLines: [],
|
||||||
},
|
},
|
||||||
],
|
] satisfies DetailedInvoicesSchema['invoices'],
|
||||||
error,
|
error,
|
||||||
loading: isLoading,
|
loading: isLoading,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,7 +4,9 @@
|
|||||||
* See `gen:api` script in package.json
|
* 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 code */
|
||||||
currency: string;
|
currency: string;
|
||||||
/** Description of the line item */
|
/** Description of the line item */
|
||||||
@ -17,5 +19,4 @@ export type DetailedInvoicesResponseSchemaInvoicesItemLinesItem = {
|
|||||||
quantity: number;
|
quantity: number;
|
||||||
/** Total amount for this line item in minor currency units */
|
/** Total amount for this line item in minor currency units */
|
||||||
totalAmount: number;
|
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.
|
* Do not edit manually.
|
||||||
* See `gen:api` script in package.json
|
* 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 */
|
/** When the invoice is due */
|
||||||
dueDate?: string;
|
dueDate?: string;
|
||||||
/** When the invoice was created */
|
/** When the invoice was created */
|
||||||
@ -14,11 +14,12 @@ export type DetailedInvoicesResponseSchemaInvoicesItem = {
|
|||||||
invoicePDF?: string;
|
invoicePDF?: string;
|
||||||
/** A URL pointing to where the invoice can be found. */
|
/** A URL pointing to where the invoice can be found. */
|
||||||
invoiceURL?: string;
|
invoiceURL?: string;
|
||||||
/** Line items included in the invoice */
|
/** Primary line items (packages, seats, etc.) */
|
||||||
lines: DetailedInvoicesResponseSchemaInvoicesItemLinesItem[];
|
mainLines: DetailedInvoicesLineSchema[];
|
||||||
/** The current status of the invoice */
|
/** The current status of the invoice */
|
||||||
status: string;
|
status: string;
|
||||||
/** Total amount for the invoice in minor currency units */
|
/** Total amount for the invoice in minor currency units */
|
||||||
totalAmount: number;
|
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 './deprecateStrategy401.js';
|
||||||
export * from './deprecateStrategy403.js';
|
export * from './deprecateStrategy403.js';
|
||||||
export * from './deprecateStrategy404.js';
|
export * from './deprecateStrategy404.js';
|
||||||
export * from './detailedInvoicesResponseSchema.js';
|
export * from './detailedInvoicesLineSchema.js';
|
||||||
export * from './detailedInvoicesResponseSchemaInvoicesItem.js';
|
export * from './detailedInvoicesSchema.js';
|
||||||
export * from './detailedInvoicesResponseSchemaInvoicesItemLinesItem.js';
|
export * from './detailedInvoicesSchemaInvoicesItem.js';
|
||||||
export * from './disableBanner401.js';
|
export * from './disableBanner401.js';
|
||||||
export * from './disableBanner403.js';
|
export * from './disableBanner403.js';
|
||||||
export * from './disableBanner404.js';
|
export * from './disableBanner404.js';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user