diff --git a/src/frontend/.prettierignore b/src/frontend/.prettierignore index 018bf63441..057a5ac085 100644 --- a/src/frontend/.prettierignore +++ b/src/frontend/.prettierignore @@ -3,3 +3,5 @@ i18n/**/* public-path.js # LexPersona iframe script iframe-manager.js +# generated api client +js/api/**/gen/**/*.ts diff --git a/src/frontend/js/api/joanie/client.spec.ts b/src/frontend/js/api/joanie/client.spec.ts new file mode 100644 index 0000000000..4c1f8dd1d7 --- /dev/null +++ b/src/frontend/js/api/joanie/client.spec.ts @@ -0,0 +1,39 @@ +import fetchMock from 'fetch-mock'; +import { RICHIE_USER_TOKEN } from 'settings'; +import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; +import { getApiClientJoanie } from './client'; +import { ApiClientJoanie } from './gen'; + +jest.mock('utils/context', () => ({ + __esModule: true, + default: mockRichieContextFactory({ + authentication: { backend: 'fonzie', endpoint: 'https://demo.endpoint' }, + joanie_backend: { endpoint: 'https://joanie.endpoint' }, + }).one(), +})); + +describe('joanieApi', () => { + let joanieApi: ApiClientJoanie; + beforeEach(() => { + joanieApi = getApiClientJoanie(); + }); + + it('test', async () => { + fetchMock.get('https://joanie.endpoint/api/v1.0/addresses/FAKE_ADDRESS_ID/', []); + await joanieApi.addresses.addressesRetrieve('FAKE_ADDRESS_ID'); + + let lastCall = fetchMock.lastCall(); + const visitorHeader = lastCall && lastCall[1]?.headers; + // TS see visitorHeader has HeadersInit instead of Headers and + // didn't accept get() as a possible function. + // @ts-ignore + expect(visitorHeader?.get('Authorization')).toBeNull(); + + sessionStorage.setItem(RICHIE_USER_TOKEN, 'TEST_TOKEN'); + await joanieApi.addresses.addressesRetrieve('FAKE_ADDRESS_ID'); + lastCall = fetchMock.lastCall(); + const userHeader = lastCall && lastCall[1]?.headers; + // @ts-ignore + expect(userHeader?.get('Authorization')).toBe('Bearer TEST_TOKEN'); + }); +}); diff --git a/src/frontend/js/api/joanie/client.ts b/src/frontend/js/api/joanie/client.ts new file mode 100644 index 0000000000..2115da8635 --- /dev/null +++ b/src/frontend/js/api/joanie/client.ts @@ -0,0 +1,35 @@ +import { RICHIE_USER_TOKEN } from 'settings'; + +import context from 'utils/context'; +import { ApiClientJoanie, ApiError, OpenAPIConfig } from './gen'; + +/** + * Build Joanie API Routes interface. + */ +export const getAPIEndpoint = () => { + const endpoint = context?.joanie_backend?.endpoint; + + if (!endpoint) { + throw new Error('[JOANIE] - Joanie API endpoint is not defined.'); + } + + return `${endpoint}`; +}; + +export const isApiError = (error: unknown): error is ApiError => { + return (error as ApiError).name === 'ApiError'; +}; + +export const getApiClientJoanie = () => { + const config: OpenAPIConfig = { + BASE: getAPIEndpoint(), + VERSION: '1', + WITH_CREDENTIALS: false, + CREDENTIALS: 'omit', + TOKEN: async () => { + return sessionStorage.getItem(RICHIE_USER_TOKEN) || ''; + }, + }; + + return new ApiClientJoanie(config); +}; diff --git a/src/frontend/js/api/joanie/gen/ApiClientJoanie.ts b/src/frontend/js/api/joanie/gen/ApiClientJoanie.ts new file mode 100644 index 0000000000..d37eb17d42 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/ApiClientJoanie.ts @@ -0,0 +1,77 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { BaseHttpRequest } from './core/BaseHttpRequest'; +import type { OpenAPIConfig } from './core/OpenAPI'; +import { FetchHttpRequest } from './core/FetchHttpRequest'; + +import { AddressesService } from './services/AddressesService'; +import { CertificatesService } from './services/CertificatesService'; +import { ContractDefinitionsService } from './services/ContractDefinitionsService'; +import { ContractsService } from './services/ContractsService'; +import { CourseProductRelationsService } from './services/CourseProductRelationsService'; +import { CourseRunsService } from './services/CourseRunsService'; +import { CourseRunsSyncService } from './services/CourseRunsSyncService'; +import { CoursesService } from './services/CoursesService'; +import { CreditCardsService } from './services/CreditCardsService'; +import { EnrollmentsService } from './services/EnrollmentsService'; +import { OrdersService } from './services/OrdersService'; +import { OrganizationsService } from './services/OrganizationsService'; +import { PaymentsService } from './services/PaymentsService'; +import { SignatureService } from './services/SignatureService'; +import { UsersService } from './services/UsersService'; + +type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest; + +export class ApiClientJoanie { + + public readonly addresses: AddressesService; + public readonly certificates: CertificatesService; + public readonly contractDefinitions: ContractDefinitionsService; + public readonly contracts: ContractsService; + public readonly courseProductRelations: CourseProductRelationsService; + public readonly courseRuns: CourseRunsService; + public readonly courseRunsSync: CourseRunsSyncService; + public readonly courses: CoursesService; + public readonly creditCards: CreditCardsService; + public readonly enrollments: EnrollmentsService; + public readonly orders: OrdersService; + public readonly organizations: OrganizationsService; + public readonly payments: PaymentsService; + public readonly signature: SignatureService; + public readonly users: UsersService; + + public readonly request: BaseHttpRequest; + + constructor(config?: Partial, HttpRequest: HttpRequestConstructor = FetchHttpRequest) { + this.request = new HttpRequest({ + BASE: config?.BASE ?? '', + VERSION: config?.VERSION ?? '1.0.0 (v1.0)', + WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false, + CREDENTIALS: config?.CREDENTIALS ?? 'include', + TOKEN: config?.TOKEN, + USERNAME: config?.USERNAME, + PASSWORD: config?.PASSWORD, + HEADERS: config?.HEADERS, + ENCODE_PATH: config?.ENCODE_PATH, + }); + + this.addresses = new AddressesService(this.request); + this.certificates = new CertificatesService(this.request); + this.contractDefinitions = new ContractDefinitionsService(this.request); + this.contracts = new ContractsService(this.request); + this.courseProductRelations = new CourseProductRelationsService(this.request); + this.courseRuns = new CourseRunsService(this.request); + this.courseRunsSync = new CourseRunsSyncService(this.request); + this.courses = new CoursesService(this.request); + this.creditCards = new CreditCardsService(this.request); + this.enrollments = new EnrollmentsService(this.request); + this.orders = new OrdersService(this.request); + this.organizations = new OrganizationsService(this.request); + this.payments = new PaymentsService(this.request); + this.signature = new SignatureService(this.request); + this.users = new UsersService(this.request); + } +} + diff --git a/src/frontend/js/api/joanie/gen/core/ApiError.ts b/src/frontend/js/api/joanie/gen/core/ApiError.ts new file mode 100644 index 0000000000..81f32a17b4 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/core/ApiError.ts @@ -0,0 +1,25 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiResult } from './ApiResult'; + +export class ApiError extends Error { + public readonly url: string; + public readonly status: number; + public readonly statusText: string; + public readonly body: any; + public readonly request: ApiRequestOptions; + + constructor(request: ApiRequestOptions, response: ApiResult, message: string) { + super(message); + + this.name = 'ApiError'; + this.url = response.url; + this.status = response.status; + this.statusText = response.statusText; + this.body = response.body; + this.request = request; + } +} diff --git a/src/frontend/js/api/joanie/gen/core/ApiRequestOptions.ts b/src/frontend/js/api/joanie/gen/core/ApiRequestOptions.ts new file mode 100644 index 0000000000..4d59ceda28 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/core/ApiRequestOptions.ts @@ -0,0 +1,17 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ApiRequestOptions = { + readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH'; + readonly url: string; + readonly path?: Record; + readonly cookies?: Record; + readonly headers?: Record; + readonly query?: Record; + readonly formData?: Record; + readonly body?: any; + readonly mediaType?: string; + readonly responseHeader?: string; + readonly errors?: Record; +}; diff --git a/src/frontend/js/api/joanie/gen/core/ApiResult.ts b/src/frontend/js/api/joanie/gen/core/ApiResult.ts new file mode 100644 index 0000000000..63ed6c4474 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/core/ApiResult.ts @@ -0,0 +1,11 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ApiResult = { + readonly url: string; + readonly ok: boolean; + readonly status: number; + readonly statusText: string; + readonly body: any; +}; diff --git a/src/frontend/js/api/joanie/gen/core/BaseHttpRequest.ts b/src/frontend/js/api/joanie/gen/core/BaseHttpRequest.ts new file mode 100644 index 0000000000..22c01bd68b --- /dev/null +++ b/src/frontend/js/api/joanie/gen/core/BaseHttpRequest.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { CancelablePromise } from './CancelablePromise'; +import type { OpenAPIConfig } from './OpenAPI'; + +export abstract class BaseHttpRequest { + + constructor(public readonly config: OpenAPIConfig) {} + + public abstract request(options: ApiRequestOptions): CancelablePromise; +} diff --git a/src/frontend/js/api/joanie/gen/core/CancelablePromise.ts b/src/frontend/js/api/joanie/gen/core/CancelablePromise.ts new file mode 100644 index 0000000000..a7910e405e --- /dev/null +++ b/src/frontend/js/api/joanie/gen/core/CancelablePromise.ts @@ -0,0 +1,131 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export class CancelError extends Error { + + constructor(message: string) { + super(message); + this.name = 'CancelError'; + } + + public get isCancelled(): boolean { + return true; + } +} + +export interface OnCancel { + readonly isResolved: boolean; + readonly isRejected: boolean; + readonly isCancelled: boolean; + + (cancelHandler: () => void): void; +} + +export class CancelablePromise implements Promise { + #isResolved: boolean; + #isRejected: boolean; + #isCancelled: boolean; + readonly #cancelHandlers: (() => void)[]; + readonly #promise: Promise; + #resolve?: (value: T | PromiseLike) => void; + #reject?: (reason?: any) => void; + + constructor( + executor: ( + resolve: (value: T | PromiseLike) => void, + reject: (reason?: any) => void, + onCancel: OnCancel + ) => void + ) { + this.#isResolved = false; + this.#isRejected = false; + this.#isCancelled = false; + this.#cancelHandlers = []; + this.#promise = new Promise((resolve, reject) => { + this.#resolve = resolve; + this.#reject = reject; + + const onResolve = (value: T | PromiseLike): void => { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#isResolved = true; + this.#resolve?.(value); + }; + + const onReject = (reason?: any): void => { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#isRejected = true; + this.#reject?.(reason); + }; + + const onCancel = (cancelHandler: () => void): void => { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#cancelHandlers.push(cancelHandler); + }; + + Object.defineProperty(onCancel, 'isResolved', { + get: (): boolean => this.#isResolved, + }); + + Object.defineProperty(onCancel, 'isRejected', { + get: (): boolean => this.#isRejected, + }); + + Object.defineProperty(onCancel, 'isCancelled', { + get: (): boolean => this.#isCancelled, + }); + + return executor(onResolve, onReject, onCancel as OnCancel); + }); + } + + get [Symbol.toStringTag]() { + return "Cancellable Promise"; + } + + public then( + onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, + onRejected?: ((reason: any) => TResult2 | PromiseLike) | null + ): Promise { + return this.#promise.then(onFulfilled, onRejected); + } + + public catch( + onRejected?: ((reason: any) => TResult | PromiseLike) | null + ): Promise { + return this.#promise.catch(onRejected); + } + + public finally(onFinally?: (() => void) | null): Promise { + return this.#promise.finally(onFinally); + } + + public cancel(): void { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#isCancelled = true; + if (this.#cancelHandlers.length) { + try { + for (const cancelHandler of this.#cancelHandlers) { + cancelHandler(); + } + } catch (error) { + console.warn('Cancellation threw an error', error); + return; + } + } + this.#cancelHandlers.length = 0; + this.#reject?.(new CancelError('Request aborted')); + } + + public get isCancelled(): boolean { + return this.#isCancelled; + } +} diff --git a/src/frontend/js/api/joanie/gen/core/FetchHttpRequest.ts b/src/frontend/js/api/joanie/gen/core/FetchHttpRequest.ts new file mode 100644 index 0000000000..d9cb463e86 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/core/FetchHttpRequest.ts @@ -0,0 +1,26 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { ApiRequestOptions } from './ApiRequestOptions'; +import { BaseHttpRequest } from './BaseHttpRequest'; +import type { CancelablePromise } from './CancelablePromise'; +import type { OpenAPIConfig } from './OpenAPI'; +import { request as __request } from './request'; + +export class FetchHttpRequest extends BaseHttpRequest { + + constructor(config: OpenAPIConfig) { + super(config); + } + + /** + * Request method + * @param options The request options from the service + * @returns CancelablePromise + * @throws ApiError + */ + public override request(options: ApiRequestOptions): CancelablePromise { + return __request(this.config, options); + } +} diff --git a/src/frontend/js/api/joanie/gen/core/OpenAPI.ts b/src/frontend/js/api/joanie/gen/core/OpenAPI.ts new file mode 100644 index 0000000000..6c5f2644fe --- /dev/null +++ b/src/frontend/js/api/joanie/gen/core/OpenAPI.ts @@ -0,0 +1,32 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { ApiRequestOptions } from './ApiRequestOptions'; + +type Resolver = (options: ApiRequestOptions) => Promise; +type Headers = Record; + +export type OpenAPIConfig = { + BASE: string; + VERSION: string; + WITH_CREDENTIALS: boolean; + CREDENTIALS: 'include' | 'omit' | 'same-origin'; + TOKEN?: string | Resolver | undefined; + USERNAME?: string | Resolver | undefined; + PASSWORD?: string | Resolver | undefined; + HEADERS?: Headers | Resolver | undefined; + ENCODE_PATH?: ((path: string) => string) | undefined; +}; + +export const OpenAPI: OpenAPIConfig = { + BASE: '', + VERSION: '1.0.0 (v1.0)', + WITH_CREDENTIALS: false, + CREDENTIALS: 'include', + TOKEN: undefined, + USERNAME: undefined, + PASSWORD: undefined, + HEADERS: undefined, + ENCODE_PATH: undefined, +}; diff --git a/src/frontend/js/api/joanie/gen/core/request.ts b/src/frontend/js/api/joanie/gen/core/request.ts new file mode 100644 index 0000000000..115f664b99 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/core/request.ts @@ -0,0 +1,320 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import { ApiError } from './ApiError'; +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiResult } from './ApiResult'; +import { CancelablePromise } from './CancelablePromise'; +import type { OnCancel } from './CancelablePromise'; +import type { OpenAPIConfig } from './OpenAPI'; + +export const isDefined = (value: T | null | undefined): value is Exclude => { + return value !== undefined && value !== null; +}; + +export const isString = (value: any): value is string => { + return typeof value === 'string'; +}; + +export const isStringWithValue = (value: any): value is string => { + return isString(value) && value !== ''; +}; + +export const isBlob = (value: any): value is Blob => { + return ( + typeof value === 'object' && + typeof value.type === 'string' && + typeof value.stream === 'function' && + typeof value.arrayBuffer === 'function' && + typeof value.constructor === 'function' && + typeof value.constructor.name === 'string' && + /^(Blob|File)$/.test(value.constructor.name) && + /^(Blob|File)$/.test(value[Symbol.toStringTag]) + ); +}; + +export const isFormData = (value: any): value is FormData => { + return value instanceof FormData; +}; + +export const base64 = (str: string): string => { + try { + return btoa(str); + } catch (err) { + // @ts-ignore + return Buffer.from(str).toString('base64'); + } +}; + +export const getQueryString = (params: Record): string => { + const qs: string[] = []; + + const append = (key: string, value: any) => { + qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`); + }; + + const process = (key: string, value: any) => { + if (isDefined(value)) { + if (Array.isArray(value)) { + value.forEach(v => { + process(key, v); + }); + } else if (typeof value === 'object') { + Object.entries(value).forEach(([k, v]) => { + process(`${key}[${k}]`, v); + }); + } else { + append(key, value); + } + } + }; + + Object.entries(params).forEach(([key, value]) => { + process(key, value); + }); + + if (qs.length > 0) { + return `?${qs.join('&')}`; + } + + return ''; +}; + +const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => { + const encoder = config.ENCODE_PATH || encodeURI; + + const path = options.url + .replace('{api-version}', config.VERSION) + .replace(/{(.*?)}/g, (substring: string, group: string) => { + if (options.path?.hasOwnProperty(group)) { + return encoder(String(options.path[group])); + } + return substring; + }); + + const url = `${config.BASE}${path}`; + if (options.query) { + return `${url}${getQueryString(options.query)}`; + } + return url; +}; + +export const getFormData = (options: ApiRequestOptions): FormData | undefined => { + if (options.formData) { + const formData = new FormData(); + + const process = (key: string, value: any) => { + if (isString(value) || isBlob(value)) { + formData.append(key, value); + } else { + formData.append(key, JSON.stringify(value)); + } + }; + + Object.entries(options.formData) + .filter(([_, value]) => isDefined(value)) + .forEach(([key, value]) => { + if (Array.isArray(value)) { + value.forEach(v => process(key, v)); + } else { + process(key, value); + } + }); + + return formData; + } + return undefined; +}; + +type Resolver = (options: ApiRequestOptions) => Promise; + +export const resolve = async (options: ApiRequestOptions, resolver?: T | Resolver): Promise => { + if (typeof resolver === 'function') { + return (resolver as Resolver)(options); + } + return resolver; +}; + +export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise => { + const token = await resolve(options, config.TOKEN); + const username = await resolve(options, config.USERNAME); + const password = await resolve(options, config.PASSWORD); + const additionalHeaders = await resolve(options, config.HEADERS); + + const headers = Object.entries({ + Accept: 'application/json', + ...additionalHeaders, + ...options.headers, + }) + .filter(([_, value]) => isDefined(value)) + .reduce((headers, [key, value]) => ({ + ...headers, + [key]: String(value), + }), {} as Record); + + if (isStringWithValue(token)) { + headers['Authorization'] = `Bearer ${token}`; + } + + if (isStringWithValue(username) && isStringWithValue(password)) { + const credentials = base64(`${username}:${password}`); + headers['Authorization'] = `Basic ${credentials}`; + } + + if (options.body) { + if (options.mediaType) { + headers['Content-Type'] = options.mediaType; + } else if (isBlob(options.body)) { + headers['Content-Type'] = options.body.type || 'application/octet-stream'; + } else if (isString(options.body)) { + headers['Content-Type'] = 'text/plain'; + } else if (!isFormData(options.body)) { + headers['Content-Type'] = 'application/json'; + } + } + + return new Headers(headers); +}; + +export const getRequestBody = (options: ApiRequestOptions): any => { + if (options.body !== undefined) { + if (options.mediaType?.includes('/json')) { + return JSON.stringify(options.body) + } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) { + return options.body; + } else { + return JSON.stringify(options.body); + } + } + return undefined; +}; + +export const sendRequest = async ( + config: OpenAPIConfig, + options: ApiRequestOptions, + url: string, + body: any, + formData: FormData | undefined, + headers: Headers, + onCancel: OnCancel +): Promise => { + const controller = new AbortController(); + + const request: RequestInit = { + headers, + body: body ?? formData, + method: options.method, + signal: controller.signal, + }; + + if (config.WITH_CREDENTIALS) { + request.credentials = config.CREDENTIALS; + } + + onCancel(() => controller.abort()); + + return await fetch(url, request); +}; + +export const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => { + if (responseHeader) { + const content = response.headers.get(responseHeader); + if (isString(content)) { + return content; + } + } + return undefined; +}; + +export const getResponseBody = async (response: Response): Promise => { + if (response.status !== 204) { + try { + const contentType = response.headers.get('Content-Type'); + if (contentType) { + const jsonTypes = ['application/json', 'application/problem+json'] + const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type)); + if (isJSON) { + return await response.json(); + } else { + return await response.text(); + } + } + } catch (error) { + console.error(error); + } + } + return undefined; +}; + +export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => { + const errors: Record = { + 400: 'Bad Request', + 401: 'Unauthorized', + 403: 'Forbidden', + 404: 'Not Found', + 500: 'Internal Server Error', + 502: 'Bad Gateway', + 503: 'Service Unavailable', + ...options.errors, + } + + const error = errors[result.status]; + if (error) { + throw new ApiError(options, result, error); + } + + if (!result.ok) { + const errorStatus = result.status ?? 'unknown'; + const errorStatusText = result.statusText ?? 'unknown'; + const errorBody = (() => { + try { + return JSON.stringify(result.body, null, 2); + } catch (e) { + return undefined; + } + })(); + + throw new ApiError(options, result, + `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}` + ); + } +}; + +/** + * Request method + * @param config The OpenAPI configuration object + * @param options The request options from the service + * @returns CancelablePromise + * @throws ApiError + */ +export const request = (config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise => { + return new CancelablePromise(async (resolve, reject, onCancel) => { + try { + const url = getUrl(config, options); + const formData = getFormData(options); + const body = getRequestBody(options); + const headers = await getHeaders(config, options); + + if (!onCancel.isCancelled) { + const response = await sendRequest(config, options, url, body, formData, headers, onCancel); + const responseBody = await getResponseBody(response); + const responseHeader = getResponseHeader(response, options.responseHeader); + + const result: ApiResult = { + url, + ok: response.ok, + status: response.status, + statusText: response.statusText, + body: responseHeader ?? responseBody, + }; + + catchErrorCodes(options, result); + + resolve(result.body); + } + } catch (error) { + reject(error); + } + }); +}; diff --git a/src/frontend/js/api/joanie/gen/index.ts b/src/frontend/js/api/joanie/gen/index.ts new file mode 100644 index 0000000000..241ea2f9c3 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/index.ts @@ -0,0 +1,93 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export { ApiClientJoanie } from './ApiClientJoanie'; + +export { ApiError } from './core/ApiError'; +export { BaseHttpRequest } from './core/BaseHttpRequest'; +export { CancelablePromise, CancelError } from './core/CancelablePromise'; +export { OpenAPI } from './core/OpenAPI'; +export type { OpenAPIConfig } from './core/OpenAPI'; + +export type { Address } from './models/Address'; +export type { AddressRequest } from './models/AddressRequest'; +export type { Certificate } from './models/Certificate'; +export type { CertificationDefinition } from './models/CertificationDefinition'; +export type { Contract } from './models/Contract'; +export type { ContractDefinition } from './models/ContractDefinition'; +export type { ContractLight } from './models/ContractLight'; +export { CountryEnum } from './models/CountryEnum'; +export type { Course } from './models/Course'; +export type { CourseAccess } from './models/CourseAccess'; +export type { CourseAccessRequest } from './models/CourseAccessRequest'; +export { CourseAccessRoleChoiceEnum } from './models/CourseAccessRoleChoiceEnum'; +export type { CourseLight } from './models/CourseLight'; +export type { CourseLightRequest } from './models/CourseLightRequest'; +export type { CourseProductRelation } from './models/CourseProductRelation'; +export type { CourseRequest } from './models/CourseRequest'; +export type { CourseRun } from './models/CourseRun'; +export type { CreditCard } from './models/CreditCard'; +export type { CreditCardRequest } from './models/CreditCardRequest'; +export type { DefinitionResourcesProduct } from './models/DefinitionResourcesProduct'; +export type { Enrollment } from './models/Enrollment'; +export type { EnrollmentLight } from './models/EnrollmentLight'; +export type { EnrollmentLightRequest } from './models/EnrollmentLightRequest'; +export type { EnrollmentRequest } from './models/EnrollmentRequest'; +export { EnrollmentStateEnum } from './models/EnrollmentStateEnum'; +export type { ErrorResponse } from './models/ErrorResponse'; +export { LanguageEnum } from './models/LanguageEnum'; +export { LanguagesEnum } from './models/LanguagesEnum'; +export type { NestedOrder } from './models/NestedOrder'; +export type { NestedOrderCourse } from './models/NestedOrderCourse'; +export type { Order } from './models/Order'; +export type { OrderGroup } from './models/OrderGroup'; +export type { OrderRequest } from './models/OrderRequest'; +export { OrderStateEnum } from './models/OrderStateEnum'; +export type { OrderTargetCourseRelation } from './models/OrderTargetCourseRelation'; +export type { Organization } from './models/Organization'; +export type { OrganizationAccess } from './models/OrganizationAccess'; +export type { OrganizationAccessRequest } from './models/OrganizationAccessRequest'; +export { OrganizationAccessRoleChoiceEnum } from './models/OrganizationAccessRoleChoiceEnum'; +export type { OrganizationRequest } from './models/OrganizationRequest'; +export type { PaginatedAddressList } from './models/PaginatedAddressList'; +export type { PaginatedCertificateList } from './models/PaginatedCertificateList'; +export type { PaginatedContractList } from './models/PaginatedContractList'; +export type { PaginatedCourseAccessList } from './models/PaginatedCourseAccessList'; +export type { PaginatedCourseList } from './models/PaginatedCourseList'; +export type { PaginatedCourseProductRelationList } from './models/PaginatedCourseProductRelationList'; +export type { PaginatedCourseRunList } from './models/PaginatedCourseRunList'; +export type { PaginatedCreditCardList } from './models/PaginatedCreditCardList'; +export type { PaginatedEnrollmentList } from './models/PaginatedEnrollmentList'; +export type { PaginatedNestedOrderCourseList } from './models/PaginatedNestedOrderCourseList'; +export type { PaginatedOrderList } from './models/PaginatedOrderList'; +export type { PaginatedOrganizationAccessList } from './models/PaginatedOrganizationAccessList'; +export type { PaginatedOrganizationList } from './models/PaginatedOrganizationList'; +export type { PatchedAddressRequest } from './models/PatchedAddressRequest'; +export type { PatchedCourseAccessRequest } from './models/PatchedCourseAccessRequest'; +export type { PatchedCreditCardRequest } from './models/PatchedCreditCardRequest'; +export type { PatchedEnrollmentRequest } from './models/PatchedEnrollmentRequest'; +export type { PatchedOrderRequest } from './models/PatchedOrderRequest'; +export type { PatchedOrganizationAccessRequest } from './models/PatchedOrganizationAccessRequest'; +export type { Product } from './models/Product'; +export type { ProductTargetCourseRelation } from './models/ProductTargetCourseRelation'; +export { TypeEnum } from './models/TypeEnum'; +export type { User } from './models/User'; +export type { UserLight } from './models/UserLight'; +export type { UserRequest } from './models/UserRequest'; + +export { AddressesService } from './services/AddressesService'; +export { CertificatesService } from './services/CertificatesService'; +export { ContractDefinitionsService } from './services/ContractDefinitionsService'; +export { ContractsService } from './services/ContractsService'; +export { CourseProductRelationsService } from './services/CourseProductRelationsService'; +export { CourseRunsService } from './services/CourseRunsService'; +export { CourseRunsSyncService } from './services/CourseRunsSyncService'; +export { CoursesService } from './services/CoursesService'; +export { CreditCardsService } from './services/CreditCardsService'; +export { EnrollmentsService } from './services/EnrollmentsService'; +export { OrdersService } from './services/OrdersService'; +export { OrganizationsService } from './services/OrganizationsService'; +export { PaymentsService } from './services/PaymentsService'; +export { SignatureService } from './services/SignatureService'; +export { UsersService } from './services/UsersService'; diff --git a/src/frontend/js/api/joanie/gen/models/Address.ts b/src/frontend/js/api/joanie/gen/models/Address.ts new file mode 100644 index 0000000000..c682e0ca53 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/Address.ts @@ -0,0 +1,22 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CountryEnum } from './CountryEnum'; + +/** + * Address model serializer + */ +export type Address = { + address: string; + city: string; + country: CountryEnum; + first_name: string; + last_name: string; + readonly id: string; + is_main?: boolean; + postcode: string; + title: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/AddressRequest.ts b/src/frontend/js/api/joanie/gen/models/AddressRequest.ts new file mode 100644 index 0000000000..666e68011d --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/AddressRequest.ts @@ -0,0 +1,21 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CountryEnum } from './CountryEnum'; + +/** + * Address model serializer + */ +export type AddressRequest = { + address: string; + city: string; + country: CountryEnum; + first_name: string; + last_name: string; + is_main?: boolean; + postcode: string; + title: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/Certificate.ts b/src/frontend/js/api/joanie/gen/models/Certificate.ts new file mode 100644 index 0000000000..251ec8ef4f --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/Certificate.ts @@ -0,0 +1,18 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CertificationDefinition } from './CertificationDefinition'; +import type { NestedOrder } from './NestedOrder'; + +/** + * Certificate model serializer + */ +export type Certificate = { + readonly id: string; + readonly certificate_definition: CertificationDefinition; + readonly issued_on: string; + readonly order: NestedOrder; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/CertificationDefinition.ts b/src/frontend/js/api/joanie/gen/models/CertificationDefinition.ts new file mode 100644 index 0000000000..589345e923 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/CertificationDefinition.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Serialize information about a certificate definition + */ +export type CertificationDefinition = { + readonly description: string; + readonly name: string; + readonly title: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/Contract.ts b/src/frontend/js/api/joanie/gen/models/Contract.ts new file mode 100644 index 0000000000..b4acd1a863 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/Contract.ts @@ -0,0 +1,25 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ContractDefinition } from './ContractDefinition'; +import type { NestedOrder } from './NestedOrder'; +import type { User } from './User'; + +/** + * Serializer for Contract model serializer + */ +export type Contract = { + /** + * date and time at which a record was created + */ + readonly created_on: string; + definition: ContractDefinition; + readonly id: string; + order: NestedOrder; + readonly organization_signatory: User; + readonly organization_signed_on: string | null; + readonly student_signed_on: string | null; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/ContractDefinition.ts b/src/frontend/js/api/joanie/gen/models/ContractDefinition.ts new file mode 100644 index 0000000000..92f604c9bc --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/ContractDefinition.ts @@ -0,0 +1,26 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { LanguageEnum } from './LanguageEnum'; + +/** + * Serializer for ContractDefinition model serializer + */ +export type ContractDefinition = { + /** + * primary key for the record as UUID + */ + readonly id: string; + readonly description: string; + /** + * Language of the contract definition + * + * * `en-us` - English + * * `fr-fr` - French + */ + readonly language: LanguageEnum; + readonly title: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/ContractLight.ts b/src/frontend/js/api/joanie/gen/models/ContractLight.ts new file mode 100644 index 0000000000..57f2af716c --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/ContractLight.ts @@ -0,0 +1,17 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Light serializer for Contract model. + */ +export type ContractLight = { + /** + * primary key for the record as UUID + */ + readonly id: string; + readonly organization_signed_on: string | null; + readonly student_signed_on: string | null; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/CountryEnum.ts b/src/frontend/js/api/joanie/gen/models/CountryEnum.ts new file mode 100644 index 0000000000..fa030c2653 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/CountryEnum.ts @@ -0,0 +1,507 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * * `AF` - Afghanistan + * * `AX` - Åland Islands + * * `AL` - Albania + * * `DZ` - Algeria + * * `AS` - American Samoa + * * `AD` - Andorra + * * `AO` - Angola + * * `AI` - Anguilla + * * `AQ` - Antarctica + * * `AG` - Antigua and Barbuda + * * `AR` - Argentina + * * `AM` - Armenia + * * `AW` - Aruba + * * `AU` - Australia + * * `AT` - Austria + * * `AZ` - Azerbaijan + * * `BS` - Bahamas + * * `BH` - Bahrain + * * `BD` - Bangladesh + * * `BB` - Barbados + * * `BY` - Belarus + * * `BE` - Belgium + * * `BZ` - Belize + * * `BJ` - Benin + * * `BM` - Bermuda + * * `BT` - Bhutan + * * `BO` - Bolivia + * * `BQ` - Bonaire, Sint Eustatius and Saba + * * `BA` - Bosnia and Herzegovina + * * `BW` - Botswana + * * `BV` - Bouvet Island + * * `BR` - Brazil + * * `IO` - British Indian Ocean Territory + * * `BN` - Brunei + * * `BG` - Bulgaria + * * `BF` - Burkina Faso + * * `BI` - Burundi + * * `CV` - Cabo Verde + * * `KH` - Cambodia + * * `CM` - Cameroon + * * `CA` - Canada + * * `KY` - Cayman Islands + * * `CF` - Central African Republic + * * `TD` - Chad + * * `CL` - Chile + * * `CN` - China + * * `CX` - Christmas Island + * * `CC` - Cocos (Keeling) Islands + * * `CO` - Colombia + * * `KM` - Comoros + * * `CG` - Congo + * * `CD` - Congo (the Democratic Republic of the) + * * `CK` - Cook Islands + * * `CR` - Costa Rica + * * `CI` - Côte d'Ivoire + * * `HR` - Croatia + * * `CU` - Cuba + * * `CW` - Curaçao + * * `CY` - Cyprus + * * `CZ` - Czechia + * * `DK` - Denmark + * * `DJ` - Djibouti + * * `DM` - Dominica + * * `DO` - Dominican Republic + * * `EC` - Ecuador + * * `EG` - Egypt + * * `SV` - El Salvador + * * `GQ` - Equatorial Guinea + * * `ER` - Eritrea + * * `EE` - Estonia + * * `SZ` - Eswatini + * * `ET` - Ethiopia + * * `FK` - Falkland Islands (Malvinas) + * * `FO` - Faroe Islands + * * `FJ` - Fiji + * * `FI` - Finland + * * `FR` - France + * * `GF` - French Guiana + * * `PF` - French Polynesia + * * `TF` - French Southern Territories + * * `GA` - Gabon + * * `GM` - Gambia + * * `GE` - Georgia + * * `DE` - Germany + * * `GH` - Ghana + * * `GI` - Gibraltar + * * `GR` - Greece + * * `GL` - Greenland + * * `GD` - Grenada + * * `GP` - Guadeloupe + * * `GU` - Guam + * * `GT` - Guatemala + * * `GG` - Guernsey + * * `GN` - Guinea + * * `GW` - Guinea-Bissau + * * `GY` - Guyana + * * `HT` - Haiti + * * `HM` - Heard Island and McDonald Islands + * * `VA` - Holy See + * * `HN` - Honduras + * * `HK` - Hong Kong + * * `HU` - Hungary + * * `IS` - Iceland + * * `IN` - India + * * `ID` - Indonesia + * * `IR` - Iran + * * `IQ` - Iraq + * * `IE` - Ireland + * * `IM` - Isle of Man + * * `IL` - Israel + * * `IT` - Italy + * * `JM` - Jamaica + * * `JP` - Japan + * * `JE` - Jersey + * * `JO` - Jordan + * * `KZ` - Kazakhstan + * * `KE` - Kenya + * * `KI` - Kiribati + * * `KW` - Kuwait + * * `KG` - Kyrgyzstan + * * `LA` - Laos + * * `LV` - Latvia + * * `LB` - Lebanon + * * `LS` - Lesotho + * * `LR` - Liberia + * * `LY` - Libya + * * `LI` - Liechtenstein + * * `LT` - Lithuania + * * `LU` - Luxembourg + * * `MO` - Macao + * * `MG` - Madagascar + * * `MW` - Malawi + * * `MY` - Malaysia + * * `MV` - Maldives + * * `ML` - Mali + * * `MT` - Malta + * * `MH` - Marshall Islands + * * `MQ` - Martinique + * * `MR` - Mauritania + * * `MU` - Mauritius + * * `YT` - Mayotte + * * `MX` - Mexico + * * `FM` - Micronesia (Federated States of) + * * `MD` - Moldova + * * `MC` - Monaco + * * `MN` - Mongolia + * * `ME` - Montenegro + * * `MS` - Montserrat + * * `MA` - Morocco + * * `MZ` - Mozambique + * * `MM` - Myanmar + * * `NA` - Namibia + * * `NR` - Nauru + * * `NP` - Nepal + * * `NL` - Netherlands + * * `NC` - New Caledonia + * * `NZ` - New Zealand + * * `NI` - Nicaragua + * * `NE` - Niger + * * `NG` - Nigeria + * * `NU` - Niue + * * `NF` - Norfolk Island + * * `KP` - North Korea + * * `MK` - North Macedonia + * * `MP` - Northern Mariana Islands + * * `NO` - Norway + * * `OM` - Oman + * * `PK` - Pakistan + * * `PW` - Palau + * * `PS` - Palestine, State of + * * `PA` - Panama + * * `PG` - Papua New Guinea + * * `PY` - Paraguay + * * `PE` - Peru + * * `PH` - Philippines + * * `PN` - Pitcairn + * * `PL` - Poland + * * `PT` - Portugal + * * `PR` - Puerto Rico + * * `QA` - Qatar + * * `RE` - Réunion + * * `RO` - Romania + * * `RU` - Russia + * * `RW` - Rwanda + * * `BL` - Saint Barthélemy + * * `SH` - Saint Helena, Ascension and Tristan da Cunha + * * `KN` - Saint Kitts and Nevis + * * `LC` - Saint Lucia + * * `MF` - Saint Martin (French part) + * * `PM` - Saint Pierre and Miquelon + * * `VC` - Saint Vincent and the Grenadines + * * `WS` - Samoa + * * `SM` - San Marino + * * `ST` - Sao Tome and Principe + * * `SA` - Saudi Arabia + * * `SN` - Senegal + * * `RS` - Serbia + * * `SC` - Seychelles + * * `SL` - Sierra Leone + * * `SG` - Singapore + * * `SX` - Sint Maarten (Dutch part) + * * `SK` - Slovakia + * * `SI` - Slovenia + * * `SB` - Solomon Islands + * * `SO` - Somalia + * * `ZA` - South Africa + * * `GS` - South Georgia and the South Sandwich Islands + * * `KR` - South Korea + * * `SS` - South Sudan + * * `ES` - Spain + * * `LK` - Sri Lanka + * * `SD` - Sudan + * * `SR` - Suriname + * * `SJ` - Svalbard and Jan Mayen + * * `SE` - Sweden + * * `CH` - Switzerland + * * `SY` - Syria + * * `TW` - Taiwan + * * `TJ` - Tajikistan + * * `TZ` - Tanzania + * * `TH` - Thailand + * * `TL` - Timor-Leste + * * `TG` - Togo + * * `TK` - Tokelau + * * `TO` - Tonga + * * `TT` - Trinidad and Tobago + * * `TN` - Tunisia + * * `TR` - Türkiye + * * `TM` - Turkmenistan + * * `TC` - Turks and Caicos Islands + * * `TV` - Tuvalu + * * `UG` - Uganda + * * `UA` - Ukraine + * * `AE` - United Arab Emirates + * * `GB` - United Kingdom + * * `UM` - United States Minor Outlying Islands + * * `US` - United States of America + * * `UY` - Uruguay + * * `UZ` - Uzbekistan + * * `VU` - Vanuatu + * * `VE` - Venezuela + * * `VN` - Vietnam + * * `VG` - Virgin Islands (British) + * * `VI` - Virgin Islands (U.S.) + * * `WF` - Wallis and Futuna + * * `EH` - Western Sahara + * * `YE` - Yemen + * * `ZM` - Zambia + * * `ZW` - Zimbabwe + */ +export enum CountryEnum { + AF = 'AF', + AX = 'AX', + AL = 'AL', + DZ = 'DZ', + AS = 'AS', + AD = 'AD', + AO = 'AO', + AI = 'AI', + AQ = 'AQ', + AG = 'AG', + AR = 'AR', + AM = 'AM', + AW = 'AW', + AU = 'AU', + AT = 'AT', + AZ = 'AZ', + BS = 'BS', + BH = 'BH', + BD = 'BD', + BB = 'BB', + BY = 'BY', + BE = 'BE', + BZ = 'BZ', + BJ = 'BJ', + BM = 'BM', + BT = 'BT', + BO = 'BO', + BQ = 'BQ', + BA = 'BA', + BW = 'BW', + BV = 'BV', + BR = 'BR', + IO = 'IO', + BN = 'BN', + BG = 'BG', + BF = 'BF', + BI = 'BI', + CV = 'CV', + KH = 'KH', + CM = 'CM', + CA = 'CA', + KY = 'KY', + CF = 'CF', + TD = 'TD', + CL = 'CL', + CN = 'CN', + CX = 'CX', + CC = 'CC', + CO = 'CO', + KM = 'KM', + CG = 'CG', + CD = 'CD', + CK = 'CK', + CR = 'CR', + CI = 'CI', + HR = 'HR', + CU = 'CU', + CW = 'CW', + CY = 'CY', + CZ = 'CZ', + DK = 'DK', + DJ = 'DJ', + DM = 'DM', + DO = 'DO', + EC = 'EC', + EG = 'EG', + SV = 'SV', + GQ = 'GQ', + ER = 'ER', + EE = 'EE', + SZ = 'SZ', + ET = 'ET', + FK = 'FK', + FO = 'FO', + FJ = 'FJ', + FI = 'FI', + FR = 'FR', + GF = 'GF', + PF = 'PF', + TF = 'TF', + GA = 'GA', + GM = 'GM', + GE = 'GE', + DE = 'DE', + GH = 'GH', + GI = 'GI', + GR = 'GR', + GL = 'GL', + GD = 'GD', + GP = 'GP', + GU = 'GU', + GT = 'GT', + GG = 'GG', + GN = 'GN', + GW = 'GW', + GY = 'GY', + HT = 'HT', + HM = 'HM', + VA = 'VA', + HN = 'HN', + HK = 'HK', + HU = 'HU', + IS = 'IS', + IN = 'IN', + ID = 'ID', + IR = 'IR', + IQ = 'IQ', + IE = 'IE', + IM = 'IM', + IL = 'IL', + IT = 'IT', + JM = 'JM', + JP = 'JP', + JE = 'JE', + JO = 'JO', + KZ = 'KZ', + KE = 'KE', + KI = 'KI', + KW = 'KW', + KG = 'KG', + LA = 'LA', + LV = 'LV', + LB = 'LB', + LS = 'LS', + LR = 'LR', + LY = 'LY', + LI = 'LI', + LT = 'LT', + LU = 'LU', + MO = 'MO', + MG = 'MG', + MW = 'MW', + MY = 'MY', + MV = 'MV', + ML = 'ML', + MT = 'MT', + MH = 'MH', + MQ = 'MQ', + MR = 'MR', + MU = 'MU', + YT = 'YT', + MX = 'MX', + FM = 'FM', + MD = 'MD', + MC = 'MC', + MN = 'MN', + ME = 'ME', + MS = 'MS', + MA = 'MA', + MZ = 'MZ', + MM = 'MM', + NA = 'NA', + NR = 'NR', + NP = 'NP', + NL = 'NL', + NC = 'NC', + NZ = 'NZ', + NI = 'NI', + NE = 'NE', + NG = 'NG', + NU = 'NU', + NF = 'NF', + KP = 'KP', + MK = 'MK', + MP = 'MP', + NO = 'NO', + OM = 'OM', + PK = 'PK', + PW = 'PW', + PS = 'PS', + PA = 'PA', + PG = 'PG', + PY = 'PY', + PE = 'PE', + PH = 'PH', + PN = 'PN', + PL = 'PL', + PT = 'PT', + PR = 'PR', + QA = 'QA', + RE = 'RE', + RO = 'RO', + RU = 'RU', + RW = 'RW', + BL = 'BL', + SH = 'SH', + KN = 'KN', + LC = 'LC', + MF = 'MF', + PM = 'PM', + VC = 'VC', + WS = 'WS', + SM = 'SM', + ST = 'ST', + SA = 'SA', + SN = 'SN', + RS = 'RS', + SC = 'SC', + SL = 'SL', + SG = 'SG', + SX = 'SX', + SK = 'SK', + SI = 'SI', + SB = 'SB', + SO = 'SO', + ZA = 'ZA', + GS = 'GS', + KR = 'KR', + SS = 'SS', + ES = 'ES', + LK = 'LK', + SD = 'SD', + SR = 'SR', + SJ = 'SJ', + SE = 'SE', + CH = 'CH', + SY = 'SY', + TW = 'TW', + TJ = 'TJ', + TZ = 'TZ', + TH = 'TH', + TL = 'TL', + TG = 'TG', + TK = 'TK', + TO = 'TO', + TT = 'TT', + TN = 'TN', + TR = 'TR', + TM = 'TM', + TC = 'TC', + TV = 'TV', + UG = 'UG', + UA = 'UA', + AE = 'AE', + GB = 'GB', + UM = 'UM', + US = 'US', + UY = 'UY', + UZ = 'UZ', + VU = 'VU', + VE = 'VE', + VN = 'VN', + VG = 'VG', + VI = 'VI', + WF = 'WF', + EH = 'EH', + YE = 'YE', + ZM = 'ZM', + ZW = 'ZW', +} diff --git a/src/frontend/js/api/joanie/gen/models/Course.ts b/src/frontend/js/api/joanie/gen/models/Course.ts new file mode 100644 index 0000000000..ea1834e163 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/Course.ts @@ -0,0 +1,35 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Organization } from './Organization'; + +/** + * Serialize all non-sensitive course information. This serializer is read only. + */ +export type Course = { + /** + * date and time at which a record was created + */ + readonly created_on: string; + readonly code: string; + readonly course_run_ids: Array; + cover: string; + /** + * primary key for the record as UUID + */ + readonly id: string; + readonly organizations: Array; + readonly product_ids: Array; + /** + * The state of the course carrying information on what to display on a course glimpse. + * + * The game is to find the highest priority state for this course among + * its course runs and its products. + */ + readonly state: string; + readonly title: string; + effort: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/CourseAccess.ts b/src/frontend/js/api/joanie/gen/models/CourseAccess.ts new file mode 100644 index 0000000000..63f9301326 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/CourseAccess.ts @@ -0,0 +1,22 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CourseAccessRoleChoiceEnum } from './CourseAccessRoleChoiceEnum'; + +/** + * Serialize course accesses for the API. + */ +export type CourseAccess = { + /** + * primary key for the record as UUID + */ + readonly id: string; + role?: CourseAccessRoleChoiceEnum; + /** + * primary key for the record as UUID + */ + user_id: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/CourseAccessRequest.ts b/src/frontend/js/api/joanie/gen/models/CourseAccessRequest.ts new file mode 100644 index 0000000000..80eb44457b --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/CourseAccessRequest.ts @@ -0,0 +1,18 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CourseAccessRoleChoiceEnum } from './CourseAccessRoleChoiceEnum'; + +/** + * Serialize course accesses for the API. + */ +export type CourseAccessRequest = { + role?: CourseAccessRoleChoiceEnum; + /** + * primary key for the record as UUID + */ + user_id: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/CourseAccessRoleChoiceEnum.ts b/src/frontend/js/api/joanie/gen/models/CourseAccessRoleChoiceEnum.ts new file mode 100644 index 0000000000..13bd786e6a --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/CourseAccessRoleChoiceEnum.ts @@ -0,0 +1,17 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * * `owner` - owner + * * `administrator` - administrator + * * `instructor` - instructor + * * `manager` - manager + */ +export enum CourseAccessRoleChoiceEnum { + OWNER = 'owner', + ADMINISTRATOR = 'administrator', + INSTRUCTOR = 'instructor', + MANAGER = 'manager', +} diff --git a/src/frontend/js/api/joanie/gen/models/CourseLight.ts b/src/frontend/js/api/joanie/gen/models/CourseLight.ts new file mode 100644 index 0000000000..63366592c6 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/CourseLight.ts @@ -0,0 +1,18 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Serialize all non-sensitive course information. This serializer is read only. + */ +export type CourseLight = { + readonly code: string; + cover: string; + /** + * primary key for the record as UUID + */ + readonly id: string; + readonly title: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/CourseLightRequest.ts b/src/frontend/js/api/joanie/gen/models/CourseLightRequest.ts new file mode 100644 index 0000000000..878ba106a3 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/CourseLightRequest.ts @@ -0,0 +1,12 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Serialize all non-sensitive course information. This serializer is read only. + */ +export type CourseLightRequest = { + cover: Blob; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/CourseProductRelation.ts b/src/frontend/js/api/joanie/gen/models/CourseProductRelation.ts new file mode 100644 index 0000000000..dcad958320 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/CourseProductRelation.ts @@ -0,0 +1,28 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CourseLight } from './CourseLight'; +import type { OrderGroup } from './OrderGroup'; +import type { Organization } from './Organization'; +import type { Product } from './Product'; + +/** + * Serialize a course product relation. + */ +export type CourseProductRelation = { + readonly course: CourseLight; + /** + * date and time at which a record was created + */ + readonly created_on: string; + /** + * primary key for the record as UUID + */ + readonly id: string; + readonly order_groups: Array; + readonly organizations: Array; + readonly product: Product; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/CourseRequest.ts b/src/frontend/js/api/joanie/gen/models/CourseRequest.ts new file mode 100644 index 0000000000..b089275bc4 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/CourseRequest.ts @@ -0,0 +1,13 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Serialize all non-sensitive course information. This serializer is read only. + */ +export type CourseRequest = { + cover: Blob; + effort: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/CourseRun.ts b/src/frontend/js/api/joanie/gen/models/CourseRun.ts new file mode 100644 index 0000000000..ed83c6eeff --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/CourseRun.ts @@ -0,0 +1,137 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CourseLight } from './CourseLight'; +import type { LanguagesEnum } from './LanguagesEnum'; + +/** + * Serialize all information about a course run + */ +export type CourseRun = { + readonly course: CourseLight; + readonly end: string | null; + readonly enrollment_end: string | null; + readonly enrollment_start: string | null; + /** + * primary key for the record as UUID + */ + readonly id: string; + /** + * The list of languages in which the course content is available. + * + * * `af` - Afrikaans + * * `ar` - Arabic + * * `ar-dz` - Algerian Arabic + * * `ast` - Asturian + * * `az` - Azerbaijani + * * `bg` - Bulgarian + * * `be` - Belarusian + * * `bn` - Bengali + * * `br` - Breton + * * `bs` - Bosnian + * * `ca` - Catalan + * * `ckb` - Central Kurdish (Sorani) + * * `cs` - Czech + * * `cy` - Welsh + * * `da` - Danish + * * `de` - German + * * `dsb` - Lower Sorbian + * * `el` - Greek + * * `en` - English + * * `en-au` - Australian English + * * `en-gb` - British English + * * `eo` - Esperanto + * * `es` - Spanish + * * `es-ar` - Argentinian Spanish + * * `es-co` - Colombian Spanish + * * `es-mx` - Mexican Spanish + * * `es-ni` - Nicaraguan Spanish + * * `es-ve` - Venezuelan Spanish + * * `et` - Estonian + * * `eu` - Basque + * * `fa` - Persian + * * `fi` - Finnish + * * `fr` - French + * * `fy` - Frisian + * * `ga` - Irish + * * `gd` - Scottish Gaelic + * * `gl` - Galician + * * `he` - Hebrew + * * `hi` - Hindi + * * `hr` - Croatian + * * `hsb` - Upper Sorbian + * * `hu` - Hungarian + * * `hy` - Armenian + * * `ia` - Interlingua + * * `id` - Indonesian + * * `ig` - Igbo + * * `io` - Ido + * * `is` - Icelandic + * * `it` - Italian + * * `ja` - Japanese + * * `ka` - Georgian + * * `kab` - Kabyle + * * `kk` - Kazakh + * * `km` - Khmer + * * `kn` - Kannada + * * `ko` - Korean + * * `ky` - Kyrgyz + * * `lb` - Luxembourgish + * * `lt` - Lithuanian + * * `lv` - Latvian + * * `mk` - Macedonian + * * `ml` - Malayalam + * * `mn` - Mongolian + * * `mr` - Marathi + * * `ms` - Malay + * * `my` - Burmese + * * `nb` - Norwegian Bokmål + * * `ne` - Nepali + * * `nl` - Dutch + * * `nn` - Norwegian Nynorsk + * * `os` - Ossetic + * * `pa` - Punjabi + * * `pl` - Polish + * * `pt` - Portuguese + * * `pt-br` - Brazilian Portuguese + * * `ro` - Romanian + * * `ru` - Russian + * * `sk` - Slovak + * * `sl` - Slovenian + * * `sq` - Albanian + * * `sr` - Serbian + * * `sr-latn` - Serbian Latin + * * `sv` - Swedish + * * `sw` - Swahili + * * `ta` - Tamil + * * `te` - Telugu + * * `tg` - Tajik + * * `th` - Thai + * * `tk` - Turkmen + * * `tr` - Turkish + * * `tt` - Tatar + * * `udm` - Udmurt + * * `uk` - Ukrainian + * * `ur` - Urdu + * * `uz` - Uzbek + * * `vi` - Vietnamese + * * `zh-hans` - Simplified Chinese + * * `zh-hant` - Traditional Chinese + */ + readonly languages: LanguagesEnum; + readonly resource_link: string; + readonly start: string | null; + readonly title: string; + /** + * Return the state of the course run at the current time. + */ + readonly state: { + priority: number; + datetime: string | null; + call_to_action: string | null; + text: string; + }; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/CreditCard.ts b/src/frontend/js/api/joanie/gen/models/CreditCard.ts new file mode 100644 index 0000000000..5d57f59f7a --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/CreditCard.ts @@ -0,0 +1,18 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * CreditCard Serializer + */ +export type CreditCard = { + readonly id: string; + title?: string | null; + readonly brand: string | null; + readonly expiration_month: number; + readonly expiration_year: number; + readonly last_numbers: string; + is_main?: boolean; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/CreditCardRequest.ts b/src/frontend/js/api/joanie/gen/models/CreditCardRequest.ts new file mode 100644 index 0000000000..9cf35328a7 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/CreditCardRequest.ts @@ -0,0 +1,13 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * CreditCard Serializer + */ +export type CreditCardRequest = { + title?: string | null; + is_main?: boolean; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/DefinitionResourcesProduct.ts b/src/frontend/js/api/joanie/gen/models/DefinitionResourcesProduct.ts new file mode 100644 index 0000000000..c55e6fd8b2 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/DefinitionResourcesProduct.ts @@ -0,0 +1,24 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * A serializer for product model which only bind the related + * definition resources. + */ +export type DefinitionResourcesProduct = { + /** + * primary key for the record as UUID + */ + readonly id: string; + /** + * primary key for the record as UUID + */ + readonly contract_definition_id: string; + /** + * primary key for the record as UUID + */ + readonly certificate_definition_id: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/Enrollment.ts b/src/frontend/js/api/joanie/gen/models/Enrollment.ts new file mode 100644 index 0000000000..2527387619 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/Enrollment.ts @@ -0,0 +1,38 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CourseRun } from './CourseRun'; +import type { EnrollmentStateEnum } from './EnrollmentStateEnum'; + +/** + * Enrollment model serializer + */ +export type Enrollment = { + readonly id: string; + /** + * primary key for the record as UUID + */ + readonly certificate_id: string; + readonly course_run: CourseRun; + /** + * date and time at which a record was created + */ + readonly created_on: string; + /** + * Ticked if the user is enrolled to the course run. + */ + is_active: boolean; + /** + * Get orders pointing to the enrollment. + */ + readonly orders: Array>; + /** + * Get products related to the enrollment's course run. + */ + readonly product_relations: Array>; + readonly state: EnrollmentStateEnum; + was_created_by_order: boolean; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/EnrollmentLight.ts b/src/frontend/js/api/joanie/gen/models/EnrollmentLight.ts new file mode 100644 index 0000000000..eebe732dd0 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/EnrollmentLight.ts @@ -0,0 +1,26 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CourseRun } from './CourseRun'; +import type { EnrollmentStateEnum } from './EnrollmentStateEnum'; + +/** + * Enrollment model light serializer + */ +export type EnrollmentLight = { + readonly id: string; + readonly course_run: CourseRun; + /** + * date and time at which a record was created + */ + readonly created_on: string; + /** + * Ticked if the user is enrolled to the course run. + */ + readonly is_active: boolean; + readonly state: EnrollmentStateEnum; + was_created_by_order: boolean; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/EnrollmentLightRequest.ts b/src/frontend/js/api/joanie/gen/models/EnrollmentLightRequest.ts new file mode 100644 index 0000000000..c063ae1618 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/EnrollmentLightRequest.ts @@ -0,0 +1,12 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Enrollment model light serializer + */ +export type EnrollmentLightRequest = { + was_created_by_order: boolean; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/EnrollmentRequest.ts b/src/frontend/js/api/joanie/gen/models/EnrollmentRequest.ts new file mode 100644 index 0000000000..98632a42ab --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/EnrollmentRequest.ts @@ -0,0 +1,16 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Enrollment model serializer + */ +export type EnrollmentRequest = { + /** + * Ticked if the user is enrolled to the course run. + */ + is_active: boolean; + was_created_by_order: boolean; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/EnrollmentStateEnum.ts b/src/frontend/js/api/joanie/gen/models/EnrollmentStateEnum.ts new file mode 100644 index 0000000000..9426e98a9d --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/EnrollmentStateEnum.ts @@ -0,0 +1,13 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * * `set` - Set + * * `failed` - Failed + */ +export enum EnrollmentStateEnum { + SET = 'set', + FAILED = 'failed', +} diff --git a/src/frontend/js/api/joanie/gen/models/ErrorResponse.ts b/src/frontend/js/api/joanie/gen/models/ErrorResponse.ts new file mode 100644 index 0000000000..d5114aad32 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/ErrorResponse.ts @@ -0,0 +1,12 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Serializer used to format error responses. + */ +export type ErrorResponse = { + details: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/LanguageEnum.ts b/src/frontend/js/api/joanie/gen/models/LanguageEnum.ts new file mode 100644 index 0000000000..cd8e63901f --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/LanguageEnum.ts @@ -0,0 +1,13 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * * `en-us` - English + * * `fr-fr` - French + */ +export enum LanguageEnum { + EN_US = 'en-us', + FR_FR = 'fr-fr', +} diff --git a/src/frontend/js/api/joanie/gen/models/LanguagesEnum.ts b/src/frontend/js/api/joanie/gen/models/LanguagesEnum.ts new file mode 100644 index 0000000000..d59225b9e6 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/LanguagesEnum.ts @@ -0,0 +1,205 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * * `af` - Afrikaans + * * `ar` - Arabic + * * `ar-dz` - Algerian Arabic + * * `ast` - Asturian + * * `az` - Azerbaijani + * * `bg` - Bulgarian + * * `be` - Belarusian + * * `bn` - Bengali + * * `br` - Breton + * * `bs` - Bosnian + * * `ca` - Catalan + * * `ckb` - Central Kurdish (Sorani) + * * `cs` - Czech + * * `cy` - Welsh + * * `da` - Danish + * * `de` - German + * * `dsb` - Lower Sorbian + * * `el` - Greek + * * `en` - English + * * `en-au` - Australian English + * * `en-gb` - British English + * * `eo` - Esperanto + * * `es` - Spanish + * * `es-ar` - Argentinian Spanish + * * `es-co` - Colombian Spanish + * * `es-mx` - Mexican Spanish + * * `es-ni` - Nicaraguan Spanish + * * `es-ve` - Venezuelan Spanish + * * `et` - Estonian + * * `eu` - Basque + * * `fa` - Persian + * * `fi` - Finnish + * * `fr` - French + * * `fy` - Frisian + * * `ga` - Irish + * * `gd` - Scottish Gaelic + * * `gl` - Galician + * * `he` - Hebrew + * * `hi` - Hindi + * * `hr` - Croatian + * * `hsb` - Upper Sorbian + * * `hu` - Hungarian + * * `hy` - Armenian + * * `ia` - Interlingua + * * `id` - Indonesian + * * `ig` - Igbo + * * `io` - Ido + * * `is` - Icelandic + * * `it` - Italian + * * `ja` - Japanese + * * `ka` - Georgian + * * `kab` - Kabyle + * * `kk` - Kazakh + * * `km` - Khmer + * * `kn` - Kannada + * * `ko` - Korean + * * `ky` - Kyrgyz + * * `lb` - Luxembourgish + * * `lt` - Lithuanian + * * `lv` - Latvian + * * `mk` - Macedonian + * * `ml` - Malayalam + * * `mn` - Mongolian + * * `mr` - Marathi + * * `ms` - Malay + * * `my` - Burmese + * * `nb` - Norwegian Bokmål + * * `ne` - Nepali + * * `nl` - Dutch + * * `nn` - Norwegian Nynorsk + * * `os` - Ossetic + * * `pa` - Punjabi + * * `pl` - Polish + * * `pt` - Portuguese + * * `pt-br` - Brazilian Portuguese + * * `ro` - Romanian + * * `ru` - Russian + * * `sk` - Slovak + * * `sl` - Slovenian + * * `sq` - Albanian + * * `sr` - Serbian + * * `sr-latn` - Serbian Latin + * * `sv` - Swedish + * * `sw` - Swahili + * * `ta` - Tamil + * * `te` - Telugu + * * `tg` - Tajik + * * `th` - Thai + * * `tk` - Turkmen + * * `tr` - Turkish + * * `tt` - Tatar + * * `udm` - Udmurt + * * `uk` - Ukrainian + * * `ur` - Urdu + * * `uz` - Uzbek + * * `vi` - Vietnamese + * * `zh-hans` - Simplified Chinese + * * `zh-hant` - Traditional Chinese + */ +export enum LanguagesEnum { + AF = 'af', + AR = 'ar', + AR_DZ = 'ar-dz', + AST = 'ast', + AZ = 'az', + BG = 'bg', + BE = 'be', + BN = 'bn', + BR = 'br', + BS = 'bs', + CA = 'ca', + CKB = 'ckb', + CS = 'cs', + CY = 'cy', + DA = 'da', + DE = 'de', + DSB = 'dsb', + EL = 'el', + EN = 'en', + EN_AU = 'en-au', + EN_GB = 'en-gb', + EO = 'eo', + ES = 'es', + ES_AR = 'es-ar', + ES_CO = 'es-co', + ES_MX = 'es-mx', + ES_NI = 'es-ni', + ES_VE = 'es-ve', + ET = 'et', + EU = 'eu', + FA = 'fa', + FI = 'fi', + FR = 'fr', + FY = 'fy', + GA = 'ga', + GD = 'gd', + GL = 'gl', + HE = 'he', + HI = 'hi', + HR = 'hr', + HSB = 'hsb', + HU = 'hu', + HY = 'hy', + IA = 'ia', + ID = 'id', + IG = 'ig', + IO = 'io', + IS = 'is', + IT = 'it', + JA = 'ja', + KA = 'ka', + KAB = 'kab', + KK = 'kk', + KM = 'km', + KN = 'kn', + KO = 'ko', + KY = 'ky', + LB = 'lb', + LT = 'lt', + LV = 'lv', + MK = 'mk', + ML = 'ml', + MN = 'mn', + MR = 'mr', + MS = 'ms', + MY = 'my', + NB = 'nb', + NE = 'ne', + NL = 'nl', + NN = 'nn', + OS = 'os', + PA = 'pa', + PL = 'pl', + PT = 'pt', + PT_BR = 'pt-br', + RO = 'ro', + RU = 'ru', + SK = 'sk', + SL = 'sl', + SQ = 'sq', + SR = 'sr', + SR_LATN = 'sr-latn', + SV = 'sv', + SW = 'sw', + TA = 'ta', + TE = 'te', + TG = 'tg', + TH = 'th', + TK = 'tk', + TR = 'tr', + TT = 'tt', + UDM = 'udm', + UK = 'uk', + UR = 'ur', + UZ = 'uz', + VI = 'vi', + ZH_HANS = 'zh-hans', + ZH_HANT = 'zh-hant', +} diff --git a/src/frontend/js/api/joanie/gen/models/NestedOrder.ts b/src/frontend/js/api/joanie/gen/models/NestedOrder.ts new file mode 100644 index 0000000000..b0f8ca00de --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/NestedOrder.ts @@ -0,0 +1,24 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CourseLight } from './CourseLight'; +import type { EnrollmentLight } from './EnrollmentLight'; +import type { Organization } from './Organization'; + +/** + * Order model serializer for the Certificate model + */ +export type NestedOrder = { + readonly id: string; + readonly course: CourseLight; + readonly enrollment: EnrollmentLight; + readonly organization: Organization; + /** + * Return the name full name of the order's owner or fallback to username + */ + readonly owner_name: string; + readonly product_title: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/NestedOrderCourse.ts b/src/frontend/js/api/joanie/gen/models/NestedOrderCourse.ts new file mode 100644 index 0000000000..5ecf8054f0 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/NestedOrderCourse.ts @@ -0,0 +1,39 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ContractLight } from './ContractLight'; +import type { DefinitionResourcesProduct } from './DefinitionResourcesProduct'; +import type { OrderStateEnum } from './OrderStateEnum'; +import type { Organization } from './Organization'; +import type { UserLight } from './UserLight'; + +/** + * Serializer for orders made on courses. + */ +export type NestedOrderCourse = { + /** + * primary key for the record as UUID + */ + readonly certificate_id: string; + readonly contract: ContractLight; + /** + * primary key for the record as UUID + */ + readonly course_id: string; + /** + * date and time at which a record was created + */ + readonly created_on: string; + /** + * primary key for the record as UUID + */ + readonly enrollment_id: string; + readonly id: string; + readonly organization: Organization; + readonly owner: UserLight; + readonly product: DefinitionResourcesProduct; + readonly state: OrderStateEnum; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/Order.ts b/src/frontend/js/api/joanie/gen/models/Order.ts new file mode 100644 index 0000000000..9e0507693f --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/Order.ts @@ -0,0 +1,52 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Contract } from './Contract'; +import type { CourseLight } from './CourseLight'; +import type { EnrollmentLight } from './EnrollmentLight'; +import type { OrderStateEnum } from './OrderStateEnum'; +import type { OrderTargetCourseRelation } from './OrderTargetCourseRelation'; +import type { Organization } from './Organization'; + +/** + * Order model serializer + */ +export type Order = { + /** + * primary key for the record as UUID + */ + readonly certificate_id: string; + readonly contract: Contract; + readonly course: CourseLight; + /** + * date and time at which a record was created + */ + readonly created_on: string; + readonly enrollment: EnrollmentLight; + readonly id: string; + readonly main_invoice_reference: string; + /** + * primary key for the record as UUID + */ + order_group_id?: string; + readonly organization: Organization; + readonly owner: string; + /** + * primary key for the record as UUID + */ + product_id: string; + readonly state: OrderStateEnum; + readonly target_courses: Array; + /** + * For the current order, retrieve its related enrollments. + */ + readonly target_enrollments: Array>; + readonly total: number; + /** + * Return the currency used + */ + readonly total_currency: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/OrderGroup.ts b/src/frontend/js/api/joanie/gen/models/OrderGroup.ts new file mode 100644 index 0000000000..6963420a9a --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/OrderGroup.ts @@ -0,0 +1,24 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Serializer for order groups in a product. + */ +export type OrderGroup = { + /** + * primary key for the record as UUID + */ + readonly id: string; + readonly is_active: boolean; + /** + * The maximum number of orders that can be validated for a given order group + */ + readonly nb_seats: number; + /** + * Return the number of available seats for this order group. + */ + readonly nb_available_seats: number; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/OrderRequest.ts b/src/frontend/js/api/joanie/gen/models/OrderRequest.ts new file mode 100644 index 0000000000..564fca82ad --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/OrderRequest.ts @@ -0,0 +1,20 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Order model serializer + */ +export type OrderRequest = { + /** + * primary key for the record as UUID + */ + order_group_id?: string; + /** + * primary key for the record as UUID + */ + product_id: string; + has_consent_to_terms: boolean; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/OrderStateEnum.ts b/src/frontend/js/api/joanie/gen/models/OrderStateEnum.ts new file mode 100644 index 0000000000..92800f02ef --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/OrderStateEnum.ts @@ -0,0 +1,19 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * * `draft` - Draft + * * `submitted` - Submitted + * * `pending` - Pending + * * `canceled` - Canceled + * * `validated` - Validated + */ +export enum OrderStateEnum { + DRAFT = 'draft', + SUBMITTED = 'submitted', + PENDING = 'pending', + CANCELED = 'canceled', + VALIDATED = 'validated', +} diff --git a/src/frontend/js/api/joanie/gen/models/OrderTargetCourseRelation.ts b/src/frontend/js/api/joanie/gen/models/OrderTargetCourseRelation.ts new file mode 100644 index 0000000000..b850e9e344 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/OrderTargetCourseRelation.ts @@ -0,0 +1,25 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Serializer for OrderTargetCourseRelation model + */ +export type OrderTargetCourseRelation = { + /** + * Return the code of the targeted course + */ + readonly code: string; + /** + * Return all course runs targeted by the order. + */ + readonly course_runs: Array>; + readonly is_graded: boolean; + readonly position: number; + /** + * Return the title of the targeted course + */ + readonly title: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/Organization.ts b/src/frontend/js/api/joanie/gen/models/Organization.ts new file mode 100644 index 0000000000..b72e9cd3d7 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/Organization.ts @@ -0,0 +1,26 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Address } from './Address'; + +/** + * Serialize all non-sensitive information about an organization + */ +export type Organization = { + /** + * primary key for the record as UUID + */ + readonly id: string; + readonly code: string; + logo: string | null; + readonly title: string; + readonly address: Address | null; + readonly enterprise_code: string | null; + readonly activity_category_code: string; + readonly contact_phone: string; + readonly contact_email: string; + readonly dpo_email: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/OrganizationAccess.ts b/src/frontend/js/api/joanie/gen/models/OrganizationAccess.ts new file mode 100644 index 0000000000..53eca2336a --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/OrganizationAccess.ts @@ -0,0 +1,22 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { OrganizationAccessRoleChoiceEnum } from './OrganizationAccessRoleChoiceEnum'; + +/** + * Serialize Organization accesses for the API. + */ +export type OrganizationAccess = { + /** + * primary key for the record as UUID + */ + readonly id: string; + role?: OrganizationAccessRoleChoiceEnum; + /** + * primary key for the record as UUID + */ + user_id: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/OrganizationAccessRequest.ts b/src/frontend/js/api/joanie/gen/models/OrganizationAccessRequest.ts new file mode 100644 index 0000000000..08d1694675 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/OrganizationAccessRequest.ts @@ -0,0 +1,18 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { OrganizationAccessRoleChoiceEnum } from './OrganizationAccessRoleChoiceEnum'; + +/** + * Serialize Organization accesses for the API. + */ +export type OrganizationAccessRequest = { + role?: OrganizationAccessRoleChoiceEnum; + /** + * primary key for the record as UUID + */ + user_id: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/OrganizationAccessRoleChoiceEnum.ts b/src/frontend/js/api/joanie/gen/models/OrganizationAccessRoleChoiceEnum.ts new file mode 100644 index 0000000000..c893f3b24d --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/OrganizationAccessRoleChoiceEnum.ts @@ -0,0 +1,15 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * * `owner` - owner + * * `administrator` - administrator + * * `member` - member + */ +export enum OrganizationAccessRoleChoiceEnum { + OWNER = 'owner', + ADMINISTRATOR = 'administrator', + MEMBER = 'member', +} diff --git a/src/frontend/js/api/joanie/gen/models/OrganizationRequest.ts b/src/frontend/js/api/joanie/gen/models/OrganizationRequest.ts new file mode 100644 index 0000000000..0a8999962a --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/OrganizationRequest.ts @@ -0,0 +1,12 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Serialize all non-sensitive information about an organization + */ +export type OrganizationRequest = { + logo: Blob | null; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PaginatedAddressList.ts b/src/frontend/js/api/joanie/gen/models/PaginatedAddressList.ts new file mode 100644 index 0000000000..6eb7b954fd --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PaginatedAddressList.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Address } from './Address'; + +export type PaginatedAddressList = { + count?: number; + next?: string | null; + previous?: string | null; + results?: Array
; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PaginatedCertificateList.ts b/src/frontend/js/api/joanie/gen/models/PaginatedCertificateList.ts new file mode 100644 index 0000000000..e7b4ca4781 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PaginatedCertificateList.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Certificate } from './Certificate'; + +export type PaginatedCertificateList = { + count?: number; + next?: string | null; + previous?: string | null; + results?: Array; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PaginatedContractList.ts b/src/frontend/js/api/joanie/gen/models/PaginatedContractList.ts new file mode 100644 index 0000000000..fda59138bc --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PaginatedContractList.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Contract } from './Contract'; + +export type PaginatedContractList = { + count?: number; + next?: string | null; + previous?: string | null; + results?: Array; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PaginatedCourseAccessList.ts b/src/frontend/js/api/joanie/gen/models/PaginatedCourseAccessList.ts new file mode 100644 index 0000000000..c737c7b290 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PaginatedCourseAccessList.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CourseAccess } from './CourseAccess'; + +export type PaginatedCourseAccessList = { + count?: number; + next?: string | null; + previous?: string | null; + results?: Array; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PaginatedCourseList.ts b/src/frontend/js/api/joanie/gen/models/PaginatedCourseList.ts new file mode 100644 index 0000000000..3a9e24b0c6 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PaginatedCourseList.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Course } from './Course'; + +export type PaginatedCourseList = { + count?: number; + next?: string | null; + previous?: string | null; + results?: Array; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PaginatedCourseProductRelationList.ts b/src/frontend/js/api/joanie/gen/models/PaginatedCourseProductRelationList.ts new file mode 100644 index 0000000000..eb4d8cc2dc --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PaginatedCourseProductRelationList.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CourseProductRelation } from './CourseProductRelation'; + +export type PaginatedCourseProductRelationList = { + count?: number; + next?: string | null; + previous?: string | null; + results?: Array; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PaginatedCourseRunList.ts b/src/frontend/js/api/joanie/gen/models/PaginatedCourseRunList.ts new file mode 100644 index 0000000000..2c1d0c5f79 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PaginatedCourseRunList.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CourseRun } from './CourseRun'; + +export type PaginatedCourseRunList = { + count?: number; + next?: string | null; + previous?: string | null; + results?: Array; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PaginatedCreditCardList.ts b/src/frontend/js/api/joanie/gen/models/PaginatedCreditCardList.ts new file mode 100644 index 0000000000..e93ea1cc4a --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PaginatedCreditCardList.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CreditCard } from './CreditCard'; + +export type PaginatedCreditCardList = { + count?: number; + next?: string | null; + previous?: string | null; + results?: Array; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PaginatedEnrollmentList.ts b/src/frontend/js/api/joanie/gen/models/PaginatedEnrollmentList.ts new file mode 100644 index 0000000000..83e6000a0d --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PaginatedEnrollmentList.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Enrollment } from './Enrollment'; + +export type PaginatedEnrollmentList = { + count?: number; + next?: string | null; + previous?: string | null; + results?: Array; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PaginatedNestedOrderCourseList.ts b/src/frontend/js/api/joanie/gen/models/PaginatedNestedOrderCourseList.ts new file mode 100644 index 0000000000..624a29668c --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PaginatedNestedOrderCourseList.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { NestedOrderCourse } from './NestedOrderCourse'; + +export type PaginatedNestedOrderCourseList = { + count?: number; + next?: string | null; + previous?: string | null; + results?: Array; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PaginatedOrderList.ts b/src/frontend/js/api/joanie/gen/models/PaginatedOrderList.ts new file mode 100644 index 0000000000..97e9113579 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PaginatedOrderList.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Order } from './Order'; + +export type PaginatedOrderList = { + count?: number; + next?: string | null; + previous?: string | null; + results?: Array; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PaginatedOrganizationAccessList.ts b/src/frontend/js/api/joanie/gen/models/PaginatedOrganizationAccessList.ts new file mode 100644 index 0000000000..29dcc53ac2 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PaginatedOrganizationAccessList.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { OrganizationAccess } from './OrganizationAccess'; + +export type PaginatedOrganizationAccessList = { + count?: number; + next?: string | null; + previous?: string | null; + results?: Array; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PaginatedOrganizationList.ts b/src/frontend/js/api/joanie/gen/models/PaginatedOrganizationList.ts new file mode 100644 index 0000000000..b57f64bd04 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PaginatedOrganizationList.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Organization } from './Organization'; + +export type PaginatedOrganizationList = { + count?: number; + next?: string | null; + previous?: string | null; + results?: Array; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PatchedAddressRequest.ts b/src/frontend/js/api/joanie/gen/models/PatchedAddressRequest.ts new file mode 100644 index 0000000000..3a618493e5 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PatchedAddressRequest.ts @@ -0,0 +1,21 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CountryEnum } from './CountryEnum'; + +/** + * Address model serializer + */ +export type PatchedAddressRequest = { + address?: string; + city?: string; + country?: CountryEnum; + first_name?: string; + last_name?: string; + is_main?: boolean; + postcode?: string; + title?: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PatchedCourseAccessRequest.ts b/src/frontend/js/api/joanie/gen/models/PatchedCourseAccessRequest.ts new file mode 100644 index 0000000000..c068b8858f --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PatchedCourseAccessRequest.ts @@ -0,0 +1,18 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CourseAccessRoleChoiceEnum } from './CourseAccessRoleChoiceEnum'; + +/** + * Serialize course accesses for the API. + */ +export type PatchedCourseAccessRequest = { + role?: CourseAccessRoleChoiceEnum; + /** + * primary key for the record as UUID + */ + user_id?: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PatchedCreditCardRequest.ts b/src/frontend/js/api/joanie/gen/models/PatchedCreditCardRequest.ts new file mode 100644 index 0000000000..9a39e35ce6 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PatchedCreditCardRequest.ts @@ -0,0 +1,13 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * CreditCard Serializer + */ +export type PatchedCreditCardRequest = { + title?: string | null; + is_main?: boolean; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PatchedEnrollmentRequest.ts b/src/frontend/js/api/joanie/gen/models/PatchedEnrollmentRequest.ts new file mode 100644 index 0000000000..c68639ffce --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PatchedEnrollmentRequest.ts @@ -0,0 +1,16 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Enrollment model serializer + */ +export type PatchedEnrollmentRequest = { + /** + * Ticked if the user is enrolled to the course run. + */ + is_active?: boolean; + was_created_by_order?: boolean; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PatchedOrderRequest.ts b/src/frontend/js/api/joanie/gen/models/PatchedOrderRequest.ts new file mode 100644 index 0000000000..7718d477c5 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PatchedOrderRequest.ts @@ -0,0 +1,20 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Order model serializer + */ +export type PatchedOrderRequest = { + /** + * primary key for the record as UUID + */ + order_group_id?: string; + /** + * primary key for the record as UUID + */ + product_id?: string; + has_consent_to_terms?: boolean; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/PatchedOrganizationAccessRequest.ts b/src/frontend/js/api/joanie/gen/models/PatchedOrganizationAccessRequest.ts new file mode 100644 index 0000000000..114648ab94 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/PatchedOrganizationAccessRequest.ts @@ -0,0 +1,18 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { OrganizationAccessRoleChoiceEnum } from './OrganizationAccessRoleChoiceEnum'; + +/** + * Serialize Organization accesses for the API. + */ +export type PatchedOrganizationAccessRequest = { + role?: OrganizationAccessRoleChoiceEnum; + /** + * primary key for the record as UUID + */ + user_id?: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/Product.ts b/src/frontend/js/api/joanie/gen/models/Product.ts new file mode 100644 index 0000000000..e51cd3e52e --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/Product.ts @@ -0,0 +1,42 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CertificationDefinition } from './CertificationDefinition'; +import type { ContractDefinition } from './ContractDefinition'; +import type { ProductTargetCourseRelation } from './ProductTargetCourseRelation'; +import type { TypeEnum } from './TypeEnum'; + +/** + * Product serializer including + * - certificate definition information if there is + * - contract definition information if there is + * - targeted courses with its course runs + * - If user is authenticated, we try to retrieve enrollment related + * to each course run. + * - order if user is authenticated + */ +export type Product = { + readonly call_to_action: string; + readonly certificate_definition: CertificationDefinition; + readonly contract_definition: ContractDefinition; + readonly id: string; + /** + * Return the instruction of the instance in html format. + */ + readonly instructions: string; + readonly price: number; + /** + * Return the code of currency used by the instance + */ + readonly price_currency: string; + /** + * Process the state of the product based on its equivalent course run dates. + */ + readonly state: string; + readonly target_courses: Array; + readonly title: string; + readonly type: TypeEnum; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/ProductTargetCourseRelation.ts b/src/frontend/js/api/joanie/gen/models/ProductTargetCourseRelation.ts new file mode 100644 index 0000000000..2e2afff73f --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/ProductTargetCourseRelation.ts @@ -0,0 +1,25 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Serializer for ProductTargetCourseRelation model + */ +export type ProductTargetCourseRelation = { + /** + * Return the code of the targeted course + */ + readonly code: string; + /** + * Return all course runs for courses targeted by the product. + */ + readonly course_runs: Array>; + readonly is_graded: boolean; + readonly position: number; + /** + * Return the title of the targeted course + */ + readonly title: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/TypeEnum.ts b/src/frontend/js/api/joanie/gen/models/TypeEnum.ts new file mode 100644 index 0000000000..e014a39e2f --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/TypeEnum.ts @@ -0,0 +1,15 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * * `credential` - Credential + * * `enrollment` - Enrollment + * * `certificate` - Certificate + */ +export enum TypeEnum { + CREDENTIAL = 'credential', + ENROLLMENT = 'enrollment', + CERTIFICATE = 'certificate', +} diff --git a/src/frontend/js/api/joanie/gen/models/User.ts b/src/frontend/js/api/joanie/gen/models/User.ts new file mode 100644 index 0000000000..aeaff54b28 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/User.ts @@ -0,0 +1,32 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Serializer for User model. + */ +export type User = { + /** + * primary key for the record as UUID + */ + readonly id: string; + /** + * Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. + */ + readonly username: string; + full_name: string; + /** + * Designates that this user has all permissions without explicitly assigning them. + */ + readonly is_superuser: boolean; + /** + * Designates whether the user can log into this admin site. + */ + readonly is_staff: boolean; + /** + * Return abilities of the logged-in user on itself. + */ + readonly abilities: Record; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/UserLight.ts b/src/frontend/js/api/joanie/gen/models/UserLight.ts new file mode 100644 index 0000000000..f5f9cad51d --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/UserLight.ts @@ -0,0 +1,21 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Light serializer for User model. + */ +export type UserLight = { + /** + * primary key for the record as UUID + */ + readonly id: string; + /** + * Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. + */ + readonly username: string; + full_name: string; + readonly email: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/models/UserRequest.ts b/src/frontend/js/api/joanie/gen/models/UserRequest.ts new file mode 100644 index 0000000000..4f32ae36b6 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/models/UserRequest.ts @@ -0,0 +1,12 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Serializer for User model. + */ +export type UserRequest = { + full_name: string; +}; + diff --git a/src/frontend/js/api/joanie/gen/services/AddressesService.ts b/src/frontend/js/api/joanie/gen/services/AddressesService.ts new file mode 100644 index 0000000000..affccdee5a --- /dev/null +++ b/src/frontend/js/api/joanie/gen/services/AddressesService.ts @@ -0,0 +1,276 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { Address } from '../models/Address'; +import type { AddressRequest } from '../models/AddressRequest'; +import type { PaginatedAddressList } from '../models/PaginatedAddressList'; +import type { PatchedAddressRequest } from '../models/PatchedAddressRequest'; + +import type { CancelablePromise } from '../core/CancelablePromise'; +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class AddressesService { + + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * API view allows to get all addresses or create or update a new one for a user. + * + * GET /api/addresses/ + * Return list of all addresses for a user + * + * POST /api/addresses/ with expected data: + * - address: str + * - city: str + * - country: str, country code + * - first_name: str, recipient first name + * - last_name: str, recipient last name + * - is_main?: bool, if True set address as main + * - postcode: str + * - title: str, address title + * Return new address just created + * + * PUT /api/addresses// with expected data: + * - address: str + * - city: str + * - country: str, country code + * - first_name: str, recipient first name + * - last_name: str, recipient last name + * - is_main?: bool, if True set address as main + * - postcode: str + * - title: str, address title + * Return address just updated + * + * DELETE /api/addresses// + * Delete selected address + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @returns PaginatedAddressList + * @throws ApiError + */ + public addressesList( + page?: number, + pageSize?: number, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/addresses/', + query: { + 'page': page, + 'page_size': pageSize, + }, + }); + } + + /** + * API view allows to get all addresses or create or update a new one for a user. + * + * GET /api/addresses/ + * Return list of all addresses for a user + * + * POST /api/addresses/ with expected data: + * - address: str + * - city: str + * - country: str, country code + * - first_name: str, recipient first name + * - last_name: str, recipient last name + * - is_main?: bool, if True set address as main + * - postcode: str + * - title: str, address title + * Return new address just created + * + * PUT /api/addresses// with expected data: + * - address: str + * - city: str + * - country: str, country code + * - first_name: str, recipient first name + * - last_name: str, recipient last name + * - is_main?: bool, if True set address as main + * - postcode: str + * - title: str, address title + * Return address just updated + * + * DELETE /api/addresses// + * Delete selected address + * @param requestBody + * @returns Address + * @throws ApiError + */ + public addressesCreate( + requestBody: AddressRequest, + ): CancelablePromise
{ + return this.httpRequest.request({ + method: 'POST', + url: '/api/v1.0/addresses/', + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * API view allows to get all addresses or create or update a new one for a user. + * + * GET /api/addresses/ + * Return list of all addresses for a user + * + * POST /api/addresses/ with expected data: + * - address: str + * - city: str + * - country: str, country code + * - first_name: str, recipient first name + * - last_name: str, recipient last name + * - is_main?: bool, if True set address as main + * - postcode: str + * - title: str, address title + * Return new address just created + * + * PUT /api/addresses// with expected data: + * - address: str + * - city: str + * - country: str, country code + * - first_name: str, recipient first name + * - last_name: str, recipient last name + * - is_main?: bool, if True set address as main + * - postcode: str + * - title: str, address title + * Return address just updated + * + * DELETE /api/addresses// + * Delete selected address + * @param id + * @returns Address + * @throws ApiError + */ + public addressesRetrieve( + id: string, + ): CancelablePromise
{ + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/addresses/{id}/', + path: { + 'id': id, + }, + }); + } + + /** + * API view allows to get all addresses or create or update a new one for a user. + * + * GET /api/addresses/ + * Return list of all addresses for a user + * + * POST /api/addresses/ with expected data: + * - address: str + * - city: str + * - country: str, country code + * - first_name: str, recipient first name + * - last_name: str, recipient last name + * - is_main?: bool, if True set address as main + * - postcode: str + * - title: str, address title + * Return new address just created + * + * PUT /api/addresses// with expected data: + * - address: str + * - city: str + * - country: str, country code + * - first_name: str, recipient first name + * - last_name: str, recipient last name + * - is_main?: bool, if True set address as main + * - postcode: str + * - title: str, address title + * Return address just updated + * + * DELETE /api/addresses// + * Delete selected address + * @param id + * @param requestBody + * @returns Address + * @throws ApiError + */ + public addressesUpdate( + id: string, + requestBody: AddressRequest, + ): CancelablePromise
{ + return this.httpRequest.request({ + method: 'PUT', + url: '/api/v1.0/addresses/{id}/', + path: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * API view allows to get all addresses or create or update a new one for a user. + * + * GET /api/addresses/ + * Return list of all addresses for a user + * + * POST /api/addresses/ with expected data: + * - address: str + * - city: str + * - country: str, country code + * - first_name: str, recipient first name + * - last_name: str, recipient last name + * - is_main?: bool, if True set address as main + * - postcode: str + * - title: str, address title + * Return new address just created + * + * PUT /api/addresses// with expected data: + * - address: str + * - city: str + * - country: str, country code + * - first_name: str, recipient first name + * - last_name: str, recipient last name + * - is_main?: bool, if True set address as main + * - postcode: str + * - title: str, address title + * Return address just updated + * + * DELETE /api/addresses// + * Delete selected address + * @param id + * @param requestBody + * @returns Address + * @throws ApiError + */ + public addressesPartialUpdate( + id: string, + requestBody?: PatchedAddressRequest, + ): CancelablePromise
{ + return this.httpRequest.request({ + method: 'PATCH', + url: '/api/v1.0/addresses/{id}/', + path: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * Delete an address for user authenticated. If the address is linked to + * invoices it is not deleted but marked as not reusable. + * @param id + * @returns void + * @throws ApiError + */ + public addressesDestroy( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'DELETE', + url: '/api/v1.0/addresses/{id}/', + path: { + 'id': id, + }, + }); + } + +} diff --git a/src/frontend/js/api/joanie/gen/services/CertificatesService.ts b/src/frontend/js/api/joanie/gen/services/CertificatesService.ts new file mode 100644 index 0000000000..7bbabfa5cd --- /dev/null +++ b/src/frontend/js/api/joanie/gen/services/CertificatesService.ts @@ -0,0 +1,86 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { Certificate } from '../models/Certificate'; +import type { PaginatedCertificateList } from '../models/PaginatedCertificateList'; + +import type { CancelablePromise } from '../core/CancelablePromise'; +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class CertificatesService { + + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * API views to get all certificates for a user + * + * GET /api/certificates/:certificate_id + * Return list of all certificates for a user or one certificate if an id is + * provided. + * + * GET /api/certificates/:certificate_id/download + * Return the certificate document in PDF format. + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @returns PaginatedCertificateList + * @throws ApiError + */ + public certificatesList( + page?: number, + pageSize?: number, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/certificates/', + query: { + 'page': page, + 'page_size': pageSize, + }, + }); + } + + /** + * API views to get all certificates for a user + * + * GET /api/certificates/:certificate_id + * Return list of all certificates for a user or one certificate if an id is + * provided. + * + * GET /api/certificates/:certificate_id/download + * Return the certificate document in PDF format. + * @param id + * @returns Certificate + * @throws ApiError + */ + public certificatesRetrieve( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/certificates/{id}/', + path: { + 'id': id, + }, + }); + } + + /** + * Retrieve a certificate through its id if it is owned by the authenticated user. + * @param id + * @returns binary + * @throws ApiError + */ + public certificatesDownloadRetrieve( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/certificates/{id}/download/', + path: { + 'id': id, + }, + }); + } + +} diff --git a/src/frontend/js/api/joanie/gen/services/ContractDefinitionsService.ts b/src/frontend/js/api/joanie/gen/services/ContractDefinitionsService.ts new file mode 100644 index 0000000000..754edfa444 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/services/ContractDefinitionsService.ts @@ -0,0 +1,30 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { CancelablePromise } from '../core/CancelablePromise'; +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class ContractDefinitionsService { + + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * Return the contract definition in PDF in bytes. + * @param id + * @returns binary + * @throws ApiError + */ + public contractDefinitionsPreviewTemplateRetrieve( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/contract_definitions/{id}/preview_template/', + path: { + 'id': id, + }, + }); + } + +} diff --git a/src/frontend/js/api/joanie/gen/services/ContractsService.ts b/src/frontend/js/api/joanie/gen/services/ContractsService.ts new file mode 100644 index 0000000000..1cc08e0d49 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/services/ContractsService.ts @@ -0,0 +1,159 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { Contract } from '../models/Contract'; +import type { PaginatedContractList } from '../models/PaginatedContractList'; + +import type { CancelablePromise } from '../core/CancelablePromise'; +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class ContractsService { + + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * Contract Viewset to list & retrieve contracts owned by the authenticated user. + * + * GET /api/contracts/ + * Return list of all contracts owned by the logged-in user. + * + * GET /api/contracts// + * Return a contract if one matches the provided id, + * and it is owned by the logged-in user. + * + * GET /api/contracts//download/ + * Return a contract in PDF format when it is signed on. + * @param courseId + * @param courseProductRelationId + * @param id primary key for the record as UUID + * @param organizationId + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @param productId + * @param signatureState * `unsigned` - Unsigned + * * `half_signed` - Partially signed + * * `signed` - Signed + * @returns PaginatedContractList + * @throws ApiError + */ + public contractsList( + courseId?: string, + courseProductRelationId?: string, + id?: Array, + organizationId?: string, + page?: number, + pageSize?: number, + productId?: string, + signatureState?: 'half_signed' | 'signed' | 'unsigned', + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/contracts/', + query: { + 'course_id': courseId, + 'course_product_relation_id': courseProductRelationId, + 'id': id, + 'organization_id': organizationId, + 'page': page, + 'page_size': pageSize, + 'product_id': productId, + 'signature_state': signatureState, + }, + }); + } + + /** + * Contract Viewset to list & retrieve contracts owned by the authenticated user. + * + * GET /api/contracts/ + * Return list of all contracts owned by the logged-in user. + * + * GET /api/contracts// + * Return a contract if one matches the provided id, + * and it is owned by the logged-in user. + * + * GET /api/contracts//download/ + * Return a contract in PDF format when it is signed on. + * @param id + * @returns Contract + * @throws ApiError + */ + public contractsRetrieve( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/contracts/{id}/', + path: { + 'id': id, + }, + }); + } + + /** + * Return the PDF file in bytes fully signed to download from the signature provider. + * @param id + * @returns binary + * @throws ApiError + */ + public contractsDownloadRetrieve( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/contracts/{id}/download/', + path: { + 'id': id, + }, + }); + } + + /** + * This endpoint is exclusive to users that have access rights on a specific organization. + * + * It triggers the generation of a ZIP archive if the requesting has the correct access rights + * on the organization. If a course product relation UUID is given from key word arguments, + * the user requires to have access to the organization that is attached to the specific + * course product relation object. + * We return in the response the URL for polling the ZIP archive once it has been generated. + * + * Notes on possible `kwargs` as input parameters : + * - string of an Organization UUID + * OR + * - string of an CourseProductRelation UUID + * @returns Contract + * @throws ApiError + */ + public contractsZipArchiveCreate(): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v1.0/contracts/zip-archive/', + }); + } + + /** + * Return the ZIP archive once it has been generated and it exists into storages. + * + * When the ZIP archive is not ready yet, we will return a response with the status code 404 + * until the ZIP is available to be served. Once available, we return the ZIP archive. + * If the paired User UUID and the received ZIP UUID do not match any files in storage, + * it return a response with the status code 404. + * You must add the ZIP id as a payload. + * @param zipId + * @returns Contract + * @throws ApiError + */ + public contractsZipArchiveRetrieve( + zipId: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/contracts/zip-archive/{zip_id}/', + path: { + 'zip_id': zipId, + }, + }); + } + +} diff --git a/src/frontend/js/api/joanie/gen/services/CourseProductRelationsService.ts b/src/frontend/js/api/joanie/gen/services/CourseProductRelationsService.ts new file mode 100644 index 0000000000..096c5e4351 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/services/CourseProductRelationsService.ts @@ -0,0 +1,79 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { CourseProductRelation } from '../models/CourseProductRelation'; +import type { PaginatedCourseProductRelationList } from '../models/PaginatedCourseProductRelationList'; + +import type { CancelablePromise } from '../core/CancelablePromise'; +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class CourseProductRelationsService { + + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * API ViewSet for all interactions with course-product relations. + * Can be accessed through multiple URLs + * GET /courses/ + * Return all courses the user has access to + * GET /organizations//courses/ + * Return all courses from the specified organization if user + * has access to the organization + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @param productType * `credential` - Credential + * * `enrollment` - Enrollment + * * `certificate` - Certificate + * @param productTypeExclude * `credential` - Credential + * * `enrollment` - Enrollment + * * `certificate` - Certificate + * @param query + * @returns PaginatedCourseProductRelationList + * @throws ApiError + */ + public courseProductRelationsList( + page?: number, + pageSize?: number, + productType?: Array<'certificate' | 'credential' | 'enrollment'>, + productTypeExclude?: Array<'certificate' | 'credential' | 'enrollment'>, + query?: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/course-product-relations/', + query: { + 'page': page, + 'page_size': pageSize, + 'product_type': productType, + 'product_type_exclude': productTypeExclude, + 'query': query, + }, + }); + } + + /** + * API ViewSet for all interactions with course-product relations. + * Can be accessed through multiple URLs + * GET /courses/ + * Return all courses the user has access to + * GET /organizations//courses/ + * Return all courses from the specified organization if user + * has access to the organization + * @param pkOrProductId + * @returns CourseProductRelation + * @throws ApiError + */ + public courseProductRelationsRetrieve( + pkOrProductId: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/course-product-relations/{pk_or_product_id}/', + path: { + 'pk_or_product_id': pkOrProductId, + }, + }); + } + +} diff --git a/src/frontend/js/api/joanie/gen/services/CourseRunsService.ts b/src/frontend/js/api/joanie/gen/services/CourseRunsService.ts new file mode 100644 index 0000000000..30a5732b05 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/services/CourseRunsService.ts @@ -0,0 +1,54 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { CourseRun } from '../models/CourseRun'; +import type { PaginatedCourseRunList } from '../models/PaginatedCourseRunList'; + +import type { CancelablePromise } from '../core/CancelablePromise'; +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class CourseRunsService { + + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * API ViewSet for all interactions with course runs. + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @returns PaginatedCourseRunList + * @throws ApiError + */ + public courseRunsList( + page?: number, + pageSize?: number, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/course-runs/', + query: { + 'page': page, + 'page_size': pageSize, + }, + }); + } + + /** + * API ViewSet for all interactions with course runs. + * @param id + * @returns CourseRun + * @throws ApiError + */ + public courseRunsRetrieve( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/course-runs/{id}/', + path: { + 'id': id, + }, + }); + } + +} diff --git a/src/frontend/js/api/joanie/gen/services/CourseRunsSyncService.ts b/src/frontend/js/api/joanie/gen/services/CourseRunsSyncService.ts new file mode 100644 index 0000000000..da49f7e07c --- /dev/null +++ b/src/frontend/js/api/joanie/gen/services/CourseRunsSyncService.ts @@ -0,0 +1,36 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { CancelablePromise } from '../core/CancelablePromise'; +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class CourseRunsSyncService { + + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * View for the web hook to create or update course runs based on their resource link. + * + * - A new course run is created or the existing course run is updated + * + * Parameters + * ---------- + * request : Type[django.http.request.HttpRequest] + * The request on the API endpoint, it should contain a payload with course run fields. + * + * Returns + * ------- + * Type[rest_framework.response.Response] + * HttpResponse acknowledging the success or failure of the synchronization operation. + * @returns any No response body + * @throws ApiError + */ + public courseRunsSyncCreate(): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v1.0/course-runs-sync/', + }); + } + +} diff --git a/src/frontend/js/api/joanie/gen/services/CoursesService.ts b/src/frontend/js/api/joanie/gen/services/CoursesService.ts new file mode 100644 index 0000000000..58992509c2 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/services/CoursesService.ts @@ -0,0 +1,677 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { Contract } from '../models/Contract'; +import type { Course } from '../models/Course'; +import type { CourseAccess } from '../models/CourseAccess'; +import type { CourseAccessRequest } from '../models/CourseAccessRequest'; +import type { CourseProductRelation } from '../models/CourseProductRelation'; +import type { CourseRequest } from '../models/CourseRequest'; +import type { CourseRun } from '../models/CourseRun'; +import type { PaginatedContractList } from '../models/PaginatedContractList'; +import type { PaginatedCourseAccessList } from '../models/PaginatedCourseAccessList'; +import type { PaginatedCourseList } from '../models/PaginatedCourseList'; +import type { PaginatedCourseProductRelationList } from '../models/PaginatedCourseProductRelationList'; +import type { PaginatedCourseRunList } from '../models/PaginatedCourseRunList'; +import type { PaginatedNestedOrderCourseList } from '../models/PaginatedNestedOrderCourseList'; +import type { PatchedCourseAccessRequest } from '../models/PatchedCourseAccessRequest'; + +import type { CancelablePromise } from '../core/CancelablePromise'; +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class CoursesService { + + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * API ViewSet for all interactions with courses. + * + * GET /api/courses/ + * Return list of all courses related to the logged-in user. + * + * GET /api/courses/: + * Return one course if an id is provided. + * + * GET /api/courses/:/wish + * Return wish status on this course for the authenticated user + * + * POST /api/courses/:/wish + * Confirm a wish on this course for the authenticated user + * + * DELETE /api/courses/:/wish + * Delete any existing wish on this course for the authenticated user + * @param hasListedCourseRuns + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @param productType * `credential` - Credential + * * `enrollment` - Enrollment + * * `certificate` - Certificate + * @param query + * @returns PaginatedCourseList + * @throws ApiError + */ + public coursesList( + hasListedCourseRuns?: boolean, + page?: number, + pageSize?: number, + productType?: 'certificate' | 'credential' | 'enrollment', + query?: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/courses/', + query: { + 'has_listed_course_runs': hasListedCourseRuns, + 'page': page, + 'page_size': pageSize, + 'product_type': productType, + 'query': query, + }, + }); + } + + /** + * API ViewSet for all interactions with course accesses. + * + * GET /api/courses//accesses/: + * Return list of all course accesses related to the logged-in user or one + * course access if an id is provided. + * + * POST /api/courses//accesses/ with expected data: + * - user: str + * - role: str [owner|admin|member] + * Return newly created course access + * + * PUT /api/courses//accesses// with expected data: + * - role: str [owner|admin|member] + * Return updated course access + * + * PATCH /api/courses//accesses// with expected data: + * - role: str [owner|admin|member] + * Return partially updated course access + * + * DELETE /api/courses//accesses// + * Delete targeted course access + * @param courseId + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @returns PaginatedCourseAccessList + * @throws ApiError + */ + public coursesAccessesList( + courseId: string, + page?: number, + pageSize?: number, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/courses/{course_id}/accesses/', + path: { + 'course_id': courseId, + }, + query: { + 'page': page, + 'page_size': pageSize, + }, + }); + } + + /** + * API ViewSet for all interactions with course accesses. + * + * GET /api/courses//accesses/: + * Return list of all course accesses related to the logged-in user or one + * course access if an id is provided. + * + * POST /api/courses//accesses/ with expected data: + * - user: str + * - role: str [owner|admin|member] + * Return newly created course access + * + * PUT /api/courses//accesses// with expected data: + * - role: str [owner|admin|member] + * Return updated course access + * + * PATCH /api/courses//accesses// with expected data: + * - role: str [owner|admin|member] + * Return partially updated course access + * + * DELETE /api/courses//accesses// + * Delete targeted course access + * @param courseId + * @param requestBody + * @returns CourseAccess + * @throws ApiError + */ + public coursesAccessesCreate( + courseId: string, + requestBody: CourseAccessRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v1.0/courses/{course_id}/accesses/', + path: { + 'course_id': courseId, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * API ViewSet for all interactions with course accesses. + * + * GET /api/courses//accesses/: + * Return list of all course accesses related to the logged-in user or one + * course access if an id is provided. + * + * POST /api/courses//accesses/ with expected data: + * - user: str + * - role: str [owner|admin|member] + * Return newly created course access + * + * PUT /api/courses//accesses// with expected data: + * - role: str [owner|admin|member] + * Return updated course access + * + * PATCH /api/courses//accesses// with expected data: + * - role: str [owner|admin|member] + * Return partially updated course access + * + * DELETE /api/courses//accesses// + * Delete targeted course access + * @param courseId + * @param id + * @returns CourseAccess + * @throws ApiError + */ + public coursesAccessesRetrieve( + courseId: string, + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/courses/{course_id}/accesses/{id}/', + path: { + 'course_id': courseId, + 'id': id, + }, + }); + } + + /** + * API ViewSet for all interactions with course accesses. + * + * GET /api/courses//accesses/: + * Return list of all course accesses related to the logged-in user or one + * course access if an id is provided. + * + * POST /api/courses//accesses/ with expected data: + * - user: str + * - role: str [owner|admin|member] + * Return newly created course access + * + * PUT /api/courses//accesses// with expected data: + * - role: str [owner|admin|member] + * Return updated course access + * + * PATCH /api/courses//accesses// with expected data: + * - role: str [owner|admin|member] + * Return partially updated course access + * + * DELETE /api/courses//accesses// + * Delete targeted course access + * @param courseId + * @param id + * @param requestBody + * @returns CourseAccess + * @throws ApiError + */ + public coursesAccessesUpdate( + courseId: string, + id: string, + requestBody: CourseAccessRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'PUT', + url: '/api/v1.0/courses/{course_id}/accesses/{id}/', + path: { + 'course_id': courseId, + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * API ViewSet for all interactions with course accesses. + * + * GET /api/courses//accesses/: + * Return list of all course accesses related to the logged-in user or one + * course access if an id is provided. + * + * POST /api/courses//accesses/ with expected data: + * - user: str + * - role: str [owner|admin|member] + * Return newly created course access + * + * PUT /api/courses//accesses// with expected data: + * - role: str [owner|admin|member] + * Return updated course access + * + * PATCH /api/courses//accesses// with expected data: + * - role: str [owner|admin|member] + * Return partially updated course access + * + * DELETE /api/courses//accesses// + * Delete targeted course access + * @param courseId + * @param id + * @param requestBody + * @returns CourseAccess + * @throws ApiError + */ + public coursesAccessesPartialUpdate( + courseId: string, + id: string, + requestBody?: PatchedCourseAccessRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'PATCH', + url: '/api/v1.0/courses/{course_id}/accesses/{id}/', + path: { + 'course_id': courseId, + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * API ViewSet for all interactions with course accesses. + * + * GET /api/courses//accesses/: + * Return list of all course accesses related to the logged-in user or one + * course access if an id is provided. + * + * POST /api/courses//accesses/ with expected data: + * - user: str + * - role: str [owner|admin|member] + * Return newly created course access + * + * PUT /api/courses//accesses// with expected data: + * - role: str [owner|admin|member] + * Return updated course access + * + * PATCH /api/courses//accesses// with expected data: + * - role: str [owner|admin|member] + * Return partially updated course access + * + * DELETE /api/courses//accesses// + * Delete targeted course access + * @param courseId + * @param id + * @returns void + * @throws ApiError + */ + public coursesAccessesDestroy( + courseId: string, + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'DELETE', + url: '/api/v1.0/courses/{course_id}/accesses/{id}/', + path: { + 'course_id': courseId, + 'id': id, + }, + }); + } + + /** + * Nested Contract Viewset inside course route. + * It allows to list & retrieve course's contracts if the user is an administrator + * or an owner of the contract's organization. + * + * GET /api/courses//contracts/ + * Return list of all course's contracts + * + * GET /api/courses//contracts// + * Return a course's contract if one matches the provided id + * @param courseId + * @param courseProductRelationId + * @param id primary key for the record as UUID + * @param organizationId + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @param productId + * @param signatureState * `unsigned` - Unsigned + * * `half_signed` - Partially signed + * * `signed` - Signed + * @returns PaginatedContractList + * @throws ApiError + */ + public coursesContractsList( + courseId: string, + courseProductRelationId?: string, + id?: Array, + organizationId?: string, + page?: number, + pageSize?: number, + productId?: string, + signatureState?: 'half_signed' | 'signed' | 'unsigned', + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/courses/{course_id}/contracts/', + path: { + 'course_id': courseId, + }, + query: { + 'course_id': courseId, + 'course_product_relation_id': courseProductRelationId, + 'id': id, + 'organization_id': organizationId, + 'page': page, + 'page_size': pageSize, + 'product_id': productId, + 'signature_state': signatureState, + }, + }); + } + + /** + * Nested Contract Viewset inside course route. + * It allows to list & retrieve course's contracts if the user is an administrator + * or an owner of the contract's organization. + * + * GET /api/courses//contracts/ + * Return list of all course's contracts + * + * GET /api/courses//contracts// + * Return a course's contract if one matches the provided id + * @param courseId + * @param id + * @returns Contract + * @throws ApiError + */ + public coursesContractsRetrieve( + courseId: string, + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/courses/{course_id}/contracts/{id}/', + path: { + 'course_id': courseId, + 'id': id, + }, + }); + } + + /** + * API ViewSet for all interactions with course runs. + * @param courseId + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @returns PaginatedCourseRunList + * @throws ApiError + */ + public coursesCourseRunsList( + courseId: string, + page?: number, + pageSize?: number, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/courses/{course_id}/course-runs/', + path: { + 'course_id': courseId, + }, + query: { + 'page': page, + 'page_size': pageSize, + }, + }); + } + + /** + * API ViewSet for all interactions with course runs. + * @param courseId + * @param id + * @returns CourseRun + * @throws ApiError + */ + public coursesCourseRunsRetrieve( + courseId: string, + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/courses/{course_id}/course-runs/{id}/', + path: { + 'course_id': courseId, + 'id': id, + }, + }); + } + + /** + * Nested Order Viewset inside Course's routes. It allows to list all users who made + * 'validated' orders on a given course. You should add some query parameters to filter + * the list by organization, by product or by course product relation id. + * + * GET /api/courses//orders/ + * Returns every users who made an order on a given course. + * + * GET /api/courses//orders/?organization_id=> + * Returns every users who made an order on a course from a specific organization. + * + * GET /api/courses//orders/?product_id= + * Returns every users who made an order on the product's course. + * + * GET /api/courses//orders/?organization_id=&product_id= + * Returns every users that is attached to a product's course and an organization. + * + * GET /api/courses//orders/?course_product_relation_id= + * Returns every users who made order on the course product relation object. + * @param courseId + * @param courseProductRelationId + * @param organizationId + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @param productId + * @returns PaginatedNestedOrderCourseList + * @throws ApiError + */ + public coursesOrdersList( + courseId: string, + courseProductRelationId?: string, + organizationId?: string, + page?: number, + pageSize?: number, + productId?: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/courses/{course_id}/orders/', + path: { + 'course_id': courseId, + }, + query: { + 'course_product_relation_id': courseProductRelationId, + 'organization_id': organizationId, + 'page': page, + 'page_size': pageSize, + 'product_id': productId, + }, + }); + } + + /** + * API ViewSet for all interactions with course-product relations. + * Can be accessed through multiple URLs + * GET /courses/ + * Return all courses the user has access to + * GET /organizations//courses/ + * Return all courses from the specified organization if user + * has access to the organization + * @param courseId + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @param productType * `credential` - Credential + * * `enrollment` - Enrollment + * * `certificate` - Certificate + * @param productTypeExclude * `credential` - Credential + * * `enrollment` - Enrollment + * * `certificate` - Certificate + * @param query + * @returns PaginatedCourseProductRelationList + * @throws ApiError + */ + public coursesProductsList( + courseId: string, + page?: number, + pageSize?: number, + productType?: Array<'certificate' | 'credential' | 'enrollment'>, + productTypeExclude?: Array<'certificate' | 'credential' | 'enrollment'>, + query?: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/courses/{course_id}/products/', + path: { + 'course_id': courseId, + }, + query: { + 'page': page, + 'page_size': pageSize, + 'product_type': productType, + 'product_type_exclude': productTypeExclude, + 'query': query, + }, + }); + } + + /** + * API ViewSet for all interactions with course-product relations. + * Can be accessed through multiple URLs + * GET /courses/ + * Return all courses the user has access to + * GET /organizations//courses/ + * Return all courses from the specified organization if user + * has access to the organization + * @param courseId + * @param pkOrProductId + * @returns CourseProductRelation + * @throws ApiError + */ + public coursesProductsRetrieve( + courseId: string, + pkOrProductId: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/courses/{course_id}/products/{pk_or_product_id}/', + path: { + 'course_id': courseId, + 'pk_or_product_id': pkOrProductId, + }, + }); + } + + /** + * API ViewSet for all interactions with courses. + * + * GET /api/courses/ + * Return list of all courses related to the logged-in user. + * + * GET /api/courses/: + * Return one course if an id is provided. + * + * GET /api/courses/:/wish + * Return wish status on this course for the authenticated user + * + * POST /api/courses/:/wish + * Confirm a wish on this course for the authenticated user + * + * DELETE /api/courses/:/wish + * Delete any existing wish on this course for the authenticated user + * @param id + * @returns Course + * @throws ApiError + */ + public coursesRetrieve( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/courses/{id}/', + path: { + 'id': id, + }, + }); + } + + /** + * Action to handle the wish on this course for the logged-in user. + * @param id + * @returns Course + * @throws ApiError + */ + public coursesWishRetrieve( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/courses/{id}/wish/', + path: { + 'id': id, + }, + }); + } + + /** + * Action to handle the wish on this course for the logged-in user. + * @param id + * @param requestBody + * @returns Course + * @throws ApiError + */ + public coursesWishCreate( + id: string, + requestBody: CourseRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v1.0/courses/{id}/wish/', + path: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * Action to handle the wish on this course for the logged-in user. + * @param id + * @returns void + * @throws ApiError + */ + public coursesWishDestroy( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'DELETE', + url: '/api/v1.0/courses/{id}/wish/', + path: { + 'id': id, + }, + }); + } + +} diff --git a/src/frontend/js/api/joanie/gen/services/CreditCardsService.ts b/src/frontend/js/api/joanie/gen/services/CreditCardsService.ts new file mode 100644 index 0000000000..d7a21aadef --- /dev/null +++ b/src/frontend/js/api/joanie/gen/services/CreditCardsService.ts @@ -0,0 +1,173 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { CreditCard } from '../models/CreditCard'; +import type { CreditCardRequest } from '../models/CreditCardRequest'; +import type { PaginatedCreditCardList } from '../models/PaginatedCreditCardList'; +import type { PatchedCreditCardRequest } from '../models/PatchedCreditCardRequest'; + +import type { CancelablePromise } from '../core/CancelablePromise'; +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class CreditCardsService { + + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * API views allows to get all credit cards, update or delete one + * for the authenticated user. + * + * GET /api/credit-cards/ + * Return the list of all credit cards owned by the authenticated user + * + * PUT /api/credit-cards/ with expected data: + * - title: str + * - is_main?: bool + * + * DELETE /api/credit-cards/ + * Delete the selected credit card + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @returns PaginatedCreditCardList + * @throws ApiError + */ + public creditCardsList( + page?: number, + pageSize?: number, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/credit-cards/', + query: { + 'page': page, + 'page_size': pageSize, + }, + }); + } + + /** + * API views allows to get all credit cards, update or delete one + * for the authenticated user. + * + * GET /api/credit-cards/ + * Return the list of all credit cards owned by the authenticated user + * + * PUT /api/credit-cards/ with expected data: + * - title: str + * - is_main?: bool + * + * DELETE /api/credit-cards/ + * Delete the selected credit card + * @param id + * @returns CreditCard + * @throws ApiError + */ + public creditCardsRetrieve( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/credit-cards/{id}/', + path: { + 'id': id, + }, + }); + } + + /** + * API views allows to get all credit cards, update or delete one + * for the authenticated user. + * + * GET /api/credit-cards/ + * Return the list of all credit cards owned by the authenticated user + * + * PUT /api/credit-cards/ with expected data: + * - title: str + * - is_main?: bool + * + * DELETE /api/credit-cards/ + * Delete the selected credit card + * @param id + * @param requestBody + * @returns CreditCard + * @throws ApiError + */ + public creditCardsUpdate( + id: string, + requestBody?: CreditCardRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'PUT', + url: '/api/v1.0/credit-cards/{id}/', + path: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * API views allows to get all credit cards, update or delete one + * for the authenticated user. + * + * GET /api/credit-cards/ + * Return the list of all credit cards owned by the authenticated user + * + * PUT /api/credit-cards/ with expected data: + * - title: str + * - is_main?: bool + * + * DELETE /api/credit-cards/ + * Delete the selected credit card + * @param id + * @param requestBody + * @returns CreditCard + * @throws ApiError + */ + public creditCardsPartialUpdate( + id: string, + requestBody?: PatchedCreditCardRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'PATCH', + url: '/api/v1.0/credit-cards/{id}/', + path: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * API views allows to get all credit cards, update or delete one + * for the authenticated user. + * + * GET /api/credit-cards/ + * Return the list of all credit cards owned by the authenticated user + * + * PUT /api/credit-cards/ with expected data: + * - title: str + * - is_main?: bool + * + * DELETE /api/credit-cards/ + * Delete the selected credit card + * @param id + * @returns void + * @throws ApiError + */ + public creditCardsDestroy( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'DELETE', + url: '/api/v1.0/credit-cards/{id}/', + path: { + 'id': id, + }, + }); + } + +} diff --git a/src/frontend/js/api/joanie/gen/services/EnrollmentsService.ts b/src/frontend/js/api/joanie/gen/services/EnrollmentsService.ts new file mode 100644 index 0000000000..5f82cf38d2 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/services/EnrollmentsService.ts @@ -0,0 +1,126 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { Enrollment } from '../models/Enrollment'; +import type { EnrollmentRequest } from '../models/EnrollmentRequest'; +import type { PaginatedEnrollmentList } from '../models/PaginatedEnrollmentList'; +import type { PatchedEnrollmentRequest } from '../models/PatchedEnrollmentRequest'; + +import type { CancelablePromise } from '../core/CancelablePromise'; +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class EnrollmentsService { + + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * API ViewSet for all interactions with enrollments. + * @param courseRunId + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @param query + * @param wasCreatedByOrder + * @returns PaginatedEnrollmentList + * @throws ApiError + */ + public enrollmentsList( + courseRunId?: string, + page?: number, + pageSize?: number, + query?: string, + wasCreatedByOrder?: boolean, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/enrollments/', + query: { + 'course_run_id': courseRunId, + 'page': page, + 'page_size': pageSize, + 'query': query, + 'was_created_by_order': wasCreatedByOrder, + }, + }); + } + + /** + * API ViewSet for all interactions with enrollments. + * @param requestBody + * @returns Enrollment + * @throws ApiError + */ + public enrollmentsCreate( + requestBody: EnrollmentRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v1.0/enrollments/', + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * API ViewSet for all interactions with enrollments. + * @param id + * @returns Enrollment + * @throws ApiError + */ + public enrollmentsRetrieve( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/enrollments/{id}/', + path: { + 'id': id, + }, + }); + } + + /** + * API ViewSet for all interactions with enrollments. + * @param id + * @param requestBody + * @returns Enrollment + * @throws ApiError + */ + public enrollmentsUpdate( + id: string, + requestBody: EnrollmentRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'PUT', + url: '/api/v1.0/enrollments/{id}/', + path: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * API ViewSet for all interactions with enrollments. + * @param id + * @param requestBody + * @returns Enrollment + * @throws ApiError + */ + public enrollmentsPartialUpdate( + id: string, + requestBody?: PatchedEnrollmentRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'PATCH', + url: '/api/v1.0/enrollments/{id}/', + path: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + +} diff --git a/src/frontend/js/api/joanie/gen/services/OrdersService.ts b/src/frontend/js/api/joanie/gen/services/OrdersService.ts new file mode 100644 index 0000000000..0ecd7558b4 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/services/OrdersService.ts @@ -0,0 +1,259 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { Order } from '../models/Order'; +import type { OrderRequest } from '../models/OrderRequest'; +import type { PaginatedOrderList } from '../models/PaginatedOrderList'; +import type { PatchedOrderRequest } from '../models/PatchedOrderRequest'; + +import type { CancelablePromise } from '../core/CancelablePromise'; +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class OrdersService { + + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * API view for a user to consult the orders he/she owns or create a new one. + * + * GET /api/orders/ + * Return list of all orders for a user with pagination + * + * POST /api/orders/ with expected data: + * - course: course code + * - product: product id (product must be associated to the course. Otherwise, + * a 400 error is returned) + * Return new order just created + * + * POST /api/orders/:order_id/submit_for_signature/ + * Return an invitation link to sign the contract definition + * @param courseCode + * @param enrollmentId + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @param productId + * @param productType * `credential` - Credential + * * `enrollment` - Enrollment + * * `certificate` - Certificate + * @param productTypeExclude * `credential` - Credential + * * `enrollment` - Enrollment + * * `certificate` - Certificate + * @param query + * @param state * `draft` - Draft + * * `submitted` - Submitted + * * `pending` - Pending + * * `canceled` - Canceled + * * `validated` - Validated + * @param stateExclude * `draft` - Draft + * * `submitted` - Submitted + * * `pending` - Pending + * * `canceled` - Canceled + * * `validated` - Validated + * @returns PaginatedOrderList + * @throws ApiError + */ + public ordersList( + courseCode?: string, + enrollmentId?: string, + page?: number, + pageSize?: number, + productId?: string, + productType?: Array<'certificate' | 'credential' | 'enrollment'>, + productTypeExclude?: Array<'certificate' | 'credential' | 'enrollment'>, + query?: string, + state?: Array<'canceled' | 'draft' | 'pending' | 'submitted' | 'validated'>, + stateExclude?: Array<'canceled' | 'draft' | 'pending' | 'submitted' | 'validated'>, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/orders/', + query: { + 'course_code': courseCode, + 'enrollment_id': enrollmentId, + 'page': page, + 'page_size': pageSize, + 'product_id': productId, + 'product_type': productType, + 'product_type_exclude': productTypeExclude, + 'query': query, + 'state': state, + 'state_exclude': stateExclude, + }, + }); + } + + /** + * Try to create an order and a related payment if the payment is fee. + * @param requestBody + * @returns Order + * @throws ApiError + */ + public ordersCreate( + requestBody: OrderRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v1.0/orders/', + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * API view for a user to consult the orders he/she owns or create a new one. + * + * GET /api/orders/ + * Return list of all orders for a user with pagination + * + * POST /api/orders/ with expected data: + * - course: course code + * - product: product id (product must be associated to the course. Otherwise, + * a 400 error is returned) + * Return new order just created + * + * POST /api/orders/:order_id/submit_for_signature/ + * Return an invitation link to sign the contract definition + * @param id + * @returns Order + * @throws ApiError + */ + public ordersRetrieve( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/orders/{id}/', + path: { + 'id': id, + }, + }); + } + + /** + * Change the state of the order to pending + * @param id + * @param requestBody + * @returns Order + * @throws ApiError + */ + public ordersAbortCreate( + id: string, + requestBody: OrderRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v1.0/orders/{id}/abort/', + path: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * Change the state of the order to cancelled + * @param id + * @param requestBody + * @returns Order + * @throws ApiError + */ + public ordersCancelCreate( + id: string, + requestBody: OrderRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v1.0/orders/{id}/cancel/', + path: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * Retrieve an invoice through its reference if it is related to + * the order instance and owned by the authenticated user. + * @param id + * @returns Order + * @throws ApiError + */ + public ordersInvoiceRetrieve( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/orders/{id}/invoice/', + path: { + 'id': id, + }, + }); + } + + /** + * Submit a draft order if the conditions are filled + * @param id + * @param requestBody + * @returns Order + * @throws ApiError + */ + public ordersSubmitPartialUpdate( + id: string, + requestBody?: PatchedOrderRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'PATCH', + url: '/api/v1.0/orders/{id}/submit/', + path: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * Create the contract of a product's order that has a contract definition and submit + * the contract to the signature provider. It returns a one-time use invitation link. + * @param id + * @returns Order + * @throws ApiError + */ + public ordersSubmitForSignatureCreate( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v1.0/orders/{id}/submit_for_signature/', + path: { + 'id': id, + }, + }); + } + + /** + * Validate the order + * @param id + * @param requestBody + * @returns Order + * @throws ApiError + */ + public ordersValidateUpdate( + id: string, + requestBody: OrderRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'PUT', + url: '/api/v1.0/orders/{id}/validate/', + path: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + +} diff --git a/src/frontend/js/api/joanie/gen/services/OrganizationsService.ts b/src/frontend/js/api/joanie/gen/services/OrganizationsService.ts new file mode 100644 index 0000000000..5c1743bf96 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/services/OrganizationsService.ts @@ -0,0 +1,671 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { Contract } from '../models/Contract'; +import type { Course } from '../models/Course'; +import type { CourseProductRelation } from '../models/CourseProductRelation'; +import type { CourseRequest } from '../models/CourseRequest'; +import type { Organization } from '../models/Organization'; +import type { OrganizationAccess } from '../models/OrganizationAccess'; +import type { OrganizationAccessRequest } from '../models/OrganizationAccessRequest'; +import type { PaginatedContractList } from '../models/PaginatedContractList'; +import type { PaginatedCourseList } from '../models/PaginatedCourseList'; +import type { PaginatedCourseProductRelationList } from '../models/PaginatedCourseProductRelationList'; +import type { PaginatedOrganizationAccessList } from '../models/PaginatedOrganizationAccessList'; +import type { PaginatedOrganizationList } from '../models/PaginatedOrganizationList'; +import type { PatchedOrganizationAccessRequest } from '../models/PatchedOrganizationAccessRequest'; + +import type { CancelablePromise } from '../core/CancelablePromise'; +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class OrganizationsService { + + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * API ViewSet for all interactions with organizations. + * + * GET /api/organizations/:organization_id + * Return list of all organizations related to the logged-in user or one organization + * if an id is provided. + * @param courseProductRelationId + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @returns PaginatedOrganizationList + * @throws ApiError + */ + public organizationsList( + courseProductRelationId?: string, + page?: number, + pageSize?: number, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/organizations/', + query: { + 'course_product_relation_id': courseProductRelationId, + 'page': page, + 'page_size': pageSize, + }, + }); + } + + /** + * API ViewSet for all interactions with organization accesses. + * + * GET /api/organization//accesses/: + * Return list of all organization accesses related to the logged-in user or one + * organization access if an id is provided. + * + * POST /api//accesses/ with expected data: + * - user: str + * - role: str [owner|admin|member] + * Return newly created organization access + * + * PUT /api//accesses// with expected data: + * - role: str [owner|admin|member] + * Return updated organization access + * + * PATCH /api//accesses// with expected data: + * - role: str [owner|admin|member] + * Return partially updated organization access + * + * DELETE /api//accesses// + * Delete targeted organization access + * @param organizationId + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @returns PaginatedOrganizationAccessList + * @throws ApiError + */ + public organizationsAccessesList( + organizationId: string, + page?: number, + pageSize?: number, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/organizations/{organization_id}/accesses/', + path: { + 'organization_id': organizationId, + }, + query: { + 'page': page, + 'page_size': pageSize, + }, + }); + } + + /** + * API ViewSet for all interactions with organization accesses. + * + * GET /api/organization//accesses/: + * Return list of all organization accesses related to the logged-in user or one + * organization access if an id is provided. + * + * POST /api//accesses/ with expected data: + * - user: str + * - role: str [owner|admin|member] + * Return newly created organization access + * + * PUT /api//accesses// with expected data: + * - role: str [owner|admin|member] + * Return updated organization access + * + * PATCH /api//accesses// with expected data: + * - role: str [owner|admin|member] + * Return partially updated organization access + * + * DELETE /api//accesses// + * Delete targeted organization access + * @param organizationId + * @param requestBody + * @returns OrganizationAccess + * @throws ApiError + */ + public organizationsAccessesCreate( + organizationId: string, + requestBody: OrganizationAccessRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v1.0/organizations/{organization_id}/accesses/', + path: { + 'organization_id': organizationId, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * API ViewSet for all interactions with organization accesses. + * + * GET /api/organization//accesses/: + * Return list of all organization accesses related to the logged-in user or one + * organization access if an id is provided. + * + * POST /api//accesses/ with expected data: + * - user: str + * - role: str [owner|admin|member] + * Return newly created organization access + * + * PUT /api//accesses// with expected data: + * - role: str [owner|admin|member] + * Return updated organization access + * + * PATCH /api//accesses// with expected data: + * - role: str [owner|admin|member] + * Return partially updated organization access + * + * DELETE /api//accesses// + * Delete targeted organization access + * @param id + * @param organizationId + * @returns OrganizationAccess + * @throws ApiError + */ + public organizationsAccessesRetrieve( + id: string, + organizationId: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/organizations/{organization_id}/accesses/{id}/', + path: { + 'id': id, + 'organization_id': organizationId, + }, + }); + } + + /** + * API ViewSet for all interactions with organization accesses. + * + * GET /api/organization//accesses/: + * Return list of all organization accesses related to the logged-in user or one + * organization access if an id is provided. + * + * POST /api//accesses/ with expected data: + * - user: str + * - role: str [owner|admin|member] + * Return newly created organization access + * + * PUT /api//accesses// with expected data: + * - role: str [owner|admin|member] + * Return updated organization access + * + * PATCH /api//accesses// with expected data: + * - role: str [owner|admin|member] + * Return partially updated organization access + * + * DELETE /api//accesses// + * Delete targeted organization access + * @param id + * @param organizationId + * @param requestBody + * @returns OrganizationAccess + * @throws ApiError + */ + public organizationsAccessesUpdate( + id: string, + organizationId: string, + requestBody: OrganizationAccessRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'PUT', + url: '/api/v1.0/organizations/{organization_id}/accesses/{id}/', + path: { + 'id': id, + 'organization_id': organizationId, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * API ViewSet for all interactions with organization accesses. + * + * GET /api/organization//accesses/: + * Return list of all organization accesses related to the logged-in user or one + * organization access if an id is provided. + * + * POST /api//accesses/ with expected data: + * - user: str + * - role: str [owner|admin|member] + * Return newly created organization access + * + * PUT /api//accesses// with expected data: + * - role: str [owner|admin|member] + * Return updated organization access + * + * PATCH /api//accesses// with expected data: + * - role: str [owner|admin|member] + * Return partially updated organization access + * + * DELETE /api//accesses// + * Delete targeted organization access + * @param id + * @param organizationId + * @param requestBody + * @returns OrganizationAccess + * @throws ApiError + */ + public organizationsAccessesPartialUpdate( + id: string, + organizationId: string, + requestBody?: PatchedOrganizationAccessRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'PATCH', + url: '/api/v1.0/organizations/{organization_id}/accesses/{id}/', + path: { + 'id': id, + 'organization_id': organizationId, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * API ViewSet for all interactions with organization accesses. + * + * GET /api/organization//accesses/: + * Return list of all organization accesses related to the logged-in user or one + * organization access if an id is provided. + * + * POST /api//accesses/ with expected data: + * - user: str + * - role: str [owner|admin|member] + * Return newly created organization access + * + * PUT /api//accesses// with expected data: + * - role: str [owner|admin|member] + * Return updated organization access + * + * PATCH /api//accesses// with expected data: + * - role: str [owner|admin|member] + * Return partially updated organization access + * + * DELETE /api//accesses// + * Delete targeted organization access + * @param id + * @param organizationId + * @returns void + * @throws ApiError + */ + public organizationsAccessesDestroy( + id: string, + organizationId: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'DELETE', + url: '/api/v1.0/organizations/{organization_id}/accesses/{id}/', + path: { + 'id': id, + 'organization_id': organizationId, + }, + }); + } + + /** + * Nested Contract Viewset inside organization route. + * It allows to list & retrieve organization's contracts if the user is + * an administrator or an owner of the organization. + * + * GET /api/courses//contracts/ + * Return list of all organization's contracts + * + * GET /api/courses//contracts// + * Return an organization's contract if one matches the provided id + * @param organizationId + * @param courseId + * @param courseProductRelationId + * @param id primary key for the record as UUID + * @param organizationId + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @param productId + * @param signatureState * `unsigned` - Unsigned + * * `half_signed` - Partially signed + * * `signed` - Signed + * @returns PaginatedContractList + * @throws ApiError + */ + public organizationsContractsList( + organizationId: string, + courseId?: string, + courseProductRelationId?: string, + id?: Array, + page?: number, + pageSize?: number, + productId?: string, + signatureState?: 'half_signed' | 'signed' | 'unsigned', + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/organizations/{organization_id}/contracts/', + path: { + 'organization_id': organizationId, + }, + query: { + 'course_id': courseId, + 'course_product_relation_id': courseProductRelationId, + 'id': id, + 'organization_id': organizationId, + 'page': page, + 'page_size': pageSize, + 'product_id': productId, + 'signature_state': signatureState, + }, + }); + } + + /** + * Nested Contract Viewset inside organization route. + * It allows to list & retrieve organization's contracts if the user is + * an administrator or an owner of the organization. + * + * GET /api/courses//contracts/ + * Return list of all organization's contracts + * + * GET /api/courses//contracts// + * Return an organization's contract if one matches the provided id + * @param id + * @param organizationId + * @returns Contract + * @throws ApiError + */ + public organizationsContractsRetrieve( + id: string, + organizationId: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/organizations/{organization_id}/contracts/{id}/', + path: { + 'id': id, + 'organization_id': organizationId, + }, + }); + } + + /** + * API ViewSet for all interactions with course-product relations. + * Can be accessed through multiple URLs + * GET /courses/ + * Return all courses the user has access to + * GET /organizations//courses/ + * Return all courses from the specified organization if user + * has access to the organization + * @param organizationId + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @param productType * `credential` - Credential + * * `enrollment` - Enrollment + * * `certificate` - Certificate + * @param productTypeExclude * `credential` - Credential + * * `enrollment` - Enrollment + * * `certificate` - Certificate + * @param query + * @returns PaginatedCourseProductRelationList + * @throws ApiError + */ + public organizationsCourseProductRelationsList( + organizationId: string, + page?: number, + pageSize?: number, + productType?: Array<'certificate' | 'credential' | 'enrollment'>, + productTypeExclude?: Array<'certificate' | 'credential' | 'enrollment'>, + query?: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/organizations/{organization_id}/course-product-relations/', + path: { + 'organization_id': organizationId, + }, + query: { + 'page': page, + 'page_size': pageSize, + 'product_type': productType, + 'product_type_exclude': productTypeExclude, + 'query': query, + }, + }); + } + + /** + * API ViewSet for all interactions with course-product relations. + * Can be accessed through multiple URLs + * GET /courses/ + * Return all courses the user has access to + * GET /organizations//courses/ + * Return all courses from the specified organization if user + * has access to the organization + * @param organizationId + * @param pkOrProductId + * @returns CourseProductRelation + * @throws ApiError + */ + public organizationsCourseProductRelationsRetrieve( + organizationId: string, + pkOrProductId: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/organizations/{organization_id}/course-product-relations/{pk_or_product_id}/', + path: { + 'organization_id': organizationId, + 'pk_or_product_id': pkOrProductId, + }, + }); + } + + /** + * API ViewSet for all interactions with courses. + * + * GET /api/courses/ + * Return list of all courses related to the logged-in user. + * + * GET /api/courses/: + * Return one course if an id is provided. + * + * GET /api/courses/:/wish + * Return wish status on this course for the authenticated user + * + * POST /api/courses/:/wish + * Confirm a wish on this course for the authenticated user + * + * DELETE /api/courses/:/wish + * Delete any existing wish on this course for the authenticated user + * @param organizationId + * @param hasListedCourseRuns + * @param page A page number within the paginated result set. + * @param pageSize Number of results to return per page. + * @param productType * `credential` - Credential + * * `enrollment` - Enrollment + * * `certificate` - Certificate + * @param query + * @returns PaginatedCourseList + * @throws ApiError + */ + public organizationsCoursesList( + organizationId: string, + hasListedCourseRuns?: boolean, + page?: number, + pageSize?: number, + productType?: 'certificate' | 'credential' | 'enrollment', + query?: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/organizations/{organization_id}/courses/', + path: { + 'organization_id': organizationId, + }, + query: { + 'has_listed_course_runs': hasListedCourseRuns, + 'page': page, + 'page_size': pageSize, + 'product_type': productType, + 'query': query, + }, + }); + } + + /** + * API ViewSet for all interactions with courses. + * + * GET /api/courses/ + * Return list of all courses related to the logged-in user. + * + * GET /api/courses/: + * Return one course if an id is provided. + * + * GET /api/courses/:/wish + * Return wish status on this course for the authenticated user + * + * POST /api/courses/:/wish + * Confirm a wish on this course for the authenticated user + * + * DELETE /api/courses/:/wish + * Delete any existing wish on this course for the authenticated user + * @param id + * @param organizationId + * @returns Course + * @throws ApiError + */ + public organizationsCoursesRetrieve( + id: string, + organizationId: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/organizations/{organization_id}/courses/{id}/', + path: { + 'id': id, + 'organization_id': organizationId, + }, + }); + } + + /** + * Action to handle the wish on this course for the logged-in user. + * @param id + * @param organizationId + * @returns Course + * @throws ApiError + */ + public organizationsCoursesWishRetrieve( + id: string, + organizationId: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/organizations/{organization_id}/courses/{id}/wish/', + path: { + 'id': id, + 'organization_id': organizationId, + }, + }); + } + + /** + * Action to handle the wish on this course for the logged-in user. + * @param id + * @param organizationId + * @param requestBody + * @returns Course + * @throws ApiError + */ + public organizationsCoursesWishCreate( + id: string, + organizationId: string, + requestBody: CourseRequest, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v1.0/organizations/{organization_id}/courses/{id}/wish/', + path: { + 'id': id, + 'organization_id': organizationId, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * Action to handle the wish on this course for the logged-in user. + * @param id + * @param organizationId + * @returns void + * @throws ApiError + */ + public organizationsCoursesWishDestroy( + id: string, + organizationId: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'DELETE', + url: '/api/v1.0/organizations/{organization_id}/courses/{id}/wish/', + path: { + 'id': id, + 'organization_id': organizationId, + }, + }); + } + + /** + * API ViewSet for all interactions with organizations. + * + * GET /api/organizations/:organization_id + * Return list of all organizations related to the logged-in user or one organization + * if an id is provided. + * @param id + * @returns Organization + * @throws ApiError + */ + public organizationsRetrieve( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/organizations/{id}/', + path: { + 'id': id, + }, + }); + } + + /** + * Return an invitation link to sign all the available contracts for the organization. + * @param id + * @param contractIds List of contract ids to sign, if not provided all the available contracts will be signed. + * @param courseProductRelationIds List of course product relation ids to sign related contracts, if not provided all the available contracts will be signed. + * @returns Organization + * @throws ApiError + */ + public organizationsContractsSignatureLinkRetrieve( + id: string, + contractIds?: Array, + courseProductRelationIds?: Array, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/organizations/{id}/contracts-signature-link/', + path: { + 'id': id, + }, + query: { + 'contract_ids': contractIds, + 'course_product_relation_ids': courseProductRelationIds, + }, + }); + } + +} diff --git a/src/frontend/js/api/joanie/gen/services/PaymentsService.ts b/src/frontend/js/api/joanie/gen/services/PaymentsService.ts new file mode 100644 index 0000000000..b2e137a52b --- /dev/null +++ b/src/frontend/js/api/joanie/gen/services/PaymentsService.ts @@ -0,0 +1,25 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { CancelablePromise } from '../core/CancelablePromise'; +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class PaymentsService { + + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * The webhook called by payment provider + * when a payment has been created/updated/refunded... + * @returns any No response body + * @throws ApiError + */ + public paymentsNotificationsCreate(): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v1.0/payments/notifications/', + }); + } + +} diff --git a/src/frontend/js/api/joanie/gen/services/SignatureService.ts b/src/frontend/js/api/joanie/gen/services/SignatureService.ts new file mode 100644 index 0000000000..265cc996b5 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/services/SignatureService.ts @@ -0,0 +1,24 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { CancelablePromise } from '../core/CancelablePromise'; +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class SignatureService { + + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * The webhook called by the signature provider when a file has been signed/refused. + * @returns any No response body + * @throws ApiError + */ + public signatureNotificationsCreate(): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v1.0/signature/notifications/', + }); + } + +} diff --git a/src/frontend/js/api/joanie/gen/services/UsersService.ts b/src/frontend/js/api/joanie/gen/services/UsersService.ts new file mode 100644 index 0000000000..ad5853ff64 --- /dev/null +++ b/src/frontend/js/api/joanie/gen/services/UsersService.ts @@ -0,0 +1,44 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { User } from '../models/User'; + +import type { CancelablePromise } from '../core/CancelablePromise'; +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class UsersService { + + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * User ViewSet + * @param id + * @returns User + * @throws ApiError + */ + public usersRetrieve( + id: string, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/users/{id}/', + path: { + 'id': id, + }, + }); + } + + /** + * Return information on currently logged user + * @returns User + * @throws ApiError + */ + public usersMeRetrieve(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v1.0/users/me/', + }); + } + +} diff --git a/src/frontend/js/api/joanie/index.ts b/src/frontend/js/api/joanie/index.ts new file mode 100644 index 0000000000..5f427251b5 --- /dev/null +++ b/src/frontend/js/api/joanie/index.ts @@ -0,0 +1,15 @@ +import context from 'utils/context'; + +/** + * Flag which determines if joanie is enabled. + */ +export const isJoanieEnabled = !!context.joanie_backend; + +export { + default as JoanieLegacyClient, + getResponseBody as getResponseBodyLegacy, + checkStatus as checkStatusLegacy, + getAPIEndpoint as getAPIEndpointLegacy, + getRoutes as getRoutesLegacy, + buildApiUrl as buildApiUrlLegacy, +} from './joanieLegacyClient'; diff --git a/src/frontend/js/api/joanie.spec.ts b/src/frontend/js/api/joanie/joanieLegacyClient.spec.ts similarity index 97% rename from src/frontend/js/api/joanie.spec.ts rename to src/frontend/js/api/joanie/joanieLegacyClient.spec.ts index f8fc89317d..84e6e664b8 100644 --- a/src/frontend/js/api/joanie.spec.ts +++ b/src/frontend/js/api/joanie/joanieLegacyClient.spec.ts @@ -1,7 +1,7 @@ import fetchMock from 'fetch-mock'; import { ResourcesQuery } from 'hooks/useResources'; import { HttpStatusCode } from 'utils/errors/HttpError'; -import { buildApiUrl, getResponseBody } from './joanie'; +import { buildApiUrl, getResponseBody } from './joanieLegacyClient'; describe('api/joanie', () => { it('getResponse should handle empty response body', async () => { diff --git a/src/frontend/js/api/joanie.ts b/src/frontend/js/api/joanie/joanieLegacyClient.ts similarity index 95% rename from src/frontend/js/api/joanie.ts rename to src/frontend/js/api/joanie/joanieLegacyClient.ts index c58bd429ac..c087a58399 100644 --- a/src/frontend/js/api/joanie.ts +++ b/src/frontend/js/api/joanie/joanieLegacyClient.ts @@ -206,11 +206,6 @@ export const getRoutes = () => { }; }; -/** - * Flag which determines if joanie is enabled. - */ -export const isJoanieEnabled = !!context.joanie_backend; - const filterEmptyEntry = ([, value]: [PropertyKey, any]) => { if (value == null) return false; // Value is null/undefined if (value?.length !== undefined && value.length === 0) return false; // Value is an empty array/string @@ -288,25 +283,6 @@ const API = (): Joanie.API => { method: 'DELETE', }).then(checkStatus), }, - addresses: { - get: (id?: string) => { - return fetchWithJWT(buildApiUrl(ROUTES.user.addresses.get, { id })).then(checkStatus); - }, - create: async (payload) => - fetchWithJWT(ROUTES.user.addresses.create, { - method: 'POST', - body: JSON.stringify(payload), - }).then(checkStatus), - update: async ({ id, ...address }) => - fetchWithJWT(ROUTES.user.addresses.update.replace(':id', id), { - method: 'PUT', - body: JSON.stringify(address), - }).then(checkStatus), - delete: async (id) => - fetchWithJWT(ROUTES.user.addresses.delete.replace(':id', id), { - method: 'DELETE', - }).then(checkStatus), - }, orders: { abort: async ({ id, payment_id }) => { return fetchWithJWT(ROUTES.user.orders.abort.replace(':id', id), { diff --git a/src/frontend/js/api/lms/joanie.ts b/src/frontend/js/api/lms/joanie.ts index 56cc11fd57..3e19c9875f 100644 --- a/src/frontend/js/api/lms/joanie.ts +++ b/src/frontend/js/api/lms/joanie.ts @@ -1,5 +1,5 @@ import { matchPath, PathMatch } from 'react-router-dom'; -import JoanieApi from 'api/joanie'; +import { JoanieLegacyClient as JoanieApi } from 'api/joanie'; import { LMSBackend } from 'types/commonDataProps'; import { APIBackend, APILms } from 'types/api'; diff --git a/src/frontend/js/components/Address/index.tsx b/src/frontend/js/components/Address/index.tsx index 26498adf60..fa95d6b629 100644 --- a/src/frontend/js/components/Address/index.tsx +++ b/src/frontend/js/components/Address/index.tsx @@ -1,4 +1,4 @@ -import { Address } from 'types/Joanie'; +import { Address } from 'api/joanie/gen'; export const AddressView = ({ address }: { address: Address }) => { return ( diff --git a/src/frontend/js/components/AddressesManagement/AddressForm/index.spec.tsx b/src/frontend/js/components/AddressesManagement/AddressForm/index.spec.tsx index 08e94afb61..c0a4df8556 100644 --- a/src/frontend/js/components/AddressesManagement/AddressForm/index.spec.tsx +++ b/src/frontend/js/components/AddressesManagement/AddressForm/index.spec.tsx @@ -3,9 +3,9 @@ import { IntlProvider } from 'react-intl'; import countries from 'i18n-iso-countries'; import { CunninghamProvider } from '@openfun/cunningham-react'; import userEvent, { UserEvent } from '@testing-library/user-event'; -import { Address } from 'types/Joanie'; -import { AddressFactory } from 'utils/test/factories/joanie'; import { changeSelect, clearSelect } from 'components/Form/test-utils'; +import { Address } from 'api/joanie/gen'; +import { AddressFactory } from 'utils/test/factories/joanieGen'; import AddressForm from './index'; jest.mock('hooks/useAddresses', () => ({ diff --git a/src/frontend/js/components/AddressesManagement/AddressForm/index.stories.tsx b/src/frontend/js/components/AddressesManagement/AddressForm/index.stories.tsx index 75248c8070..35a226882c 100644 --- a/src/frontend/js/components/AddressesManagement/AddressForm/index.stories.tsx +++ b/src/frontend/js/components/AddressesManagement/AddressForm/index.stories.tsx @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react'; import { StorybookHelper } from 'utils/StorybookHelper'; -import { AddressFactory } from 'utils/test/factories/joanie'; +import { AddressFactory } from 'utils/test/factories/joanieGen'; import AddressForm from '.'; export default { diff --git a/src/frontend/js/components/AddressesManagement/AddressForm/index.tsx b/src/frontend/js/components/AddressesManagement/AddressForm/index.tsx index 87279b56b2..72fb97fa79 100644 --- a/src/frontend/js/components/AddressesManagement/AddressForm/index.tsx +++ b/src/frontend/js/components/AddressesManagement/AddressForm/index.tsx @@ -1,6 +1,6 @@ import { yupResolver } from '@hookform/resolvers/yup'; import { Fragment, useEffect } from 'react'; -import { FormProvider, useForm } from 'react-hook-form'; +import { DefaultValues, FormProvider, useForm } from 'react-hook-form'; import { FormattedMessage, useIntl } from 'react-intl'; import { Button, Checkbox } from '@openfun/cunningham-react'; import { getLocalizedCunninghamErrorProp } from 'components/Form/utils'; @@ -8,7 +8,7 @@ import { messages } from 'components/AddressesManagement/index'; import { CountrySelectField } from 'components/Form/CountrySelectField'; import Input from 'components/Form/Input'; import { useAddresses } from 'hooks/useAddresses'; -import type { Address } from 'types/Joanie'; +import type { Address } from 'api/joanie/gen'; import { messages as formMessages } from 'components/Form/messages'; import validationSchema from './validationSchema'; @@ -23,16 +23,7 @@ interface Props { } const AddressForm = ({ handleReset, onSubmit, address }: Props) => { - const defaultValues = { - title: '', - first_name: '', - last_name: '', - address: '', - postcode: '', - city: '', - country: '-', - save: false, - } as AddressFormValues; + const defaultValues: DefaultValues = {}; const form = useForm({ defaultValues: address || defaultValues, diff --git a/src/frontend/js/components/AddressesManagement/AddressForm/validationSchema.spec.ts b/src/frontend/js/components/AddressesManagement/AddressForm/validationSchema.spec.ts index e92862a3c4..8fc91fd57a 100644 --- a/src/frontend/js/components/AddressesManagement/AddressForm/validationSchema.spec.ts +++ b/src/frontend/js/components/AddressesManagement/AddressForm/validationSchema.spec.ts @@ -3,6 +3,7 @@ import { useForm } from 'react-hook-form'; import { yupResolver } from '@hookform/resolvers/yup'; import { act, renderHook } from '@testing-library/react'; import { Maybe } from 'types/utils'; +import { CountryEnum } from 'api/joanie/gen'; import validationSchema from './validationSchema'; describe('validationSchema', () => { @@ -11,7 +12,7 @@ describe('validationSchema', () => { const defaultValues = { address: faker.location.streetAddress(), city: faker.location.city(), - country: faker.location.countryCode(), + country: faker.location.countryCode() as CountryEnum, first_name: faker.person.firstName(), last_name: faker.person.lastName(), postcode: faker.location.zipCode(), @@ -126,7 +127,7 @@ describe('validationSchema', () => { result.current.setValue('address', faker.location.streetAddress()); result.current.setValue('city', faker.location.city()); // set country value with an invalid country code - result.current.setValue('country', 'AA'); + result.current.setValue('country', 'AA' as CountryEnum); result.current.setValue('first_name', faker.person.firstName()); result.current.setValue('last_name', faker.person.lastName()); result.current.setValue('postcode', faker.location.zipCode()); @@ -151,7 +152,7 @@ describe('validationSchema', () => { // - Set country value with a valid country code await act(async () => { - result.current.setValue('country', 'FR'); + result.current.setValue('country', 'FR' as CountryEnum); result.current.trigger(); }); diff --git a/src/frontend/js/components/AddressesManagement/AddressForm/validationSchema.ts b/src/frontend/js/components/AddressesManagement/AddressForm/validationSchema.ts index c45bbf6144..8cc58e7ffe 100644 --- a/src/frontend/js/components/AddressesManagement/AddressForm/validationSchema.ts +++ b/src/frontend/js/components/AddressesManagement/AddressForm/validationSchema.ts @@ -1,6 +1,6 @@ -import countries from 'i18n-iso-countries'; import * as Yup from 'yup'; import { ErrorKeys } from 'components/Form/ValidationErrors'; +import { CountryEnum } from 'api/joanie/gen'; Yup.setLocale({ mixed: { @@ -19,7 +19,7 @@ Yup.setLocale({ const schema = Yup.object().shape({ address: Yup.string().required(), city: Yup.string().required(), - country: Yup.string().oneOf(Object.keys(countries.getAlpha2Codes())).required(), + country: Yup.mixed().oneOf(Object.values(CountryEnum)).defined(), first_name: Yup.string().required(), last_name: Yup.string().required(), postcode: Yup.string().required(), diff --git a/src/frontend/js/components/AddressesManagement/index.spec.tsx b/src/frontend/js/components/AddressesManagement/index.spec.tsx index d4106ebca2..e7225c143f 100644 --- a/src/frontend/js/components/AddressesManagement/index.spec.tsx +++ b/src/frontend/js/components/AddressesManagement/index.spec.tsx @@ -10,11 +10,11 @@ import { PropsWithChildren } from 'react'; import { CunninghamProvider } from '@openfun/cunningham-react'; import userEvent, { UserEvent } from '@testing-library/user-event'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { AddressFactory } from 'utils/test/factories/joanie'; import { SessionProvider } from 'contexts/SessionContext'; -import type * as Joanie from 'types/Joanie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { changeSelect } from 'components/Form/test-utils'; +import { AddressFactory } from 'utils/test/factories/joanieGen'; +import { Address } from 'api/joanie/gen'; import AddressesManagement from '.'; jest.mock('utils/context', () => ({ @@ -87,7 +87,7 @@ describe('AddressesManagement', () => { return expect($addresses).toHaveLength(addresses.length); }); - addresses.forEach((address: Joanie.Address) => { + addresses.forEach((address: Address) => { const $address = screen.getByTestId(`address-${address.id}-title`); expect($address.textContent).toEqual(address.title); }); diff --git a/src/frontend/js/components/AddressesManagement/index.tsx b/src/frontend/js/components/AddressesManagement/index.tsx index 8be77d0a9b..11560058c2 100644 --- a/src/frontend/js/components/AddressesManagement/index.tsx +++ b/src/frontend/js/components/AddressesManagement/index.tsx @@ -6,8 +6,7 @@ import Banner, { BannerType } from 'components/Banner'; import { Icon, IconTypeEnum } from 'components/Icon'; import RegisteredAddress from 'components/RegisteredAddress'; import { useAddressesManagement } from 'hooks/useAddressesManagement'; -import type * as Joanie from 'types/Joanie'; -import { Address } from 'types/Joanie'; +import type { Address } from 'api/joanie/gen'; import { Maybe } from 'types/utils'; // constant used as `address.id` for local address @@ -108,13 +107,13 @@ export const messages = defineMessages({ interface AddressesManagementProps { handleClose: () => void; - selectAddress: (address: Joanie.Address) => void; + selectAddress: (address: Address) => void; } const AddressesManagement = forwardRef( ({ handleClose, selectAddress }, ref) => { const intl = useIntl(); - const [editedAddress, setEditedAddress] = useState>(); + const [editedAddress, setEditedAddress] = useState>(); const { methods: { setError, create, update, remove, promote }, states: { error }, @@ -124,11 +123,11 @@ const AddressesManagement = forwardRef /** * Sort addresses ascending by title according to the locale * - * @param {Joanie.Address} a - * @param {Joanie.Address} b - * @returns {Joanie.Address[]} Sorted addresses ascending by title + * @param {Address} a + * @param {Address} b + * @returns {Address[]} Sorted addresses ascending by title */ - const sortAddressByTitleAsc = (a: Joanie.Address, b: Joanie.Address) => { + const sortAddressByTitleAsc = (a: Address, b: Address) => { return a.title.localeCompare(b.title, [intl.locale, intl.defaultLocale]); }; @@ -136,9 +135,9 @@ const AddressesManagement = forwardRef * update `selectedAddress` state with the address provided * then close the address management form * - * @param {Joanie.Address} address + * @param {Address} address */ - const handleSelect = (address: Joanie.Address) => { + const handleSelect = (address: Address) => { setError(undefined); selectAddress(address); handleClose(); diff --git a/src/frontend/js/components/ContractFrame/LearnerContractFrame.spec.tsx b/src/frontend/js/components/ContractFrame/LearnerContractFrame.spec.tsx index 78ef3a3e8a..166c8dd837 100644 --- a/src/frontend/js/components/ContractFrame/LearnerContractFrame.spec.tsx +++ b/src/frontend/js/components/ContractFrame/LearnerContractFrame.spec.tsx @@ -6,7 +6,7 @@ import { IntlProvider } from 'react-intl'; import fetchMock from 'fetch-mock'; import { QueryStateFactory } from 'utils/test/factories/reactQuery'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CredentialOrderFactory } from 'utils/test/factories/joanie'; +import { CredentialOrderFactory } from 'utils/test/factories/joanieLegacy'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; import { Props } from './AbstractContractFrame'; diff --git a/src/frontend/js/components/ContractFrame/OrganizationContractFrame.spec.tsx b/src/frontend/js/components/ContractFrame/OrganizationContractFrame.spec.tsx index 2d6992f105..9dc4e70fb9 100644 --- a/src/frontend/js/components/ContractFrame/OrganizationContractFrame.spec.tsx +++ b/src/frontend/js/components/ContractFrame/OrganizationContractFrame.spec.tsx @@ -10,7 +10,7 @@ import { ContractFactory, CourseProductRelationFactory, OrganizationFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; import { isCourseProductRelation } from 'types/Joanie'; diff --git a/src/frontend/js/components/ContractStatus/index.spec.tsx b/src/frontend/js/components/ContractStatus/index.spec.tsx index a5cb629b9b..8b191f88bc 100644 --- a/src/frontend/js/components/ContractStatus/index.spec.tsx +++ b/src/frontend/js/components/ContractStatus/index.spec.tsx @@ -2,7 +2,7 @@ import { render, screen } from '@testing-library/react'; import { PropsWithChildren } from 'react'; import { IntlProvider, createIntl } from 'react-intl'; import { faker } from '@faker-js/faker'; -import { ContractFactory } from 'utils/test/factories/joanie'; +import { ContractFactory } from 'utils/test/factories/joanieLegacy'; import { DEFAULT_DATE_FORMAT } from 'hooks/useDateFormat'; import ContractStatus from '.'; diff --git a/src/frontend/js/components/DownloadContractButton/index.spec.tsx b/src/frontend/js/components/DownloadContractButton/index.spec.tsx index e7c0b85898..e19b6a77cc 100644 --- a/src/frontend/js/components/DownloadContractButton/index.spec.tsx +++ b/src/frontend/js/components/DownloadContractButton/index.spec.tsx @@ -5,7 +5,7 @@ import userEvent from '@testing-library/user-event'; import { QueryClientProvider } from '@tanstack/react-query'; import fetchMock from 'fetch-mock'; import { faker } from '@faker-js/faker'; -import { ContractFactory, CredentialOrderFactory } from 'utils/test/factories/joanie'; +import { ContractFactory, CredentialOrderFactory } from 'utils/test/factories/joanieLegacy'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import JoanieApiProvider from 'contexts/JoanieApiContext'; diff --git a/src/frontend/js/components/Form/CountrySelectField.tsx b/src/frontend/js/components/Form/CountrySelectField.tsx index 1d2a9ab29b..d7d0958009 100644 --- a/src/frontend/js/components/Form/CountrySelectField.tsx +++ b/src/frontend/js/components/Form/CountrySelectField.tsx @@ -1,5 +1,6 @@ import countries from 'i18n-iso-countries'; import { defineMessages, useIntl } from 'react-intl'; +import { CountryEnum } from 'api/joanie/gen'; import Select, { SelectProps } from './Select'; export const messages = defineMessages({ @@ -19,7 +20,7 @@ export const CountrySelectField = ({ const countryList = Object.entries(countries.getNames(languageCode)).map( ([value, label]: [string, string]) => { - return { value, label }; + return { value: value as CountryEnum, label }; }, [], ); diff --git a/src/frontend/js/components/PaymentButton/components/PaymentInterfaces/index.spec.tsx b/src/frontend/js/components/PaymentButton/components/PaymentInterfaces/index.spec.tsx index cccdba58e7..cd9223198e 100644 --- a/src/frontend/js/components/PaymentButton/components/PaymentInterfaces/index.spec.tsx +++ b/src/frontend/js/components/PaymentButton/components/PaymentInterfaces/index.spec.tsx @@ -3,7 +3,7 @@ import type * as Joanie from 'types/Joanie'; import { PaymentProviders } from 'types/Joanie'; import { handle as mockHandle } from 'utils/errors/handle'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { PaymentFactory } from 'utils/test/factories/joanie'; +import { PaymentFactory } from 'utils/test/factories/joanieLegacy'; import PaymentInterface from '.'; jest.mock('./PayplugLightbox', () => ({ diff --git a/src/frontend/js/components/PaymentButton/index.spec.tsx b/src/frontend/js/components/PaymentButton/index.spec.tsx index a83517235e..c3a1d5740f 100644 --- a/src/frontend/js/components/PaymentButton/index.spec.tsx +++ b/src/frontend/js/components/PaymentButton/index.spec.tsx @@ -7,7 +7,6 @@ import { faker } from '@faker-js/faker'; import queryString from 'query-string'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { - AddressFactory, CertificateOrderWithOneClickPaymentFactory, CertificateOrderWithPaymentFactory, CertificateProductFactory, @@ -18,7 +17,7 @@ import { OrderGroupFactory, CourseLightFactory, EnrollmentFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { PAYMENT_SETTINGS } from 'settings'; import type * as Joanie from 'types/Joanie'; import { @@ -42,6 +41,8 @@ import { } from 'components/SaleTunnel/context'; import { ObjectHelper } from 'utils/ObjectHelper'; import useProductOrder from 'hooks/useProductOrder'; +import { Address } from 'api/joanie/gen'; +import { AddressFactory } from 'utils/test/factories/joanieGen'; import PaymentButton from '.'; jest.mock('utils/context', () => ({ @@ -253,7 +254,7 @@ describe.each([ // this allows the user to get feedback on what's missing to make the payment by clicking on the button expect($button.disabled).toBe(false); - const billingAddress: Joanie.Address = AddressFactory().one(); + const billingAddress: Address = AddressFactory().one(); rerender( @@ -271,7 +272,7 @@ describe.each([ it('should render an enabled payment button if a billing address is provided', () => { const product: Joanie.Product = ProductFactory().one(); - const billingAddress: Joanie.Address = AddressFactory().one(); + const billingAddress: Address = AddressFactory().one(); const fetchOrderQueryParams = product.type === ProductType.CREDENTIAL @@ -307,7 +308,7 @@ describe.each([ it('should create an order then display the payment interface when user clicks on payment button', async () => { const product: Joanie.Product = ProductFactory().one(); - const billingAddress: Joanie.Address = AddressFactory().one(); + const billingAddress: Address = AddressFactory().one(); const handleSuccess = jest.fn(); const { payment_info: paymentInfo, ...order } = OrderWithPaymentFactory().one(); @@ -424,7 +425,7 @@ describe.each([ it('should create an order only the first time the payment interface is shown, and not after aborting', async () => { const product: Joanie.Product = ProductFactory().one(); - const billingAddress: Joanie.Address = AddressFactory().one(); + const billingAddress: Address = AddressFactory().one(); const handleSuccess = jest.fn(); const { payment_info: paymentInfo, ...order } = OrderWithPaymentFactory().one(); @@ -551,7 +552,7 @@ describe.each([ it('should render a payment button and not call the order creation route', async () => { const product: Joanie.Product = ProductFactory().one(); - const billingAddress: Joanie.Address = AddressFactory().one(); + const billingAddress: Address = AddressFactory().one(); const creditCard: Joanie.CreditCard = CreditCardFactory().one(); const { payment_info: paymentInfo, ...order } = OrderWithOneClickPaymentFactory().one(); const handleSuccess = jest.fn(); @@ -687,7 +688,7 @@ describe.each([ it('should abort the order if payment does not succeed after a given delay', async () => { const product: Joanie.Product = ProductFactory().one(); - const billingAddress: Joanie.Address = AddressFactory().one(); + const billingAddress: Address = AddressFactory().one(); const creditCard: Joanie.CreditCard = CreditCardFactory().one(); const { payment_info: paymentInfo, ...order } = OrderWithOneClickPaymentFactory().one(); const orderSubmitted = { @@ -822,7 +823,7 @@ describe.each([ it('should render an error message when payment failed', async () => { const product: Joanie.Product = ProductFactory().one(); - const billingAddress: Joanie.Address = AddressFactory().one(); + const billingAddress: Address = AddressFactory().one(); const { payment_info: paymentInfo, ...order } = OrderWithPaymentFactory().one(); const handleSuccess = jest.fn(); const fetchOrderQueryParams = @@ -916,7 +917,7 @@ describe.each([ it('should show an error if user does not accept the terms', async () => { const product: Joanie.Product = ProductFactory().one(); - const billingAddress: Joanie.Address = AddressFactory().one(); + const billingAddress: Address = AddressFactory().one(); const fetchOrderQueryParams = product.type === ProductType.CREDENTIAL @@ -961,7 +962,7 @@ describe.each([ it('should show a link to the platform terms and conditions', async () => { const product: Joanie.Product = ProductFactory().one(); - const billingAddress: Joanie.Address = AddressFactory().one(); + const billingAddress: Address = AddressFactory().one(); const fetchOrderQueryParams = product.type === ProductType.CREDENTIAL @@ -995,7 +996,7 @@ describe.each([ it('should create an order with an order group', async () => { const product: Joanie.Product = ProductFactory().one(); const orderGroup = OrderGroupFactory().one(); - const billingAddress: Joanie.Address = AddressFactory().one(); + const billingAddress: Address = AddressFactory().one(); const handleSuccess = jest.fn(); let createOrderPayload: Maybe; diff --git a/src/frontend/js/components/PaymentButton/index.tsx b/src/frontend/js/components/PaymentButton/index.tsx index f8d4b1136f..f6887a1591 100644 --- a/src/frontend/js/components/PaymentButton/index.tsx +++ b/src/frontend/js/components/PaymentButton/index.tsx @@ -14,6 +14,7 @@ import { useTerms } from 'components/PaymentButton/hooks/useTerms'; import { useSaleTunnelContext } from 'components/SaleTunnel/context'; import { ObjectHelper } from 'utils/ObjectHelper'; import { useOrders } from 'hooks/useOrders'; +import { Address } from 'api/joanie/gen'; import PaymentInterface from './components/PaymentInterfaces'; const messages = defineMessages({ @@ -75,7 +76,7 @@ export enum PaymentErrorMessageId { } interface PaymentButtonProps { - billingAddress?: Joanie.Address; + billingAddress?: Address; creditCard?: Nullable; onSuccess: () => void; } diff --git a/src/frontend/js/components/PurchaseButton/index.spec.tsx b/src/frontend/js/components/PurchaseButton/index.spec.tsx index fc878e5d50..089d254ab2 100644 --- a/src/frontend/js/components/PurchaseButton/index.spec.tsx +++ b/src/frontend/js/components/PurchaseButton/index.spec.tsx @@ -12,7 +12,7 @@ import { CourseLightFactory, EnrollmentFactory, ProductFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { SessionProvider } from 'contexts/SessionContext'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { ProductType } from 'types/Joanie'; diff --git a/src/frontend/js/components/PurchaseButton/index.stories.tsx b/src/frontend/js/components/PurchaseButton/index.stories.tsx index bf12bfdf06..e33a1f0ca0 100644 --- a/src/frontend/js/components/PurchaseButton/index.stories.tsx +++ b/src/frontend/js/components/PurchaseButton/index.stories.tsx @@ -1,5 +1,5 @@ import { Meta, StoryObj } from '@storybook/react'; -import { ProductFactory } from 'utils/test/factories/joanie'; +import { ProductFactory } from 'utils/test/factories/joanieLegacy'; import PurchaseButton from '.'; export default { diff --git a/src/frontend/js/components/RegisteredAddress/index.spec.tsx b/src/frontend/js/components/RegisteredAddress/index.spec.tsx index b72ddbb980..5c17cf38b6 100644 --- a/src/frontend/js/components/RegisteredAddress/index.spec.tsx +++ b/src/frontend/js/components/RegisteredAddress/index.spec.tsx @@ -2,9 +2,9 @@ import { fireEvent, getByRole, getByTestId, getByText, render } from '@testing-l import type { PropsWithChildren } from 'react'; import { IntlProvider } from 'react-intl'; import RegisteredAddress from 'components/RegisteredAddress/index'; -import type { Address } from 'types/Joanie'; import { noop } from 'utils'; -import { AddressFactory } from 'utils/test/factories/joanie'; +import { Address } from 'api/joanie/gen'; +import { AddressFactory } from 'utils/test/factories/joanieGen'; describe('RegisteredAddress', () => { const Wrapper = ({ children }: PropsWithChildren<{}>) => ( diff --git a/src/frontend/js/components/RegisteredAddress/index.stories.tsx b/src/frontend/js/components/RegisteredAddress/index.stories.tsx index 3898c6de1a..7c4bcc16c7 100644 --- a/src/frontend/js/components/RegisteredAddress/index.stories.tsx +++ b/src/frontend/js/components/RegisteredAddress/index.stories.tsx @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react'; import { StorybookHelper } from 'utils/StorybookHelper'; -import { AddressFactory } from 'utils/test/factories/joanie'; +import { AddressFactory } from 'utils/test/factories/joanieGen'; import RegisteredAddress from '.'; export default { diff --git a/src/frontend/js/components/RegisteredAddress/index.tsx b/src/frontend/js/components/RegisteredAddress/index.tsx index a0772644fb..a035371b4b 100644 --- a/src/frontend/js/components/RegisteredAddress/index.tsx +++ b/src/frontend/js/components/RegisteredAddress/index.tsx @@ -1,6 +1,6 @@ import { Button, Radio } from '@openfun/cunningham-react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; -import type { Address } from 'types/Joanie'; +import type { Address } from 'api/joanie/gen'; const messages = defineMessages({ promoteButtonLabel: { diff --git a/src/frontend/js/components/SaleTunnel/components/RegisteredCreditCard/index.spec.tsx b/src/frontend/js/components/SaleTunnel/components/RegisteredCreditCard/index.spec.tsx index 5339e6cb01..6c5976bcc5 100644 --- a/src/frontend/js/components/SaleTunnel/components/RegisteredCreditCard/index.spec.tsx +++ b/src/frontend/js/components/SaleTunnel/components/RegisteredCreditCard/index.spec.tsx @@ -2,7 +2,7 @@ import { fireEvent, getByRole, getByText, render } from '@testing-library/react' import { PropsWithChildren } from 'react'; import { IntlProvider } from 'react-intl'; import { CreditCard } from 'types/Joanie'; -import { CreditCardFactory } from 'utils/test/factories/joanie'; +import { CreditCardFactory } from 'utils/test/factories/joanieLegacy'; import { RegisteredCreditCard } from '.'; describe('RegisteredCreditCard', () => { diff --git a/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepPayment/index.spec.tsx b/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepPayment/index.spec.tsx index 28a567de24..4762f3e597 100644 --- a/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepPayment/index.spec.tsx +++ b/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepPayment/index.spec.tsx @@ -12,16 +12,17 @@ import { } from 'utils/test/factories/richie'; import { ProductFactory, - AddressFactory, CreditCardFactory, CourseLightFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { SessionProvider } from 'contexts/SessionContext'; -import { Address, CreditCard, Order, Product } from 'types/Joanie'; +import { CreditCard, Order, Product } from 'types/Joanie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { User } from 'types/User'; import { SaleTunnelContext, SaleTunnelContextType } from 'components/SaleTunnel/context'; import { Maybe } from 'types/utils'; +import { Address } from 'api/joanie/gen'; +import { AddressFactory } from 'utils/test/factories/joanieGen'; import { SaleTunnelStepPayment } from '.'; jest.mock('components/PaymentButton', () => ({ @@ -184,7 +185,7 @@ describe('SaleTunnelStepPayment', () => { // - By default, the main address should be selected expect($addressOptionById[address.id]).toHaveAttribute( 'aria-selected', - address.is_main.toString(), + (!!address.is_main).toString(), ); }); const mainAddress = addresses.find((address) => address.is_main)!; diff --git a/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepPayment/index.tsx b/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepPayment/index.tsx index e353110f9f..c71c637539 100644 --- a/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepPayment/index.tsx +++ b/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepPayment/index.tsx @@ -6,12 +6,12 @@ import AddressesManagement, { LOCAL_BILLING_ADDRESS_ID } from 'components/Addres import { useSession } from 'contexts/SessionContext'; import { useAddresses } from 'hooks/useAddresses'; import { useCreditCards } from 'hooks/useCreditCards'; -import type * as Joanie from 'types/Joanie'; import type { Maybe, Nullable } from 'types/utils'; import { Icon, IconTypeEnum } from 'components/Icon'; import { useSaleTunnelContext } from 'components/SaleTunnel/context'; import { UserHelper } from 'utils/UserHelper'; import { AddressView } from 'components/Address'; +import { Address } from 'api/joanie/gen'; import { RegisteredCreditCard } from '../RegisteredCreditCard'; const messages = defineMessages({ @@ -66,11 +66,11 @@ export const SaleTunnelStepPayment = ({ next }: SaleTunnelStepPaymentProps) => { /** * Sort addresses ascending by title according to the locale * - * @param {Joanie.Address} a - * @param {Joanie.Address} b - * @returns {Joanie.Address[]} Sorted addresses ascending by title + * @param {Address} a + * @param {Address} b + * @returns {Address[]} Sorted addresses ascending by title */ - const sortAddressByTitleAsc = (a: Joanie.Address, b: Joanie.Address) => { + const sortAddressByTitleAsc = (a: Address, b: Address) => { return a.title.localeCompare(b.title, [intl.locale, intl.defaultLocale]); }; @@ -85,7 +85,7 @@ export const SaleTunnelStepPayment = ({ next }: SaleTunnelStepPaymentProps) => { creditCards.items.find((c) => c.is_main)?.id, ); - const [address, setAddress] = useState>(() => + const [address, setAddress] = useState>(() => addresses.items.find((a) => a.is_main), ); @@ -95,7 +95,7 @@ export const SaleTunnelStepPayment = ({ next }: SaleTunnelStepPaymentProps) => { ); const selectedAddress = useMemo( - (): Maybe => + (): Maybe
=> address || addresses.items.find((a) => a.is_main) || [...addresses.items].sort(sortAddressByTitleAsc)[0], @@ -107,7 +107,7 @@ export const SaleTunnelStepPayment = ({ next }: SaleTunnelStepPaymentProps) => { * If the selected address is a local one, we have to add it to the item list. * Finally, we sort address ascending by title before return them * - * @returns {Joanie.Address[]} Sorted addresses ascending by title + * @returns {Address[]} Sorted addresses ascending by title */ const addressesItems = useMemo(() => { const items = [...addresses.items]; diff --git a/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepResume/index.spec.tsx b/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepResume/index.spec.tsx index d1d440fd45..e979651674 100644 --- a/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepResume/index.spec.tsx +++ b/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepResume/index.spec.tsx @@ -4,7 +4,7 @@ import { CourseLightFactory, CredentialOrderFactory, ProductFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { SaleTunnelContext } from 'components/SaleTunnel/context'; import { SaleTunnelStepResume } from '.'; diff --git a/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepValidation/index.spec.tsx b/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepValidation/index.spec.tsx index e1db7a5244..0cc6045503 100644 --- a/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepValidation/index.spec.tsx +++ b/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepValidation/index.spec.tsx @@ -18,7 +18,7 @@ import { CourseLightFactory, CredentialProductFactory, EnrollmentFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { User } from 'types/User'; import { Maybe } from 'types/utils'; import { SaleTunnelContext, SaleTunnelContextType } from 'components/SaleTunnel/context'; diff --git a/src/frontend/js/components/SaleTunnel/index.spec.tsx b/src/frontend/js/components/SaleTunnel/index.spec.tsx index 227af33bc9..c9d1a66e41 100644 --- a/src/frontend/js/components/SaleTunnel/index.spec.tsx +++ b/src/frontend/js/components/SaleTunnel/index.spec.tsx @@ -4,7 +4,7 @@ import { Fragment } from 'react'; import { IntlProvider } from 'react-intl'; import { QueryClientProvider } from '@tanstack/react-query'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CourseLightFactory, ProductFactory } from 'utils/test/factories/joanie'; +import { CourseLightFactory, ProductFactory } from 'utils/test/factories/joanieLegacy'; import { SessionProvider } from 'contexts/SessionContext'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import SaleTunnel from '.'; diff --git a/src/frontend/js/components/SignContractButton/index.omniscientOrders.spec.tsx b/src/frontend/js/components/SignContractButton/index.omniscientOrders.spec.tsx index bc8f1589ee..91667dd612 100644 --- a/src/frontend/js/components/SignContractButton/index.omniscientOrders.spec.tsx +++ b/src/frontend/js/components/SignContractButton/index.omniscientOrders.spec.tsx @@ -5,7 +5,7 @@ import { MemoryRouter } from 'react-router-dom'; import userEvent from '@testing-library/user-event'; import { QueryClientProvider } from '@tanstack/react-query'; import fetchMock from 'fetch-mock'; -import { ContractFactory, CredentialOrderFactory } from 'utils/test/factories/joanie'; +import { ContractFactory, CredentialOrderFactory } from 'utils/test/factories/joanieLegacy'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { useOmniscientOrders } from 'hooks/useOrders'; diff --git a/src/frontend/js/components/SignContractButton/index.spec.tsx b/src/frontend/js/components/SignContractButton/index.spec.tsx index ed2b31ea2f..865e825343 100644 --- a/src/frontend/js/components/SignContractButton/index.spec.tsx +++ b/src/frontend/js/components/SignContractButton/index.spec.tsx @@ -9,7 +9,7 @@ import { ContractFactory, CredentialOrderFactory, NestedCredentialOrderFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import JoanieApiProvider from 'contexts/JoanieApiContext'; diff --git a/src/frontend/js/components/TeacherDashboardCourseList/index.spec.tsx b/src/frontend/js/components/TeacherDashboardCourseList/index.spec.tsx index 1a25e38a55..41a43a343f 100644 --- a/src/frontend/js/components/TeacherDashboardCourseList/index.spec.tsx +++ b/src/frontend/js/components/TeacherDashboardCourseList/index.spec.tsx @@ -1,20 +1,14 @@ -import { MemoryRouter } from 'react-router-dom'; -import { QueryClientProvider } from '@tanstack/react-query'; -import { render, screen } from '@testing-library/react'; +import { screen } from '@testing-library/react'; import fetchMock from 'fetch-mock'; -import { IntlProvider } from 'react-intl'; import { CourseListItem } from 'types/Joanie'; -import { - RichieContextFactory as mockRichieContextFactory, - UserFactory, -} from 'utils/test/factories/richie'; -import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; -import { CourseListItemFactory } from 'utils/test/factories/joanie'; -import { createTestQueryClient } from 'utils/test/createTestQueryClient'; +import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; +import { CourseListItemFactory } from 'utils/test/factories/joanieLegacy'; import { mockPaginatedResponse } from 'utils/test/mockPaginatedResponse'; import { expectNoSpinner } from 'utils/test/expectSpinner'; import { PER_PAGE } from 'settings'; +import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper'; +import { render } from 'utils/test/render'; import TeacherDashboardCourseList from '.'; jest.mock('utils/context', () => ({ @@ -40,14 +34,9 @@ jest.mock('hooks/useIntersectionObserver', () => ({ describe('components/TeacherDashboardCourseList', () => { const perPage = PER_PAGE.useCourseProductUnion; let nbApiCalls: number; + const joanieSessionData = setupJoanieSession(); beforeEach(() => { - fetchMock.get('https://joanie.endpoint/api/v1.0/orders/', [], { overwriteRoutes: true }); - fetchMock.get('https://joanie.endpoint/api/v1.0/credit-cards/', [], { overwriteRoutes: true }); - fetchMock.get('https://joanie.endpoint/api/v1.0/addresses/', [], { overwriteRoutes: true }); - nbApiCalls = 3; - }); - afterEach(() => { - fetchMock.restore(); + nbApiCalls = joanieSessionData.nbSessionApiRequest; }); it('should render', async () => { @@ -72,24 +61,13 @@ describe('components/TeacherDashboardCourseList', () => { mockPaginatedResponse([productCooking, productDancing], 15, false), ); - const user = UserFactory().one(); - render( - - - - - - - - - , - ); + render(); nbApiCalls += 1; // courses api call nbApiCalls += 1; // course-product-relations api call await expectNoSpinner('Loading courses...'); expect( - screen.getByRole('heading', { name: /TeacherDashboardCourseList test title/ }), + await screen.findByRole('heading', { name: /TeacherDashboardCourseList test title/ }), ).toBeInTheDocument(); const calledUrls = fetchMock.calls().map((call) => call[0]); @@ -131,31 +109,21 @@ describe('components/TeacherDashboardCourseList', () => { }, ); - const user = UserFactory().one(); - render( - - - - - - - - - , - ); + render(); nbApiCalls += 1; // courses api call nbApiCalls += 1; // course-product-relations api call + await expectNoSpinner('Loading courses...'); expect(await screen.getByRole('heading', { name: /TeacherDashboardCourseList test title/ })); const calledUrls = fetchMock.calls().map((call) => call[0]); - expect(calledUrls).toHaveLength(nbApiCalls); expect(calledUrls).toContain( `https://joanie.endpoint/api/v1.0/courses/?has_listed_course_runs=true&page=1&page_size=${perPage}`, ); expect(calledUrls).toContain( `https://joanie.endpoint/api/v1.0/course-product-relations/?product_type=credential&page=1&page_size=${perPage}`, ); + expect(calledUrls).toHaveLength(nbApiCalls); expect(await screen.findByText('You have no courses yet.')).toBeInTheDocument(); }); diff --git a/src/frontend/js/contexts/JoanieApiContext/index.tsx b/src/frontend/js/contexts/JoanieApiContext/index.tsx index 11e62cba32..4d2bf88b7f 100644 --- a/src/frontend/js/contexts/JoanieApiContext/index.tsx +++ b/src/frontend/js/contexts/JoanieApiContext/index.tsx @@ -1,7 +1,7 @@ import type { PropsWithChildren } from 'react'; import { createContext, useContext } from 'react'; import type * as Joanie from 'types/Joanie'; -import API from 'api/joanie'; +import { JoanieLegacyClient as JoanieApi } from 'api/joanie'; import type { Maybe } from 'types/utils'; const JoanieApiContext = createContext>(undefined); @@ -10,7 +10,7 @@ const JoanieApiContext = createContext>(undefined); * Provider to access to the Joanie API interface. */ const JoanieApiProvider = ({ children }: PropsWithChildren<{}>) => { - const api = API(); + const api = JoanieApi(); return {children}; }; diff --git a/src/frontend/js/contexts/SessionContext/index.spec.tsx b/src/frontend/js/contexts/SessionContext/index.spec.tsx index f6a634e4df..9d29fc5ccd 100644 --- a/src/frontend/js/contexts/SessionContext/index.spec.tsx +++ b/src/frontend/js/contexts/SessionContext/index.spec.tsx @@ -56,7 +56,7 @@ describe('SessionProvider', () => { }); it('uses BaseSessionProvider if joanie is disabled', async () => { - jest.doMock('api/joanie.ts', () => ({ + jest.doMock('api/joanie/index.ts', () => ({ isJoanieEnabled: false, })); jest.doMock('./BaseSessionProvider', () => ({ @@ -75,7 +75,7 @@ describe('SessionProvider', () => { }); it('uses JoanieSessionProvider if joanie is enabled', async () => { - jest.doMock('api/joanie.ts', () => ({ + jest.doMock('api/joanie/index.ts', () => ({ isJoanieEnabled: true, })); jest.doMock('./BaseSessionProvider', () => ({ diff --git a/src/frontend/js/hooks/useAddresses.ts b/src/frontend/js/hooks/useAddresses.ts index 672580402c..f743115555 100644 --- a/src/frontend/js/hooks/useAddresses.ts +++ b/src/frontend/js/hooks/useAddresses.ts @@ -1,9 +1,13 @@ import { defineMessages } from 'react-intl'; import { MutateOptions } from '@tanstack/react-query'; -import { useJoanieApi } from 'contexts/JoanieApiContext'; -import { Address, AddressCreationPayload, API } from 'types/Joanie'; +import { getApiClientJoanie } from 'api/joanie/client'; +import type { Address, AddressRequest } from 'api/joanie/gen'; +import { PatchedAddressRequest } from 'api/joanie/gen'; +import { ApiResourceInterface, PaginatedResourceQuery } from 'types/Joanie'; +import { Maybe } from 'types/utils'; import { HttpError } from 'utils/errors/HttpError'; -import { ResourcesQuery, useResource, useResources, UseResourcesProps } from './useResources'; + +import { useResource, useResources, UseResourcesProps } from './useResources'; const messages = defineMessages({ errorUpdate: { @@ -33,15 +37,38 @@ const messages = defineMessages({ }, }); -export type AddressesMutateOptions = MutateOptions; +export type AddressesMutateOptions = MutateOptions; + +const apiInterface: () => ApiResourceInterface = () => { + const joanieClient = getApiClientJoanie(); + return { + get: (resourceQuery?: Maybe) => { + const { id, ...filters } = resourceQuery || {}; + if (id) { + return joanieClient.addresses.addressesRetrieve(id); + } + return joanieClient.addresses.addressesList(filters.page, filters.page_size); + }, + create: (data: AddressRequest) => { + return joanieClient.addresses.addressesCreate(data); + }, + update: (data: AddressRequest & { id: string }) => { + const { id, ...updateData } = data; + return joanieClient.addresses.addressesUpdate(id, updateData); + }, + delete: (id: string) => { + return joanieClient.addresses.addressesDestroy(id); + }, + }; +}; /** * Joanie Api hook to retrieve/create/update/delete addresses * owned by the authenticated user. */ -const props: UseResourcesProps = { +const props: UseResourcesProps> = { queryKey: ['addresses'], - apiInterface: () => useJoanieApi().user.addresses, + apiInterface, omniscient: true, session: true, messages, diff --git a/src/frontend/js/hooks/useAddressesManagement.tsx b/src/frontend/js/hooks/useAddressesManagement.tsx index 91a4785c0b..62ca41e28a 100644 --- a/src/frontend/js/hooks/useAddressesManagement.tsx +++ b/src/frontend/js/hooks/useAddressesManagement.tsx @@ -1,8 +1,8 @@ import { defineMessages, useIntl } from 'react-intl'; import { MutateOptions } from '@tanstack/react-query'; import { useAddresses } from 'hooks/useAddresses'; -import * as Joanie from 'types/Joanie'; import { confirm } from 'utils/indirection/window'; +import { Address } from 'api/joanie/gen'; const messages = defineMessages({ errorCannotRemoveMain: { @@ -40,7 +40,7 @@ export function useAddressesManagement() { * * @param {Joanie.Address} address */ - const promote = (address: Joanie.Address) => { + const promote = (address: Address) => { if (address.is_main) { addresses.methods.setError(intl.formatMessage(messages.errorCannotPromoteMain)); return; @@ -58,7 +58,7 @@ export function useAddressesManagement() { * @param {Joanie.Address} address * @param {AddressesMutateOptions} options */ - const remove = (address: Joanie.Address, options?: MutateOptions) => { + const remove = (address: Address, options?: MutateOptions) => { if (address.is_main) { addresses.methods.setError(intl.formatMessage(messages.errorCannotRemoveMain)); return; diff --git a/src/frontend/js/hooks/useContractAbilities/index.spec.ts b/src/frontend/js/hooks/useContractAbilities/index.spec.ts index aa8bea7ad7..5d237291b6 100644 --- a/src/frontend/js/hooks/useContractAbilities/index.spec.ts +++ b/src/frontend/js/hooks/useContractAbilities/index.spec.ts @@ -1,6 +1,6 @@ import { renderHook } from '@testing-library/react'; import useContractAbilities from 'hooks/useContractAbilities/index'; -import { ContractFactory } from 'utils/test/factories/joanie'; +import { ContractFactory } from 'utils/test/factories/joanieLegacy'; import { ContractActions } from 'utils/AbilitiesHelper/types'; describe('useContractAbilities', () => { diff --git a/src/frontend/js/hooks/useCourseProductUnion/index.spec.tsx b/src/frontend/js/hooks/useCourseProductUnion/index.spec.tsx index 5ae0d1d0d8..b4135586dc 100644 --- a/src/frontend/js/hooks/useCourseProductUnion/index.spec.tsx +++ b/src/frontend/js/hooks/useCourseProductUnion/index.spec.tsx @@ -8,9 +8,12 @@ import { History, HistoryContext } from 'hooks/useHistory'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { SessionProvider } from 'contexts/SessionContext'; -import { getRoutes } from 'api/joanie'; +import { getRoutesLegacy } from 'api/joanie'; import { mockPaginatedResponse } from 'utils/test/mockPaginatedResponse'; -import { CourseListItemFactory, CourseProductRelationFactory } from 'utils/test/factories/joanie'; +import { + CourseListItemFactory, + CourseProductRelationFactory, +} from 'utils/test/factories/joanieLegacy'; import { useCourseProductUnion } from '.'; jest.mock('utils/context', () => ({ @@ -74,7 +77,7 @@ describe('useCourseProductUnion', () => { }); it('should call courses and coursesProductRelation endpoints', async () => { - const ROUTES = getRoutes(); + const ROUTES = getRoutesLegacy(); const coursesUrl = ROUTES.courses.get.replace(':id/', ''); const courseProductRelationsUrl = ROUTES.courseProductRelations.get.replace(':id/', ''); fetchMock.get( @@ -100,7 +103,7 @@ describe('useCourseProductUnion', () => { it('should call organization courses and organization coursesProductRelation endpoints', async () => { const organizationId = 'DUMMY_ORGANIZATION_ID'; - const ROUTES = getRoutes(); + const ROUTES = getRoutesLegacy(); const organizationCoursesUrl = ROUTES.organizations.courses.get .replace(':organization_id', organizationId) .replace(':id/', ''); diff --git a/src/frontend/js/hooks/useCourses/index.spec.tsx b/src/frontend/js/hooks/useCourses/index.spec.tsx index 76e201f047..f99a5c23aa 100644 --- a/src/frontend/js/hooks/useCourses/index.spec.tsx +++ b/src/frontend/js/hooks/useCourses/index.spec.tsx @@ -8,7 +8,7 @@ import { RichieContextFactory as mockRichieContextFactory, UserFactory, } from 'utils/test/factories/richie'; -import { CourseListItemFactory } from 'utils/test/factories/joanie'; +import { CourseListItemFactory } from 'utils/test/factories/joanieLegacy'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { User } from 'types/User'; diff --git a/src/frontend/js/hooks/useCreditCards/index.spec.tsx b/src/frontend/js/hooks/useCreditCards/index.spec.tsx index 3941f56cd3..704266f298 100644 --- a/src/frontend/js/hooks/useCreditCards/index.spec.tsx +++ b/src/frontend/js/hooks/useCreditCards/index.spec.tsx @@ -4,7 +4,7 @@ import fetchMock from 'fetch-mock'; import { PropsWithChildren } from 'react'; import { act, renderHook, waitFor } from '@testing-library/react'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CreditCardFactory } from 'utils/test/factories/joanie'; +import { CreditCardFactory } from 'utils/test/factories/joanieLegacy'; import { useCreditCard, useCreditCards } from 'hooks/useCreditCards/index'; import { SessionProvider } from 'contexts/SessionContext'; import { Deferred } from 'utils/test/deferred'; diff --git a/src/frontend/js/hooks/useDashboardAddressForm.tsx b/src/frontend/js/hooks/useDashboardAddressForm.tsx index 1a76b65ca1..994ea3197f 100644 --- a/src/frontend/js/hooks/useDashboardAddressForm.tsx +++ b/src/frontend/js/hooks/useDashboardAddressForm.tsx @@ -1,8 +1,7 @@ import { yupResolver } from '@hookform/resolvers/yup/dist/yup'; -import { FormProvider, useForm } from 'react-hook-form'; +import { DefaultValues, FormProvider, useForm } from 'react-hook-form'; import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; import * as Yup from 'yup'; -import countries from 'i18n-iso-countries'; import { Checkbox } from '@openfun/cunningham-react'; import { getLocalizedCunninghamErrorProp } from 'components/Form/utils'; @@ -10,7 +9,7 @@ import { messages as managementMessages } from 'components/AddressesManagement'; import { messages as formMessages } from 'components/Form/messages'; import { CountrySelectField } from 'components/Form/CountrySelectField'; import Input from 'components/Form/Input'; -import { Address } from 'types/Joanie'; +import { Address, CountryEnum } from 'api/joanie/gen'; const messages = defineMessages({ isMainInputLabel: { @@ -25,15 +24,15 @@ const messages = defineMessages({ const validationSchema = Yup.object().shape({ address: Yup.string().required(), city: Yup.string().required(), - country: Yup.string().oneOf(Object.keys(countries.getAlpha2Codes())).required(), + country: Yup.mixed().oneOf(Object.values(CountryEnum)).defined(), first_name: Yup.string().required(), last_name: Yup.string().required(), postcode: Yup.string().required(), title: Yup.string().required().min(2), - is_main: Yup.boolean().required(), + is_main: Yup.boolean(), }); -export type AddressFormValues = Omit; +export type AddressFormValues = Omit & {}; /** * Hook to implement a form to edit or create an Address. @@ -43,16 +42,9 @@ export type AddressFormValues = Omit; export const useDashboardAddressForm = (address?: Address) => { const intl = useIntl(); - const defaultValues = { - title: '', - first_name: '', - last_name: '', - address: '', - postcode: '', - city: '', - country: '-', + const defaultValues: DefaultValues = { is_main: true, - } as AddressFormValues; + }; const form = useForm({ defaultValues: address || defaultValues, diff --git a/src/frontend/js/hooks/useDefaultOrganizationId/index.spec.tsx b/src/frontend/js/hooks/useDefaultOrganizationId/index.spec.tsx index 3c746c680c..55024aabae 100644 --- a/src/frontend/js/hooks/useDefaultOrganizationId/index.spec.tsx +++ b/src/frontend/js/hooks/useDefaultOrganizationId/index.spec.tsx @@ -1,9 +1,9 @@ import { renderHook, waitFor } from '@testing-library/react'; import fetchMock from 'fetch-mock'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { OrganizationFactory } from 'utils/test/factories/joanie'; +import { OrganizationFactory } from 'utils/test/factories/joanieLegacy'; import { Organization } from 'types/Joanie'; -import { JoanieAppWrapper, setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper'; +import JoanieAppWrapper, { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper'; import useDefaultOrganizationId from '.'; jest.mock('utils/context', () => ({ diff --git a/src/frontend/js/hooks/useDownloadCertificate/index.spec.tsx b/src/frontend/js/hooks/useDownloadCertificate/index.spec.tsx index b0718e1ee7..cf1c8cb80b 100644 --- a/src/frontend/js/hooks/useDownloadCertificate/index.spec.tsx +++ b/src/frontend/js/hooks/useDownloadCertificate/index.spec.tsx @@ -10,7 +10,7 @@ import { handle } from 'utils/errors/handle'; import { Certificate } from 'types/Joanie'; import { SessionProvider } from 'contexts/SessionContext'; import { Deferred } from 'utils/test/deferred'; -import { CertificateFactory } from 'utils/test/factories/joanie'; +import { CertificateFactory } from 'utils/test/factories/joanieLegacy'; import { HttpStatusCode } from 'utils/errors/HttpError'; jest.mock('utils/errors/handle'); diff --git a/src/frontend/js/hooks/useJoanieUserAbilities/index.spec.tsx b/src/frontend/js/hooks/useJoanieUserAbilities/index.spec.tsx index 53a4febdf6..73c05350bb 100644 --- a/src/frontend/js/hooks/useJoanieUserAbilities/index.spec.tsx +++ b/src/frontend/js/hooks/useJoanieUserAbilities/index.spec.tsx @@ -4,7 +4,7 @@ import { QueryClientProvider } from '@tanstack/react-query'; import { PropsWithChildren } from 'react'; import { IntlProvider } from 'react-intl'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { JoanieUserProfileFactory } from 'utils/test/factories/joanie'; +import { JoanieUserProfileFactory } from 'utils/test/factories/joanieLegacy'; import { JoanieUserApiAbilityActions } from 'types/User'; import { JoanieUserProfileActions } from 'utils/AbilitiesHelper/types'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; diff --git a/src/frontend/js/hooks/useProductOrder/index.spec.tsx b/src/frontend/js/hooks/useProductOrder/index.spec.tsx index 5511ffa56f..bb8f0b3e53 100644 --- a/src/frontend/js/hooks/useProductOrder/index.spec.tsx +++ b/src/frontend/js/hooks/useProductOrder/index.spec.tsx @@ -5,7 +5,7 @@ import { PropsWithChildren } from 'react'; import { act, renderHook, waitFor } from '@testing-library/react'; import { faker } from '@faker-js/faker'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CourseLightFactory, CredentialOrderFactory } from 'utils/test/factories/joanie'; +import { CourseLightFactory, CredentialOrderFactory } from 'utils/test/factories/joanieLegacy'; import { SessionProvider } from 'contexts/SessionContext'; import { Deferred } from 'utils/test/deferred'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; diff --git a/src/frontend/js/hooks/useResources/index.spec.tsx b/src/frontend/js/hooks/useResources/index.spec.tsx index e784ad4333..f1b93ba36b 100644 --- a/src/frontend/js/hooks/useResources/index.spec.tsx +++ b/src/frontend/js/hooks/useResources/index.spec.tsx @@ -106,7 +106,8 @@ describe('useResources (omniscient)', () => { wrapper: Wrapper, }); - await waitFor(() => expect(result.current.states.isPending).toBe(true)); + await waitFor(() => expect(screen.queryByText('loading...')).not.toBeInTheDocument()); + expect(result.current.states.isPending).toBe(true); expect(result.current.states.fetching).toBe(true); expect(result.current.items).toEqual([]); @@ -222,8 +223,9 @@ describe('useResources (omniscient)', () => { wrapper: Wrapper, }, ); - - expect(result.current.states.isPending).toBe(true); + await waitFor(() => { + expect(result.current.states.isPending).toBe(true); + }); expect(result.current.item).toBe(undefined); expect(fetchMock.called('https://example.com/api/todos')).toBe(false); diff --git a/src/frontend/js/pages/DashboardAddressesManagement/DashboardAddressBox.tsx b/src/frontend/js/pages/DashboardAddressesManagement/DashboardAddressBox.tsx index 25caf6ba12..45d0e2df9a 100644 --- a/src/frontend/js/pages/DashboardAddressesManagement/DashboardAddressBox.tsx +++ b/src/frontend/js/pages/DashboardAddressesManagement/DashboardAddressBox.tsx @@ -1,7 +1,7 @@ import { defineMessages, FormattedMessage } from 'react-intl'; import { Button } from '@openfun/cunningham-react'; import { DashboardBox } from 'widgets/Dashboard/components/DashboardBox'; -import { Address } from 'types/Joanie'; +import { Address } from 'api/joanie/gen'; const messages = defineMessages({ isMain: { diff --git a/src/frontend/js/pages/DashboardAddressesManagement/DashboardCreateAddress.spec.tsx b/src/frontend/js/pages/DashboardAddressesManagement/DashboardCreateAddress.spec.tsx index b0d6c7719e..1771aead2b 100644 --- a/src/frontend/js/pages/DashboardAddressesManagement/DashboardCreateAddress.spec.tsx +++ b/src/frontend/js/pages/DashboardAddressesManagement/DashboardCreateAddress.spec.tsx @@ -6,17 +6,17 @@ import { IntlProvider } from 'react-intl'; import userEvent, { UserEvent } from '@testing-library/user-event'; import { PropsWithChildren } from 'react'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { AddressFactory } from 'utils/test/factories/joanie'; import { SessionProvider } from 'contexts/SessionContext'; import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; -import { Address } from 'types/Joanie'; import { expectFetchCall } from 'utils/test/expectFetchCall'; import { expectBreadcrumbsToEqualParts } from 'utils/test/expectBreadcrumbsToEqualParts'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { expectBannerError } from 'utils/test/expectBanner'; import { changeSelect } from 'components/Form/test-utils'; import { HttpStatusCode } from 'utils/errors/HttpError'; +import { Address } from 'api/joanie/gen'; +import { AddressFactory } from 'utils/test/factories/joanieGen'; jest.mock('utils/context', () => ({ __esModule: true, diff --git a/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.spec.tsx b/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.spec.tsx index 7a3e1383fc..01eeacf425 100644 --- a/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.spec.tsx +++ b/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.spec.tsx @@ -11,7 +11,6 @@ import { } from '@testing-library/react'; import { IntlProvider } from 'react-intl'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { AddressFactory } from 'utils/test/factories/joanie'; import { SessionProvider } from 'contexts/SessionContext'; import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; @@ -20,6 +19,7 @@ import { expectBreadcrumbsToEqualParts } from 'utils/test/expectBreadcrumbsToEqu import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { HttpStatusCode } from 'utils/errors/HttpError'; +import { AddressFactory } from 'utils/test/factories/joanieGen'; jest.mock('utils/context', () => ({ __esModule: true, @@ -42,9 +42,10 @@ describe('', () => { it('updates an address', async () => { const address = AddressFactory().one(); - const addressUpdated = AddressFactory().one(); - // It must keep the same id. - addressUpdated.id = address.id; + const addressUpdated = AddressFactory({ + // It must keep the same id. + id: address.id, + }).one(); fetchMock.get('https://joanie.endpoint/api/v1.0/addresses/', [address]); const updateUrl = 'https://joanie.endpoint/api/v1.0/addresses/' + address.id + '/'; fetchMock.put(updateUrl, HttpStatusCode.OK); diff --git a/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.stories.tsx b/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.stories.tsx index d37556dcfd..a5ac08db9c 100644 --- a/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.stories.tsx +++ b/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.stories.tsx @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react'; import { StorybookHelper } from 'utils/StorybookHelper'; -import { AddressFactory } from 'utils/test/factories/joanie'; +import { AddressFactory } from 'utils/test/factories/joanieGen'; import { DashboardEditAddress } from './DashboardEditAddress'; export default { diff --git a/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.tsx b/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.tsx index 5923c33b03..3e46b9d685 100644 --- a/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.tsx +++ b/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.tsx @@ -5,8 +5,8 @@ import { DashboardCard } from 'widgets/Dashboard/components/DashboardCard'; import { Spinner } from 'components/Spinner'; import { useAddressesManagement } from 'hooks/useAddressesManagement'; import { AddressFormValues, useDashboardAddressForm } from 'hooks/useDashboardAddressForm'; -import { Address } from 'types/Joanie'; import { noop } from 'utils'; +import { Address } from 'api/joanie/gen'; const messages = defineMessages({ header: { diff --git a/src/frontend/js/pages/DashboardAddressesManagement/index.spec.tsx b/src/frontend/js/pages/DashboardAddressesManagement/index.spec.tsx index 554b1f6c38..c9489e3114 100644 --- a/src/frontend/js/pages/DashboardAddressesManagement/index.spec.tsx +++ b/src/frontend/js/pages/DashboardAddressesManagement/index.spec.tsx @@ -12,16 +12,16 @@ import { QueryClientProvider } from '@tanstack/react-query'; import fetchMock from 'fetch-mock'; import { findByText } from '@storybook/testing-library'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { AddressFactory } from 'utils/test/factories/joanie'; import { SessionProvider } from 'contexts/SessionContext'; import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; -import * as Joanie from 'types/Joanie'; import { expectBreadcrumbsToEqualParts } from 'utils/test/expectBreadcrumbsToEqualParts'; import { resolveAll } from 'utils/resolveAll'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { expectBannerError } from 'utils/test/expectBanner'; import { HttpStatusCode } from 'utils/errors/HttpError'; +import { AddressFactory } from 'utils/test/factories/joanieGen'; +import { Address } from 'api/joanie/gen'; jest.mock('utils/context', () => ({ __esModule: true, @@ -85,7 +85,7 @@ describe('', () => { // No error is shown. expect(screen.queryByText('An error occurred', { exact: false })).toBeNull(); // Each addresses is displayed. - await resolveAll(addresses, async (address: Joanie.Address) => { + await resolveAll(addresses, async (address: Address) => { await screen.findByText(address.title); }); }); diff --git a/src/frontend/js/pages/DashboardAddressesManagement/index.tsx b/src/frontend/js/pages/DashboardAddressesManagement/index.tsx index 5241a60a81..77528a3a8a 100644 --- a/src/frontend/js/pages/DashboardAddressesManagement/index.tsx +++ b/src/frontend/js/pages/DashboardAddressesManagement/index.tsx @@ -6,7 +6,7 @@ import { DashboardCard } from 'widgets/Dashboard/components/DashboardCard'; import { Icon, IconTypeEnum } from 'components/Icon'; import { Spinner } from 'components/Spinner'; import { useAddressesManagement } from 'hooks/useAddressesManagement'; -import { Address } from 'types/Joanie'; +import { Address } from 'api/joanie/gen'; import { DashboardAddressBox } from './DashboardAddressBox'; const messages = defineMessages({ diff --git a/src/frontend/js/pages/DashboardCertificates/index.spec.tsx b/src/frontend/js/pages/DashboardCertificates/index.spec.tsx index 532f59d97c..deb3668911 100644 --- a/src/frontend/js/pages/DashboardCertificates/index.spec.tsx +++ b/src/frontend/js/pages/DashboardCertificates/index.spec.tsx @@ -14,7 +14,7 @@ import { History, HistoryContext } from 'hooks/useHistory'; import { SessionProvider } from 'contexts/SessionContext'; import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; -import { CertificateFactory } from 'utils/test/factories/joanie'; +import { CertificateFactory } from 'utils/test/factories/joanieLegacy'; import { HttpStatusCode } from 'utils/errors/HttpError'; jest.mock('utils/context', () => ({ diff --git a/src/frontend/js/pages/DashboardContracts/index.spec.tsx b/src/frontend/js/pages/DashboardContracts/index.spec.tsx index b06c44cb71..d65c70f222 100644 --- a/src/frontend/js/pages/DashboardContracts/index.spec.tsx +++ b/src/frontend/js/pages/DashboardContracts/index.spec.tsx @@ -14,7 +14,7 @@ import { History, HistoryContext } from 'hooks/useHistory'; import { SessionProvider } from 'contexts/SessionContext'; import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; -import { ContractFactory } from 'utils/test/factories/joanie'; +import { ContractFactory } from 'utils/test/factories/joanieLegacy'; jest.mock('utils/context', () => ({ __esModule: true, diff --git a/src/frontend/js/pages/DashboardCourses/index.spec.tsx b/src/frontend/js/pages/DashboardCourses/index.spec.tsx index 445222122a..3a122a634d 100644 --- a/src/frontend/js/pages/DashboardCourses/index.spec.tsx +++ b/src/frontend/js/pages/DashboardCourses/index.spec.tsx @@ -8,7 +8,7 @@ import { CourseProductRelationFactory, EnrollmentFactory, CredentialOrderFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; import { CourseLight, CourseProductRelation, Enrollment, CredentialOrder } from 'types/Joanie'; diff --git a/src/frontend/js/pages/DashboardCreditCardsManagement/CreditCardBrandLogo.stories.tsx b/src/frontend/js/pages/DashboardCreditCardsManagement/CreditCardBrandLogo.stories.tsx index 90293741b1..f49c8217db 100644 --- a/src/frontend/js/pages/DashboardCreditCardsManagement/CreditCardBrandLogo.stories.tsx +++ b/src/frontend/js/pages/DashboardCreditCardsManagement/CreditCardBrandLogo.stories.tsx @@ -1,5 +1,5 @@ import { Meta, StoryObj } from '@storybook/react'; -import { CreditCardFactory } from 'utils/test/factories/joanie'; +import { CreditCardFactory } from 'utils/test/factories/joanieLegacy'; import { CreditCard, CreditCardBrand } from 'types/Joanie'; import { CreditCardBrandLogo } from './CreditCardBrandLogo'; diff --git a/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.spec.tsx b/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.spec.tsx index 01ff01b0a6..4ec1411062 100644 --- a/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.spec.tsx +++ b/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.spec.tsx @@ -11,7 +11,7 @@ import { QueryClientProvider } from '@tanstack/react-query'; import { IntlProvider } from 'react-intl'; import fetchMock from 'fetch-mock'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CreditCardFactory } from 'utils/test/factories/joanie'; +import { CreditCardFactory } from 'utils/test/factories/joanieLegacy'; import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest'; import { SessionProvider } from 'contexts/SessionContext'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; diff --git a/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.stories.tsx b/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.stories.tsx index 58756f60ce..b73052f24e 100644 --- a/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.stories.tsx +++ b/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.stories.tsx @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react'; import { StorybookHelper } from 'utils/StorybookHelper'; -import { CreditCardFactory } from 'utils/test/factories/joanie'; +import { CreditCardFactory } from 'utils/test/factories/joanieLegacy'; import { DashboardEditCreditCard } from './DashboardEditCreditCard'; export default { diff --git a/src/frontend/js/pages/DashboardCreditCardsManagement/index.spec.tsx b/src/frontend/js/pages/DashboardCreditCardsManagement/index.spec.tsx index f2714e0810..c2a1468b6f 100644 --- a/src/frontend/js/pages/DashboardCreditCardsManagement/index.spec.tsx +++ b/src/frontend/js/pages/DashboardCreditCardsManagement/index.spec.tsx @@ -13,7 +13,7 @@ import { import { IntlProvider } from 'react-intl'; import { faker } from '@faker-js/faker'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CreditCardFactory } from 'utils/test/factories/joanie'; +import { CreditCardFactory } from 'utils/test/factories/joanieLegacy'; import { SessionProvider } from 'contexts/SessionContext'; import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; diff --git a/src/frontend/js/pages/DashboardOrderLayout/index.spec.tsx b/src/frontend/js/pages/DashboardOrderLayout/index.spec.tsx index 3b50fbd47a..e45d63a31d 100644 --- a/src/frontend/js/pages/DashboardOrderLayout/index.spec.tsx +++ b/src/frontend/js/pages/DashboardOrderLayout/index.spec.tsx @@ -4,7 +4,7 @@ import { IntlProvider } from 'react-intl'; import fetchMock from 'fetch-mock'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { CredentialOrder } from 'types/Joanie'; -import { CredentialOrderFactory, TargetCourseFactory } from 'utils/test/factories/joanie'; +import { CredentialOrderFactory, TargetCourseFactory } from 'utils/test/factories/joanieLegacy'; import { mockCourseProductWithOrder } from 'utils/test/mockCourseProductWithOrder'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; diff --git a/src/frontend/js/pages/TeacherDashboardContractsLayout/TeacherDashboardContracts/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardContractsLayout/TeacherDashboardContracts/index.spec.tsx index 8c3dcd33a0..f4182646db 100644 --- a/src/frontend/js/pages/TeacherDashboardContractsLayout/TeacherDashboardContracts/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardContractsLayout/TeacherDashboardContracts/index.spec.tsx @@ -7,7 +7,7 @@ import { ContractFactory, CourseProductRelationFactory, OrganizationFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { expectNoSpinner } from 'utils/test/expectSpinner'; import { expectBannerError } from 'utils/test/expectBanner'; import { HttpStatusCode } from 'utils/errors/HttpError'; diff --git a/src/frontend/js/pages/TeacherDashboardContractsLayout/components/ContractFiltersBar/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardContractsLayout/components/ContractFiltersBar/index.spec.tsx index ab73c58bef..3a82b57d55 100644 --- a/src/frontend/js/pages/TeacherDashboardContractsLayout/components/ContractFiltersBar/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardContractsLayout/components/ContractFiltersBar/index.spec.tsx @@ -3,7 +3,7 @@ import fetchMock from 'fetch-mock'; import { userEvent } from '@testing-library/user-event'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { ContractState } from 'types/Joanie'; -import { OrganizationFactory } from 'utils/test/factories/joanie'; +import { OrganizationFactory } from 'utils/test/factories/joanieLegacy'; import { expectNoSpinner } from 'utils/test/expectSpinner'; import { noop } from 'utils'; import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper'; diff --git a/src/frontend/js/pages/TeacherDashboardContractsLayout/hooks/useHasContractToDownload/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardContractsLayout/hooks/useHasContractToDownload/index.spec.tsx index c3c57cc8b8..297d8736cf 100644 --- a/src/frontend/js/pages/TeacherDashboardContractsLayout/hooks/useHasContractToDownload/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardContractsLayout/hooks/useHasContractToDownload/index.spec.tsx @@ -7,7 +7,7 @@ import { PropsWithChildren } from 'react'; import { PER_PAGE } from 'settings'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { ContractState } from 'types/Joanie'; -import { ContractFactory } from 'utils/test/factories/joanie'; +import { ContractFactory } from 'utils/test/factories/joanieLegacy'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; import useHasContractToDownload from '.'; diff --git a/src/frontend/js/pages/TeacherDashboardContractsLayout/hooks/useTeacherContractFilters/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardContractsLayout/hooks/useTeacherContractFilters/index.spec.tsx index d55d20a9f7..34dc27398d 100644 --- a/src/frontend/js/pages/TeacherDashboardContractsLayout/hooks/useTeacherContractFilters/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardContractsLayout/hooks/useTeacherContractFilters/index.spec.tsx @@ -8,7 +8,10 @@ import { act } from 'react-dom/test-utils'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; -import { CourseProductRelationFactory, OrganizationFactory } from 'utils/test/factories/joanie'; +import { + CourseProductRelationFactory, + OrganizationFactory, +} from 'utils/test/factories/joanieLegacy'; import { ContractState } from 'types/Joanie'; import useTeacherContractFilters from '.'; diff --git a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid/index.spec.tsx index 525ef6a13f..6dd41b9056 100644 --- a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid/index.spec.tsx @@ -2,7 +2,7 @@ import { createIntl } from 'react-intl'; import { screen } from '@testing-library/react'; import { getAllByRole, within } from '@testing-library/dom'; import { faker } from '@faker-js/faker'; -import { NestedCourseOrderFactory } from 'utils/test/factories/joanie'; +import { NestedCourseOrderFactory } from 'utils/test/factories/joanieLegacy'; import { expectNoSpinner } from 'utils/test/expectSpinner'; import { PaginationFactory } from 'utils/test/factories/cunningham'; import { DEFAULT_DATE_FORMAT } from 'hooks/useDateFormat'; diff --git a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnersFiltersBar/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnersFiltersBar/index.spec.tsx index cb4bb78e12..958ef94c47 100644 --- a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnersFiltersBar/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnersFiltersBar/index.spec.tsx @@ -2,7 +2,7 @@ import { screen } from '@testing-library/react'; import { userEvent } from '@testing-library/user-event'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { ContractState } from 'types/Joanie'; -import { OrganizationFactory } from 'utils/test/factories/joanie'; +import { OrganizationFactory } from 'utils/test/factories/joanieLegacy'; import { noop } from 'utils'; import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper'; import { render } from 'utils/test/render'; @@ -36,7 +36,7 @@ describe('', () => { ); // Two selects should have rendered - const organizationFilter: HTMLInputElement = screen.getByRole('combobox', { + const organizationFilter: HTMLInputElement = await screen.findByRole('combobox', { name: 'Organization', }); diff --git a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/hooks/useCourseLearnersFilters/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/hooks/useCourseLearnersFilters/index.spec.tsx index 3abe17ddbc..4241878507 100644 --- a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/hooks/useCourseLearnersFilters/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/hooks/useCourseLearnersFilters/index.spec.tsx @@ -2,8 +2,11 @@ import fetchMock from 'fetch-mock'; import { renderHook, waitFor } from '@testing-library/react'; import { act } from 'react-dom/test-utils'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CourseProductRelationFactory, OrganizationFactory } from 'utils/test/factories/joanie'; -import { JoanieAppWrapper, setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper'; +import { + CourseProductRelationFactory, + OrganizationFactory, +} from 'utils/test/factories/joanieLegacy'; +import JoanieAppWrapper, { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper'; import useCourseLearnersFilters from '.'; jest.mock('utils/context', () => ({ diff --git a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/index.spec.tsx index 6fe9b6efee..8c62460525 100644 --- a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/index.spec.tsx @@ -7,7 +7,7 @@ import { CourseProductRelationFactory, NestedCourseOrderFactory, OrganizationFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { expectNoSpinner } from 'utils/test/expectSpinner'; import { PER_PAGE } from 'settings'; import { HttpStatusCode } from 'utils/errors/HttpError'; diff --git a/src/frontend/js/pages/TeacherDashboardCourseLoader/CourseRunList/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardCourseLoader/CourseRunList/index.spec.tsx index 616777f565..6aaaa3c470 100644 --- a/src/frontend/js/pages/TeacherDashboardCourseLoader/CourseRunList/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardCourseLoader/CourseRunList/index.spec.tsx @@ -3,7 +3,7 @@ import { IntlProvider } from 'react-intl'; import { CunninghamProvider } from '@openfun/cunningham-react'; import { capitalize } from 'lodash-es'; import { MemoryRouter } from 'react-router-dom'; -import { CourseRunFactory } from 'utils/test/factories/joanie'; +import { CourseRunFactory } from 'utils/test/factories/joanieLegacy'; import CourseRunList from '.'; describe('pages/TeacherDashboardCourseLoader/CourseRunList', () => { diff --git a/src/frontend/js/pages/TeacherDashboardCourseLoader/CourseRunList/utils.spec.tsx b/src/frontend/js/pages/TeacherDashboardCourseLoader/CourseRunList/utils.spec.tsx index f7f6e43c25..e1468da006 100644 --- a/src/frontend/js/pages/TeacherDashboardCourseLoader/CourseRunList/utils.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardCourseLoader/CourseRunList/utils.spec.tsx @@ -2,7 +2,7 @@ import { IntlProvider, createIntl } from 'react-intl'; import { render, screen } from '@testing-library/react'; import { capitalize } from 'lodash-es'; import { MemoryRouter } from 'react-router-dom'; -import { CourseRunFactory } from 'utils/test/factories/joanie'; +import { CourseRunFactory } from 'utils/test/factories/joanieLegacy'; import { buildCourseRunData, messages } from './utils'; describe('pages/TeacherDashboardCourseLoader/CourseRunList/buildCourseRunData', () => { diff --git a/src/frontend/js/pages/TeacherDashboardCoursesLoader/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardCoursesLoader/index.spec.tsx index 1450de8304..0cdec7e6b3 100644 --- a/src/frontend/js/pages/TeacherDashboardCoursesLoader/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardCoursesLoader/index.spec.tsx @@ -10,7 +10,10 @@ import { UserFactory, } from 'utils/test/factories/richie'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; -import { CourseListItemFactory, CourseProductRelationFactory } from 'utils/test/factories/joanie'; +import { + CourseListItemFactory, + CourseProductRelationFactory, +} from 'utils/test/factories/joanieLegacy'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { expectNoSpinner } from 'utils/test/expectSpinner'; import { mockPaginatedResponse } from 'utils/test/mockPaginatedResponse'; diff --git a/src/frontend/js/pages/TeacherDashboardTraining/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardTraining/index.spec.tsx index 9b2ba52f16..30fe516b28 100644 --- a/src/frontend/js/pages/TeacherDashboardTraining/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardTraining/index.spec.tsx @@ -11,7 +11,10 @@ import { UserFactory, } from 'utils/test/factories/richie'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; -import { CourseProductRelationFactory, OrganizationFactory } from 'utils/test/factories/joanie'; +import { + CourseProductRelationFactory, + OrganizationFactory, +} from 'utils/test/factories/joanieLegacy'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { expectNoSpinner } from 'utils/test/expectSpinner'; import { DashboardBreadcrumbsProvider } from 'widgets/Dashboard/contexts/DashboardBreadcrumbsContext'; diff --git a/src/frontend/js/types/Joanie.ts b/src/frontend/js/types/Joanie.ts index d2bdb918f2..cc07aaf696 100644 --- a/src/frontend/js/types/Joanie.ts +++ b/src/frontend/js/types/Joanie.ts @@ -3,6 +3,7 @@ import type { Maybe, Nullable } from 'types/utils'; import { Resource, ResourcesQuery } from 'hooks/useResources'; import { OrderResourcesQuery } from 'hooks/useOrders'; import { Course as RichieCourse } from 'types/Course'; +import { Address as AddressGen } from 'api/joanie/gen'; import { JoanieUserProfile } from './User'; // - Generic @@ -33,7 +34,7 @@ export interface Organization { contact_email: Nullable; contact_phone: Nullable; dpo_email: Nullable; - address?: Address; + address?: AddressGen; } export interface OrganizationResourceQuery extends ResourcesQuery { @@ -371,19 +372,6 @@ export interface CreditCard { title?: string; } -// Address -export interface Address { - address: string; - city: string; - country: string; - first_name: string; - last_name: string; - id: string; - is_main: boolean; - postcode: string; - title: string; -} - // Wishlist export interface CourseWish extends Resource { status: boolean; @@ -414,10 +402,6 @@ export interface OrderPaymentInfo { } // - API -export interface AddressCreationPayload extends Omit { - is_main?: boolean; -} - interface AbstractOrderProductCreationPayload { product_id: Product['id']; order_group_id?: OrderGroup['id']; @@ -440,7 +424,7 @@ interface OrderAbortPayload { interface OrderSubmitPayload { id: Order['id']; - billing_address: Omit; + billing_address: Omit; credit_card_id?: CreditCard['id']; } @@ -524,13 +508,6 @@ interface APIUser { me: { get(): Promise; }; - addresses: { - create(payload: AddressCreationPayload): Promise
; - delete(id: Address['id']): Promise; - get(id: Address['id']): Promise
; - get(): Promise; - update(payload: Address): Promise
; - }; creditCards: { create(payload: Omit): Promise; delete(id: CreditCard['id']): Promise; diff --git a/src/frontend/js/utils/AbilitiesHelper/contractAbilities.spec.ts b/src/frontend/js/utils/AbilitiesHelper/contractAbilities.spec.ts index ea14e5b235..98341151a7 100644 --- a/src/frontend/js/utils/AbilitiesHelper/contractAbilities.spec.ts +++ b/src/frontend/js/utils/AbilitiesHelper/contractAbilities.spec.ts @@ -1,5 +1,5 @@ import { faker } from '@faker-js/faker'; -import { ContractFactory } from 'utils/test/factories/joanie'; +import { ContractFactory } from 'utils/test/factories/joanieLegacy'; import { ContractActions } from 'utils/AbilitiesHelper/types'; import AbilitiesHelper from '.'; diff --git a/src/frontend/js/utils/AbilitiesHelper/joanieUserProfileAbilities.spec.ts b/src/frontend/js/utils/AbilitiesHelper/joanieUserProfileAbilities.spec.ts index f369b6be7d..4a839efdab 100644 --- a/src/frontend/js/utils/AbilitiesHelper/joanieUserProfileAbilities.spec.ts +++ b/src/frontend/js/utils/AbilitiesHelper/joanieUserProfileAbilities.spec.ts @@ -1,5 +1,5 @@ import { JoanieUserApiAbilityActions } from 'types/User'; -import { JoanieUserProfileFactory } from 'utils/test/factories/joanie'; +import { JoanieUserProfileFactory } from 'utils/test/factories/joanieLegacy'; import { JoanieUserProfileActions } from './types'; import AbilitiesHelper from '.'; diff --git a/src/frontend/js/utils/ContractHelper/index.spec.ts b/src/frontend/js/utils/ContractHelper/index.spec.ts index 46c3652eb2..50e1adbe8c 100644 --- a/src/frontend/js/utils/ContractHelper/index.spec.ts +++ b/src/frontend/js/utils/ContractHelper/index.spec.ts @@ -1,5 +1,5 @@ import { createIntl } from 'react-intl'; -import { ContractFactory } from 'utils/test/factories/joanie'; +import { ContractFactory } from 'utils/test/factories/joanieLegacy'; import { ContractState } from 'types/Joanie'; import { ContractHelper, ContractStatePoV } from '.'; diff --git a/src/frontend/js/utils/CoursesHelper/index.spec.ts b/src/frontend/js/utils/CoursesHelper/index.spec.ts index 5d3c7c5cfe..5ae641ab98 100644 --- a/src/frontend/js/utils/CoursesHelper/index.spec.ts +++ b/src/frontend/js/utils/CoursesHelper/index.spec.ts @@ -4,7 +4,7 @@ import { EnrollmentFactory, CredentialOrderFactory, TargetCourseFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; describe('CourseHelper', () => { it('should find an active course enrollment in order', () => { diff --git a/src/frontend/js/utils/CreditCardHelper/index.spec.tsx b/src/frontend/js/utils/CreditCardHelper/index.spec.tsx index ce1e5849bf..f79bf07d5c 100644 --- a/src/frontend/js/utils/CreditCardHelper/index.spec.tsx +++ b/src/frontend/js/utils/CreditCardHelper/index.spec.tsx @@ -1,6 +1,6 @@ import { faker } from '@faker-js/faker'; import { CreditCardExpirationStatus, CreditCardHelper } from 'utils/CreditCardHelper/index'; -import { CreditCardFactory } from 'utils/test/factories/joanie'; +import { CreditCardFactory } from 'utils/test/factories/joanieLegacy'; describe('CreditCardHelper', () => { it('handles falsy values', () => { diff --git a/src/frontend/js/utils/ProductHelper/index.spec.ts b/src/frontend/js/utils/ProductHelper/index.spec.ts index 8ecac9ecbd..9a1a141c32 100644 --- a/src/frontend/js/utils/ProductHelper/index.spec.ts +++ b/src/frontend/js/utils/ProductHelper/index.spec.ts @@ -1,5 +1,9 @@ import { createIntl } from 'react-intl'; -import { CourseRunFactory, ProductFactory, TargetCourseFactory } from 'utils/test/factories/joanie'; +import { + CourseRunFactory, + ProductFactory, + TargetCourseFactory, +} from 'utils/test/factories/joanieLegacy'; import { ProductHelper } from '.'; describe('ProductHelper', () => { diff --git a/src/frontend/js/utils/react-query/useSessionMutation/index.spec.tsx b/src/frontend/js/utils/react-query/useSessionMutation/index.spec.tsx index ecd9d195ca..75c663dfba 100644 --- a/src/frontend/js/utils/react-query/useSessionMutation/index.spec.tsx +++ b/src/frontend/js/utils/react-query/useSessionMutation/index.spec.tsx @@ -5,7 +5,7 @@ import { renderHook, waitFor } from '@testing-library/react'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import BaseSessionProvider from 'contexts/SessionContext/BaseSessionProvider'; import { useSession } from 'contexts/SessionContext'; -import { checkStatus } from 'api/joanie'; +import { checkStatusLegacy } from 'api/joanie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { HttpStatusCode } from 'utils/errors/HttpError'; import { useSessionMutation } from '.'; @@ -41,7 +41,7 @@ describe('useSessionMutation', () => { const session = useSession(); const mutation = useSessionMutation({ mutationFn: () => - fetch('http://api.endpoint/orders/create', { method: 'POST' }).then(checkStatus), + fetch('http://api.endpoint/orders/create', { method: 'POST' }).then(checkStatusLegacy), onError: handleError, }); diff --git a/src/frontend/js/utils/react-query/useSessionQuery/index.spec.tsx b/src/frontend/js/utils/react-query/useSessionQuery/index.spec.tsx index 042c456579..8be4a75e67 100644 --- a/src/frontend/js/utils/react-query/useSessionQuery/index.spec.tsx +++ b/src/frontend/js/utils/react-query/useSessionQuery/index.spec.tsx @@ -4,7 +4,7 @@ import { PropsWithChildren } from 'react'; import { renderHook, waitFor } from '@testing-library/react'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import BaseSessionProvider from 'contexts/SessionContext/BaseSessionProvider'; -import { checkStatus } from 'api/joanie'; +import { checkStatusLegacy } from 'api/joanie'; import { useSession } from 'contexts/SessionContext'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { HttpError, HttpStatusCode } from 'utils/errors/HttpError'; @@ -43,7 +43,9 @@ describe('useSessionQuery', () => { const useHooks = () => { const session = useSession(); - useSessionQuery(['orders'], () => fetch('http://api.endpoint/orders/').then(checkStatus)); + useSessionQuery(['orders'], () => + fetch('http://api.endpoint/orders/').then(checkStatusLegacy), + ); return session; }; @@ -73,7 +75,9 @@ describe('useSessionQuery', () => { const useHooks = () => { const session = useSession(); - useSessionQuery(['orders'], () => fetch('http://api.endpoint/orders/').then(checkStatus)); + useSessionQuery(['orders'], () => + fetch('http://api.endpoint/orders/').then(checkStatusLegacy), + ); return session; }; diff --git a/src/frontend/js/utils/test/factories/joanieGen.ts b/src/frontend/js/utils/test/factories/joanieGen.ts new file mode 100644 index 0000000000..0d42d0b8e7 --- /dev/null +++ b/src/frontend/js/utils/test/factories/joanieGen.ts @@ -0,0 +1,18 @@ +import { faker } from '@faker-js/faker'; +import { Address, CountryEnum } from 'api/joanie/gen'; +import { factory } from './factories'; +import { FactoryHelper } from './helper'; + +export const AddressFactory = factory((): Address => { + return { + address: faker.location.streetAddress(), + city: faker.location.city(), + country: faker.location.countryCode() as CountryEnum, + first_name: faker.person.firstName(), + last_name: faker.person.lastName(), + id: faker.string.uuid(), + is_main: false, + postcode: faker.location.zipCode(), + title: FactoryHelper.sequence((counter) => `Address ${counter}`), + }; +}); diff --git a/src/frontend/js/utils/test/factories/joanie.spec.ts b/src/frontend/js/utils/test/factories/joanieLegacy.spec.ts similarity index 78% rename from src/frontend/js/utils/test/factories/joanie.spec.ts rename to src/frontend/js/utils/test/factories/joanieLegacy.spec.ts index 671dd0dbf6..7d085e9ef1 100644 --- a/src/frontend/js/utils/test/factories/joanie.spec.ts +++ b/src/frontend/js/utils/test/factories/joanieLegacy.spec.ts @@ -1,4 +1,4 @@ -import * as joanieFactories from './joanie'; +import * as joanieFactories from './joanieLegacy'; describe('Factories joanie', () => { it.each(Object.entries(joanieFactories))('can instanciate %s', (name, Factory) => { diff --git a/src/frontend/js/utils/test/factories/joanie.ts b/src/frontend/js/utils/test/factories/joanieLegacy.ts similarity index 96% rename from src/frontend/js/utils/test/factories/joanie.ts rename to src/frontend/js/utils/test/factories/joanieLegacy.ts index 1cd9d35928..0e0532c98e 100644 --- a/src/frontend/js/utils/test/factories/joanie.ts +++ b/src/frontend/js/utils/test/factories/joanieLegacy.ts @@ -1,7 +1,6 @@ import { faker } from '@faker-js/faker'; import { CourseStateTextEnum, Priority } from 'types'; import { - Address, Certificate, CertificateDefinition, CourseListItem, @@ -44,6 +43,7 @@ import { import { CourseStateFactory } from 'utils/test/factories/richie'; import { FactoryHelper } from 'utils/test/factories/helper'; import { JoanieUserApiAbilityActions, JoanieUserProfile } from 'types/User'; +import { AddressFactory as AddressGenFactory } from './joanieGen'; import { factory } from './factories'; export const UserLightFactory = factory((): UserLight => { @@ -160,7 +160,7 @@ export const OrganizationFactory = factory((): Organization => { contact_email: faker.internet.email(), dpo_email: faker.internet.email(), contact_phone: faker.phone.number(), - address: AddressFactory().one(), + address: AddressGenFactory().one(), }; }); @@ -463,20 +463,6 @@ export const CertificateOrderWithOneClickPaymentFactory = factory( }, ); -export const AddressFactory = factory((): Address => { - return { - address: faker.location.streetAddress(), - city: faker.location.city(), - country: faker.location.countryCode(), - first_name: faker.person.firstName(), - last_name: faker.person.lastName(), - id: faker.string.uuid(), - is_main: false, - postcode: faker.location.zipCode(), - title: FactoryHelper.sequence((counter) => `Address ${counter}`), - }; -}); - export const CreditCardFactory = factory((): CreditCard => { return { brand: CreditCardBrand.VISA, diff --git a/src/frontend/js/utils/test/mockCourseProductWithOrder.ts b/src/frontend/js/utils/test/mockCourseProductWithOrder.ts index 480a93381a..5130d3a905 100644 --- a/src/frontend/js/utils/test/mockCourseProductWithOrder.ts +++ b/src/frontend/js/utils/test/mockCourseProductWithOrder.ts @@ -5,7 +5,7 @@ import { CourseFactory, CourseProductRelationFactory, ProductFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; export const mockCourseProductWithOrder = (order: CredentialOrder) => { const courseCode = order.course.code; diff --git a/src/frontend/js/utils/test/render.tsx b/src/frontend/js/utils/test/render.tsx index 5df309d26d..852ff3165c 100644 --- a/src/frontend/js/utils/test/render.tsx +++ b/src/frontend/js/utils/test/render.tsx @@ -1,8 +1,9 @@ import { RenderResult, screen, render as testingLibraryRender } from '@testing-library/react'; -import React, { ReactElement } from 'react'; +import React, { ReactElement, lazy } from 'react'; import { Nullable } from 'types/utils'; import { AppWrapperProps } from './wrappers/types'; -import { JoanieAppWrapper } from './wrappers/JoanieAppWrapper'; + +const JoanieAppWrapper = lazy(() => import('./wrappers/JoanieAppWrapper')); // ------- setup ------- diff --git a/src/frontend/js/utils/test/wrappers/JoanieAppWrapper.tsx b/src/frontend/js/utils/test/wrappers/JoanieAppWrapper.tsx index 1ca3038e63..2745bef967 100644 --- a/src/frontend/js/utils/test/wrappers/JoanieAppWrapper.tsx +++ b/src/frontend/js/utils/test/wrappers/JoanieAppWrapper.tsx @@ -19,7 +19,7 @@ export const setupJoanieSession = () => { }; }; -export const JoanieAppWrapper = ({ +const JoanieAppWrapper = ({ children, intlOptions, queryOptions, @@ -35,3 +35,5 @@ export const JoanieAppWrapper = ({ ); }; + +export default JoanieAppWrapper; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardAvatar/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardAvatar/index.spec.tsx index 30c2a8290b..b97e362cce 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardAvatar/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardAvatar/index.spec.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import { JoanieFileFactory } from 'utils/test/factories/joanie'; +import { JoanieFileFactory } from 'utils/test/factories/joanieLegacy'; import { DashboardAvatar, DashboardAvatarVariantEnum } from '.'; describe('', () => { diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardAvatar/index.stories.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardAvatar/index.stories.tsx index 0d1a1bfdb7..32edd847ba 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardAvatar/index.stories.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardAvatar/index.stories.tsx @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react'; import { UserFactory } from 'utils/test/factories/richie'; -import { OrganizationFactory } from 'utils/test/factories/joanie'; +import { OrganizationFactory } from 'utils/test/factories/joanieLegacy'; import { DashboardAvatar, DashboardAvatarVariantEnum } from '.'; export default { diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Certificate/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Certificate/index.spec.tsx index 1c0b86dea2..83f1023612 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Certificate/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Certificate/index.spec.tsx @@ -14,7 +14,7 @@ import { CertificateFactory, NestedCertificateOrderFactory, NestedCredentialOrderFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { HttpStatusCode } from 'utils/errors/HttpError'; jest.mock('utils/context', () => ({ diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Certificate/index.stories.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Certificate/index.stories.tsx index 08ac10e39e..9116bb5ef8 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Certificate/index.stories.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Certificate/index.stories.tsx @@ -2,7 +2,7 @@ import { Meta, StoryObj } from '@storybook/react'; import { DashboardItemCertificate } from 'widgets/Dashboard/components/DashboardItem/Certificate/index'; import { StorybookHelper } from 'utils/StorybookHelper'; import { Certificate } from 'types/Joanie'; -import { CertificateFactory } from 'utils/test/factories/joanie'; +import { CertificateFactory } from 'utils/test/factories/joanieLegacy'; export default { title: 'Widgets/Dashboard/Certificate', diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/CertificateStatus/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/CertificateStatus/index.spec.tsx index a7953332dc..dab75602f7 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/CertificateStatus/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/CertificateStatus/index.spec.tsx @@ -1,7 +1,7 @@ import { IntlProvider } from 'react-intl'; import { render, screen } from '@testing-library/react'; import { ProductType } from 'types/Joanie'; -import { CertificateFactory } from 'utils/test/factories/joanie'; +import { CertificateFactory } from 'utils/test/factories/joanieLegacy'; import CertificateStatus, { CertificateStatusProps } from '.'; describe('', () => { diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Contract/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Contract/index.spec.tsx index 0b4f757b91..5ccba24946 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Contract/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Contract/index.spec.tsx @@ -15,7 +15,7 @@ import { ContractFactory, CredentialOrderFactory, NestedCredentialOrderFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; jest.mock('utils/context', () => ({ __esModule: true, diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Contract/index.stories.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Contract/index.stories.tsx index 79b25badfc..6ab048d4c3 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Contract/index.stories.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Contract/index.stories.tsx @@ -2,7 +2,7 @@ import { Meta, StoryObj } from '@storybook/react'; import { DashboardItemContract } from 'widgets/Dashboard/components/DashboardItem/Contract/index'; import { StorybookHelper } from 'utils/StorybookHelper'; import { Contract, NestedCredentialOrder } from 'types/Joanie'; -import { ContractFactory, NestedCredentialOrderFactory } from 'utils/test/factories/joanie'; +import { ContractFactory, NestedCredentialOrderFactory } from 'utils/test/factories/joanieLegacy'; export default { title: 'Widgets/Dashboard/Contract', diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.spec.tsx index 02c1bb2bcd..be60444a94 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.spec.tsx @@ -1,7 +1,7 @@ import { render, screen } from '@testing-library/react'; import { IntlProvider, createIntl } from 'react-intl'; import { PropsWithChildren } from 'react'; -import { CredentialOrderFactory, EnrollmentFactory } from 'utils/test/factories/joanie'; +import { CredentialOrderFactory, EnrollmentFactory } from 'utils/test/factories/joanieLegacy'; import { Priority } from 'types'; import { CourseRun, Enrollment } from 'types/Joanie'; import { DEFAULT_DATE_FORMAT } from 'hooks/useDateFormat'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.stories.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.stories.tsx index 6d32e88967..a6abf8a089 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.stories.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.stories.tsx @@ -1,7 +1,7 @@ import { Meta, StoryObj } from '@storybook/react'; import { createMemoryRouter, RouterProvider } from 'react-router-dom'; import { faker } from '@faker-js/faker'; -import { TargetCourseFactory } from 'utils/test/factories/joanie'; +import { TargetCourseFactory } from 'utils/test/factories/joanieLegacy'; import { StorybookHelper } from 'utils/StorybookHelper'; import { Priority } from 'types'; import { enrollment } from '../stories.mock'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Enrollment/DashboardItemEnrollment.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Enrollment/DashboardItemEnrollment.spec.tsx index 00b7784351..b6d99e59ac 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Enrollment/DashboardItemEnrollment.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Enrollment/DashboardItemEnrollment.spec.tsx @@ -7,7 +7,7 @@ import { CourseStateFactory, RichieContextFactory as mockRichieContextFactory, } from 'utils/test/factories/richie'; -import { CourseRunWithCourseFactory, EnrollmentFactory } from 'utils/test/factories/joanie'; +import { CourseRunWithCourseFactory, EnrollmentFactory } from 'utils/test/factories/joanieLegacy'; import { DEFAULT_DATE_FORMAT } from 'hooks/useDateFormat'; import { Priority } from 'types'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Enrollment/ProductCertificateFooter/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Enrollment/ProductCertificateFooter/index.spec.tsx index 50c76494f1..5d89cad5ca 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Enrollment/ProductCertificateFooter/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Enrollment/ProductCertificateFooter/index.spec.tsx @@ -16,7 +16,7 @@ import { OrderEnrollmentFactory, EnrollmentFactory, CertificateProductFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { Priority } from 'types'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; @@ -35,11 +35,12 @@ jest.mock('utils/context', () => ({ joanie_backend: { endpoint: 'https://joanie.endpoint.test' }, }).one(), })); + jest.mock('components/SaleTunnel', () => ({ __esModule: true, default: ({ isOpen, onFinish }: SaleTunnelProps) => { const React = require('react'); - const Factories = require('utils/test/factories/joanie'); + const Factories = require('utils/test/factories/joanieLegacy'); // Automatically call onFinish() callback after 100ms when the SaleTunnel is opened to simulate a payment. React.useEffect(() => { if (!isOpen) { diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrder.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrder.spec.tsx index c71065794d..53ea2dd02e 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrder.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrder.spec.tsx @@ -29,7 +29,7 @@ import { EnrollmentFactory, CredentialOrderFactory, TargetCourseFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { Certificate, CourseLight, CourseRun, CredentialOrder, OrderState } from 'types/Joanie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { SessionProvider } from 'contexts/SessionContext'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.spec.tsx index bedadcab4e..29d3fa7ab1 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.spec.tsx @@ -13,7 +13,7 @@ import { ContractFactory, CredentialOrderFactory, TargetCourseFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { mockCourseProductWithOrder } from 'utils/test/mockCourseProductWithOrder'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; import { expectBannerError } from 'utils/test/expectBanner'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.useUnionResource.cache.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.useUnionResource.cache.spec.tsx index e24181d098..45c2baf332 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.useUnionResource.cache.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.useUnionResource.cache.spec.tsx @@ -9,7 +9,7 @@ import { ContractFactory, CredentialOrderFactory, TargetCourseFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { mockCourseProductWithOrder } from 'utils/test/mockCourseProductWithOrder'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; import { Deferred } from 'utils/test/deferred'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderReadonly.stories.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderReadonly.stories.tsx index 9e92d12d04..01b884515d 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderReadonly.stories.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderReadonly.stories.tsx @@ -5,7 +5,7 @@ import { CredentialOrderFactory, ProductFactory, TargetCourseFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { QueryStateFactory } from 'utils/test/factories/reactQuery'; import { StorybookHelper } from 'utils/StorybookHelper'; import { enrollment } from '../stories.mock'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderWritable.stories.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderWritable.stories.tsx index bf7c7825f3..70fffcb135 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderWritable.stories.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderWritable.stories.tsx @@ -5,7 +5,7 @@ import { CredentialOrderFactory, ProductFactory, TargetCourseFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { StorybookHelper } from 'utils/StorybookHelper'; import { enrollment } from '../stories.mock'; import { DashboardItemOrder } from './DashboardItemOrder'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateLearnerMessage/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateLearnerMessage/index.spec.tsx index 8af7a3e2ab..46988d5561 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateLearnerMessage/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateLearnerMessage/index.spec.tsx @@ -5,7 +5,7 @@ import { ContractDefinitionFactory, ContractFactory, CredentialOrderFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { OrderState } from 'types/Joanie'; import OrderStateLearnerMessage, { messages } from '.'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateTeacherMessage/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateTeacherMessage/index.spec.tsx index af5f41f4db..9a2de6ef7d 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateTeacherMessage/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateTeacherMessage/index.spec.tsx @@ -5,7 +5,7 @@ import { ContractDefinitionFactory, ContractFactory, CredentialOrderFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { OrderState } from 'types/Joanie'; import OrderStateTeacherMessage, { messages } from '.'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardSidebar/components/ContractNavLink/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardSidebar/components/ContractNavLink/index.spec.tsx index 9f91c6d2be..6b3f2b58f0 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardSidebar/components/ContractNavLink/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardSidebar/components/ContractNavLink/index.spec.tsx @@ -11,7 +11,7 @@ import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { PER_PAGE } from 'settings'; import { ContractResourceQuery, ContractState } from 'types/Joanie'; -import { ContractFactory } from 'utils/test/factories/joanie'; +import { ContractFactory } from 'utils/test/factories/joanieLegacy'; import { ContractActions } from 'utils/AbilitiesHelper/types'; import { MenuLink } from '../..'; import ContractNavLink from '.'; diff --git a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardCourseSidebar/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardCourseSidebar/index.spec.tsx index f0712f0676..a1adc3b56f 100644 --- a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardCourseSidebar/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardCourseSidebar/index.spec.tsx @@ -12,7 +12,7 @@ import { CourseFactory, CourseProductRelationFactory, OrganizationFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { expectNoSpinner } from 'utils/test/expectSpinner'; import { render } from 'utils/test/render'; import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper'; @@ -54,7 +54,7 @@ describe('', () => { }); await expectNoSpinner('Loading course...'); - const link = screen.getByRole('link', { + const link = await screen.findByRole('link', { name: intl.formatMessage(messages.syllabusLinkLabel), }); expect(link).toHaveAttribute('href', `/redirects/courses/${course.code}`); diff --git a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.spec.tsx index 1400f72891..b467057384 100644 --- a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.spec.tsx @@ -13,7 +13,7 @@ import { } from 'utils/test/factories/richie'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; -import { ContractFactory, OrganizationFactory } from 'utils/test/factories/joanie'; +import { ContractFactory, OrganizationFactory } from 'utils/test/factories/joanieLegacy'; import { PER_PAGE } from 'settings'; import { TeacherDashboardOrganizationSidebar } from '.'; diff --git a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.stories.tsx b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.stories.tsx index 4215f3c4ff..6a028f6cb8 100644 --- a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.stories.tsx +++ b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.stories.tsx @@ -4,7 +4,7 @@ import fetchMock from 'fetch-mock'; import { UserFactory } from 'utils/test/factories/richie'; import { TeacherDashboardOrganizationSidebar } from 'widgets/Dashboard/components/TeacherDashboardOrganizationSidebar'; import { StorybookHelper } from 'utils/StorybookHelper'; -import { ContractFactory, OrganizationFactory } from 'utils/test/factories/joanie'; +import { ContractFactory, OrganizationFactory } from 'utils/test/factories/joanieLegacy'; export default { component: TeacherDashboardOrganizationSidebar, diff --git a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks/index.spec.tsx index 1c21e62ea3..baf6111b98 100644 --- a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks/index.spec.tsx @@ -1,5 +1,5 @@ import { screen } from '@testing-library/react'; -import { OrganizationFactory } from 'utils/test/factories/joanie'; +import { OrganizationFactory } from 'utils/test/factories/joanieLegacy'; import { render } from 'utils/test/render'; import { PresentationalAppWrapper } from 'utils/test/wrappers/PresentationalAppWrapper'; import OrganizationLinks from '.'; diff --git a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.spec.tsx index ba445b5dc2..3a9d338581 100644 --- a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.spec.tsx @@ -6,7 +6,7 @@ import { TEACHER_DASHBOARD_ROUTE_LABELS, TeacherDashboardPaths, } from 'widgets/Dashboard/utils/teacherRouteMessages'; -import { OrganizationFactory } from 'utils/test/factories/joanie'; +import { OrganizationFactory } from 'utils/test/factories/joanieLegacy'; import { messages as organizationLinksMessages } from 'widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks'; import { render } from 'utils/test/render'; import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper'; diff --git a/src/frontend/js/widgets/Dashboard/hooks/useEnroll/index.spec.tsx b/src/frontend/js/widgets/Dashboard/hooks/useEnroll/index.spec.tsx index 3f341512f8..c476f1894e 100644 --- a/src/frontend/js/widgets/Dashboard/hooks/useEnroll/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/hooks/useEnroll/index.spec.tsx @@ -5,7 +5,7 @@ import { act, renderHook, waitFor } from '@testing-library/react'; import fetchMock from 'fetch-mock'; import { Priority } from 'types'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CourseRunFactory } from 'utils/test/factories/joanie'; +import { CourseRunFactory } from 'utils/test/factories/joanieLegacy'; import { SessionProvider } from 'contexts/SessionContext'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { useEnroll } from './index'; diff --git a/src/frontend/js/widgets/Dashboard/index.spec.tsx b/src/frontend/js/widgets/Dashboard/index.spec.tsx index ba3c3b4a5f..4a26e05387 100644 --- a/src/frontend/js/widgets/Dashboard/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/index.spec.tsx @@ -6,15 +6,15 @@ import { RichieContextFactory as mockRichieContextFactory, UserFactory, } from 'utils/test/factories/richie'; -import { AddressFactory } from 'utils/test/factories/joanie'; import { location } from 'utils/indirection/window'; import { User } from 'types/User'; import { Nullable } from 'types/utils'; import { expectBreadcrumbsToEqualParts } from 'utils/test/expectBreadcrumbsToEqualParts'; -import { Address } from 'types/Joanie'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; import { expectUrlMatchLocationDisplayed } from 'utils/test/expectUrlMatchLocationDisplayed'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; +import { Address } from 'api/joanie/gen'; +import { AddressFactory } from 'utils/test/factories/joanieGen'; import { LearnerDashboardPaths } from './utils/learnerRouteMessages'; import { DashboardTest } from './components/DashboardTest'; diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.spec.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.spec.tsx index c303eb7457..336dade107 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.spec.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.spec.tsx @@ -4,7 +4,10 @@ import fetchMock from 'fetch-mock'; import { PropsWithChildren } from 'react'; import { IntlProvider } from 'react-intl'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CertificationDefinitionFactory, OrderLiteFactory } from 'utils/test/factories/joanie'; +import { + CertificationDefinitionFactory, + OrderLiteFactory, +} from 'utils/test/factories/joanieLegacy'; import JoanieApiProvider from 'contexts/JoanieApiContext'; import { CertificateDefinition, OrderLite } from 'types/Joanie'; import { HttpStatusCode } from 'utils/errors/HttpError'; diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.stories.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.stories.tsx index 3b6a437e15..93590a850d 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.stories.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.stories.tsx @@ -1,5 +1,8 @@ import { Meta, StoryObj } from '@storybook/react'; -import { CertificationDefinitionFactory, OrderLiteFactory } from 'utils/test/factories/joanie'; +import { + CertificationDefinitionFactory, + OrderLiteFactory, +} from 'utils/test/factories/joanieLegacy'; import JoanieApiProvider from 'contexts/JoanieApiContext'; import { StorybookHelper } from 'utils/StorybookHelper'; import CertificateItem from '.'; diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCourseRuns/index.spec.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCourseRuns/index.spec.tsx index cb5f4d3956..ff1e9654a6 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCourseRuns/index.spec.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCourseRuns/index.spec.tsx @@ -11,7 +11,7 @@ import { EnrollmentFactory, CredentialOrderFactory, ProductFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import JoanieApiProvider from 'contexts/JoanieApiContext'; import type { CourseLight, CourseRun, Enrollment } from 'types/Joanie'; import { Deferred } from 'utils/test/deferred'; diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.spec.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.spec.tsx index 0c634b28d9..3c072c5379 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.spec.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.spec.tsx @@ -1,6 +1,6 @@ import { faker } from '@faker-js/faker'; import { screen, getByText, render } from '@testing-library/react'; -import { CredentialOrderFactory, ProductFactory } from 'utils/test/factories/joanie'; +import { CredentialOrderFactory, ProductFactory } from 'utils/test/factories/joanieLegacy'; import type { CourseRun, CredentialOrder } from 'types/Joanie'; import { OrderState } from 'types/Joanie'; import CourseRunItem from '.'; diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.stories.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.stories.tsx index 25f279bcda..dcfd9e34da 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.stories.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.stories.tsx @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react'; import { QueryClientProvider } from '@tanstack/react-query'; -import { CredentialOrderFactory, TargetCourseFactory } from 'utils/test/factories/joanie'; +import { CredentialOrderFactory, TargetCourseFactory } from 'utils/test/factories/joanieLegacy'; import { StorybookHelper } from 'utils/StorybookHelper'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { UserFactory } from 'utils/test/factories/richie'; diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.spec.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.spec.tsx index 2e731ade65..4768fe2b84 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.spec.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.spec.tsx @@ -13,7 +13,7 @@ import { ProductFactory, OrderGroupFullFactory, OrderGroupFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import JoanieApiProvider from 'contexts/JoanieApiContext'; import { CourseRun, diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.stories.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.stories.tsx index 098e0f12fb..0c1c982d6b 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.stories.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.stories.tsx @@ -7,7 +7,7 @@ import { CourseProductRelationFactory, CredentialOrderFactory, CredentialProductFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { UserFactory } from 'utils/test/factories/richie'; import { CredentialOrder, OrderState } from 'types/Joanie'; diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseRunEnrollment/index.joanie.spec.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseRunEnrollment/index.joanie.spec.tsx index b9051c4e40..dd3f9f08b7 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseRunEnrollment/index.joanie.spec.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseRunEnrollment/index.joanie.spec.tsx @@ -5,7 +5,7 @@ import { IntlProvider } from 'react-intl'; import { faker } from '@faker-js/faker'; import { Deferred } from 'utils/test/deferred'; -import { EnrollmentFactory as JoanieEnrollment } from 'utils/test/factories/joanie'; +import { EnrollmentFactory as JoanieEnrollment } from 'utils/test/factories/joanieLegacy'; import { CourseRunFactory, RichieContextFactory as mockRichieContextFactory, diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.login.spec.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.login.spec.tsx index 2344463a22..3b3f928fd1 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.login.spec.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.login.spec.tsx @@ -13,7 +13,7 @@ import JoanieApiProvider from 'contexts/JoanieApiContext'; import { SessionProvider } from 'contexts/SessionContext'; import { HttpStatusCode } from 'utils/errors/HttpError'; import { CourseLight } from 'types/Joanie'; -import { CourseLightFactory } from 'utils/test/factories/joanie'; +import { CourseLightFactory } from 'utils/test/factories/joanieLegacy'; import CourseWishButton from '.'; jest.mock('utils/context', () => ({ diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.logout.spec.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.logout.spec.tsx index 97217dc579..7312bd11f3 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.logout.spec.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.logout.spec.tsx @@ -12,7 +12,7 @@ import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import JoanieApiProvider from 'contexts/JoanieApiContext'; import { SessionProvider } from 'contexts/SessionContext'; import { location } from 'utils/indirection/window'; -import { CourseLightFactory } from 'utils/test/factories/joanie'; +import { CourseLightFactory } from 'utils/test/factories/joanieLegacy'; import { CourseLight } from 'types/Joanie'; import CourseWishButton from '.'; diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/index.spec.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/index.spec.tsx index 1c759ac281..644bf91a1a 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/index.spec.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/index.spec.tsx @@ -25,7 +25,10 @@ import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { CourseRun, Priority } from 'types'; import JoanieApiProvider from 'contexts/JoanieApiContext'; import { CourseProductRelation } from 'types/Joanie'; -import { CourseLightFactory, CourseProductRelationFactory } from 'utils/test/factories/joanie'; +import { + CourseLightFactory, + CourseProductRelationFactory, +} from 'utils/test/factories/joanieLegacy'; import { DEFAULT_DATE_FORMAT } from 'hooks/useDateFormat'; import { StringHelper } from 'utils/StringHelper'; import { computeStates } from 'utils/CourseRuns'; diff --git a/src/frontend/js/widgets/UserLogin/index.spec.tsx b/src/frontend/js/widgets/UserLogin/index.spec.tsx index 35aed4ee21..672bcc4914 100644 --- a/src/frontend/js/widgets/UserLogin/index.spec.tsx +++ b/src/frontend/js/widgets/UserLogin/index.spec.tsx @@ -15,7 +15,7 @@ import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { JoanieUserApiAbilityActions, User } from 'types/User'; import { HttpStatusCode } from 'utils/errors/HttpError'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; -import { JoanieUserProfileFactory } from 'utils/test/factories/joanie'; +import { JoanieUserProfileFactory } from 'utils/test/factories/joanieLegacy'; import { Nullable } from 'types/utils'; import UserLogin from '.'; diff --git a/src/frontend/mocks/handlers/contracts.ts b/src/frontend/mocks/handlers/contracts.ts index 0eeb51786c..636729a0f6 100644 --- a/src/frontend/mocks/handlers/contracts.ts +++ b/src/frontend/mocks/handlers/contracts.ts @@ -1,11 +1,11 @@ import { http, HttpResponse } from 'msw'; -import { getAPIEndpoint } from 'api/joanie'; +import { getAPIEndpointLegacy } from 'api/joanie'; import { Contract, PaginatedResponse } from 'types/Joanie'; -import { ContractFactory } from 'utils/test/factories/joanie'; +import { ContractFactory } from 'utils/test/factories/joanieLegacy'; import { PER_PAGE } from 'settings'; export default [ - http.get(`${getAPIEndpoint()}/contracts/`, () => { + http.get(`${getAPIEndpointLegacy()}/contracts/`, () => { return HttpResponse.json>({ count: 250, results: ContractFactory().many(PER_PAGE.teacherContractList), diff --git a/src/frontend/package.json b/src/frontend/package.json index 3db4ae3efd..240fd7cda6 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -17,7 +17,8 @@ "watch-ts": "yarn build-ts --watch", "storybook": "storybook dev -p 6006", "build-storybook": "storybook build", - "build-theme": "cunningham -g scss -o scss/vendors && cunningham -g css -o scss/vendors/css -g ts -o js/utils/" + "build-theme": "cunningham -g scss -o scss/vendors && cunningham -g css -o scss/vendors/css -g ts -o js/utils/", + "generate:api:client:local": "./scripts/openapi-typescript-codegen/generate_api_client_local.sh" }, "repository": { "type": "git", @@ -148,5 +149,8 @@ }, "volta": { "node": "20.11.0" + }, + "devDependencies": { + "openapi-typescript-codegen": "0.25.0" } } diff --git a/src/frontend/scripts/openapi-typescript-codegen/generate_api_client_local.sh b/src/frontend/scripts/openapi-typescript-codegen/generate_api_client_local.sh new file mode 100755 index 0000000000..0e4ac5d7ee --- /dev/null +++ b/src/frontend/scripts/openapi-typescript-codegen/generate_api_client_local.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# to generate the client, execute this command in joanie: +# $ ./bin/update_openapi_schema +openapi --input http://localhost:8071/v1.0/swagger.json --output js/api/joanie/gen --indent='2' --name ApiClientJoanie diff --git a/src/frontend/yarn.lock b/src/frontend/yarn.lock index de86169e69..fe3d5d1e01 100644 --- a/src/frontend/yarn.lock +++ b/src/frontend/yarn.lock @@ -8,9 +8,9 @@ integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== "@adobe/css-tools@^4.3.2": - version "4.3.2" - resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.3.2.tgz#a6abc715fb6884851fca9dad37fc34739a04fd11" - integrity sha512-DA5a1C0gD/pLOvhv33YMrbf2FK3oUzwNl9oOJqE4XVjuEtt6XIakRcsd7eLiOSPkp1kTRQGICTA8cKra/vFbjw== + version "4.3.3" + resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.3.3.tgz#90749bde8b89cd41764224f5aac29cd4138f75ff" + integrity sha512-rE0Pygv0sEZ4vBWHlAgJLGDU7Pm8xoO6p3wsEceb7GYAjScrOHpEo8KK/eVkAcnSM+slAEtXjA2JpdjLp4fJQQ== "@ampproject/remapping@^2.2.0": version "2.2.0" @@ -20,6 +20,16 @@ "@jridgewell/gen-mapping" "^0.1.0" "@jridgewell/trace-mapping" "^0.3.9" +"@apidevtools/json-schema-ref-parser@9.0.9": + version "9.0.9" + resolved "https://registry.yarnpkg.com/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-9.0.9.tgz#d720f9256e3609621280584f2b47ae165359268b" + integrity sha512-GBD2Le9w2+lVFoc4vswGI/TjkNIZSVp7+9xPf+X3uidBfWnAeUWmquteSyt0+VCrhNMWj/FTABISQrD3Z/YA+w== + dependencies: + "@jsdevtools/ono" "^7.1.3" + "@types/json-schema" "^7.0.6" + call-me-maybe "^1.0.1" + js-yaml "^4.1.0" + "@aw-web-design/x-default-browser@1.4.126": version "1.4.126" resolved "https://registry.yarnpkg.com/@aw-web-design/x-default-browser/-/x-default-browser-1.4.126.tgz#43e4bd8f0314ed907a8718d7e862a203af79bc16" @@ -79,17 +89,12 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.9.tgz#71cdb00a1ce3a329ce4cbec3a44f9fef35669730" integrity sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ== -"@babel/compat-data@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.23.3.tgz#3febd552541e62b5e883a25eb3effd7c7379db11" - integrity sha512-BmR4bWbDIoFJmJ9z2cZ8Gmm2MXgEDgjdWgpKmKWUt54UGFJdlj31ECtbaDvCG/qVdG3AQ1SfpZEs01lUFbzLOQ== - "@babel/compat-data@^7.23.5": version "7.23.5" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.23.5.tgz#ffb878728bb6bdcb6f4510aa51b1be9afb8cfd98" integrity sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw== -"@babel/core@7.24.0": +"@babel/core@7.24.0", "@babel/core@^7.18.9", "@babel/core@^7.23.0", "@babel/core@^7.23.2": version "7.24.0" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.24.0.tgz#56cbda6b185ae9d9bed369816a8f4423c5f2ff1b" integrity sha512-fQfkg0Gjkza3nf0c7/w6Xf34BW4YvzNfACRLmmb7XRLa6XHdR+K9AlJlxneFfWYf6uhOzuzZVTjF/8KfndZANw== @@ -131,27 +136,6 @@ json5 "^2.2.2" semver "^6.3.0" -"@babel/core@^7.18.9", "@babel/core@^7.23.0", "@babel/core@^7.23.2": - version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.23.6.tgz#8be77cd77c55baadcc1eae1c33df90ab6d2151d4" - integrity sha512-FxpRyGjrMJXh7X3wGLGhNDCRiwpWEF74sKjTLDJSG5Kyvow3QZaG0Adbqzi9ZrVjTWpsX+2cxWXD71NMg93kdw== - dependencies: - "@ampproject/remapping" "^2.2.0" - "@babel/code-frame" "^7.23.5" - "@babel/generator" "^7.23.6" - "@babel/helper-compilation-targets" "^7.23.6" - "@babel/helper-module-transforms" "^7.23.3" - "@babel/helpers" "^7.23.6" - "@babel/parser" "^7.23.6" - "@babel/template" "^7.22.15" - "@babel/traverse" "^7.23.6" - "@babel/types" "^7.23.6" - convert-source-map "^2.0.0" - debug "^4.1.0" - gensync "^1.0.0-beta.2" - json5 "^2.2.3" - semver "^6.3.1" - "@babel/generator@^7.21.3", "@babel/generator@^7.7.2": version "7.21.3" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.21.3.tgz#232359d0874b392df04045d72ce2fd9bb5045fce" @@ -303,17 +287,6 @@ regexpu-core "^5.3.1" semver "^6.3.0" -"@babel/helper-define-polyfill-provider@^0.4.3": - version "0.4.3" - resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.4.3.tgz#a71c10f7146d809f4a256c373f462d9bba8cf6ba" - integrity sha512-WBrLmuPP47n7PNwsZ57pqam6G/RGo1vw/87b0Blc53tZNGZ4x7YvZ6HgQe2vo1W/FR20OgjeZuGXzudPiXHFug== - dependencies: - "@babel/helper-compilation-targets" "^7.22.6" - "@babel/helper-plugin-utils" "^7.22.5" - debug "^4.1.1" - lodash.debounce "^4.0.8" - resolve "^1.14.2" - "@babel/helper-define-polyfill-provider@^0.5.0": version "0.5.0" resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.5.0.tgz#465805b7361f461e86c680f1de21eaf88c25901b" @@ -599,15 +572,6 @@ "@babel/traverse" "^7.21.0" "@babel/types" "^7.21.0" -"@babel/helpers@^7.23.6": - version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.23.6.tgz#d03af2ee5fb34691eec0cda90f5ecbb4d4da145a" - integrity sha512-wCfsbN4nBidDRhpDhvcKlzHWCTlgJYUUdSJfzXb2NuBssDSIjc3xcb+znA7l+zYsFljAcGM0aFkN40cR3lXiGA== - dependencies: - "@babel/template" "^7.22.15" - "@babel/traverse" "^7.23.6" - "@babel/types" "^7.23.6" - "@babel/helpers@^7.24.0": version "7.24.0" resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.24.0.tgz#a3dd462b41769c95db8091e49cfe019389a9409b" @@ -673,11 +637,6 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.0.tgz#da950e622420bf96ca0d0f2909cdddac3acd8719" integrity sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw== -"@babel/parser@^7.23.6": - version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.6.tgz#ba1c9e512bda72a47e285ae42aff9d2a635a9e3b" - integrity sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ== - "@babel/parser@^7.24.0": version "7.24.0" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.0.tgz#26a3d1ff49031c53a97d03b604375f028746a9ac" @@ -699,14 +658,6 @@ "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" "@babel/plugin-transform-optional-chaining" "^7.23.3" -"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.23.3.tgz#20c60d4639d18f7da8602548512e9d3a4c8d7098" - integrity sha512-XaJak1qcityzrX0/IU5nKHb34VaibwP3saKqG6a/tppelgllOH13LUann4ZCIBcVOeE6H18K4Vx9QKkVww3z/w== - dependencies: - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-plugin-utils" "^7.22.5" - "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@^7.23.7": version "7.23.7" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.23.7.tgz#516462a95d10a9618f197d39ad291a9b47ae1d7b" @@ -903,16 +854,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-async-generator-functions@^7.23.4": - version "7.23.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.23.4.tgz#93ac8e3531f347fba519b4703f9ff2a75c6ae27a" - integrity sha512-efdkfPhHYTtn0G6n2ddrESE91fgXxjlqLsnUtPWnJs4a4mZIbUaK7ffqKIIUKXSHwcDvaCVX6GXkaJJFqtX7jw== - dependencies: - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-plugin-utils" "^7.22.5" - "@babel/helper-remap-async-to-generator" "^7.22.20" - "@babel/plugin-syntax-async-generators" "^7.8.4" - "@babel/plugin-transform-async-generator-functions@^7.23.9": version "7.23.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.23.9.tgz#9adaeb66fc9634a586c5df139c6240d41ed801ce" @@ -971,21 +912,6 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-class-static-block" "^7.14.5" -"@babel/plugin-transform-classes@^7.23.5": - version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.23.5.tgz#e7a75f815e0c534cc4c9a39c56636c84fc0d64f2" - integrity sha512-jvOTR4nicqYC9yzOHIhXG5emiFEOpappSJAl73SDSEDcybD+Puuze8Tnpb9p9qEyYup24tq891gkaygIFvWDqg== - dependencies: - "@babel/helper-annotate-as-pure" "^7.22.5" - "@babel/helper-compilation-targets" "^7.22.15" - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-function-name" "^7.23.0" - "@babel/helper-optimise-call-expression" "^7.22.5" - "@babel/helper-plugin-utils" "^7.22.5" - "@babel/helper-replace-supers" "^7.22.20" - "@babel/helper-split-export-declaration" "^7.22.6" - globals "^11.1.0" - "@babel/plugin-transform-classes@^7.23.8": version "7.23.8" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.23.8.tgz#d08ae096c240347badd68cdf1b6d1624a6435d92" @@ -1126,16 +1052,6 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/helper-simple-access" "^7.22.5" -"@babel/plugin-transform-modules-systemjs@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.23.3.tgz#fa7e62248931cb15b9404f8052581c302dd9de81" - integrity sha512-ZxyKGTkF9xT9YJuKQRo19ewf3pXpopuYQd8cDXqNzc3mUNbOME0RKMoZxviQk74hwzfQsEe66dE92MaZbdHKNQ== - dependencies: - "@babel/helper-hoist-variables" "^7.22.5" - "@babel/helper-module-transforms" "^7.23.3" - "@babel/helper-plugin-utils" "^7.22.5" - "@babel/helper-validator-identifier" "^7.22.20" - "@babel/plugin-transform-modules-systemjs@^7.23.9": version "7.23.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.23.9.tgz#105d3ed46e4a21d257f83a2f9e2ee4203ceda6be" @@ -1185,17 +1101,6 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-numeric-separator" "^7.10.4" -"@babel/plugin-transform-object-rest-spread@^7.23.4": - version "7.23.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.23.4.tgz#2b9c2d26bf62710460bdc0d1730d4f1048361b83" - integrity sha512-9x9K1YyeQVw0iOXJlIzwm8ltobIIv7j2iLyP2jIhEbqPRQ7ScNgwQufU2I0Gq11VjyG4gI4yMXt2VFags+1N3g== - dependencies: - "@babel/compat-data" "^7.23.3" - "@babel/helper-compilation-targets" "^7.22.15" - "@babel/helper-plugin-utils" "^7.22.5" - "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-transform-parameters" "^7.23.3" - "@babel/plugin-transform-object-rest-spread@^7.24.0": version "7.24.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.24.0.tgz#7b836ad0088fdded2420ce96d4e1d3ed78b71df1" @@ -1417,7 +1322,7 @@ "@babel/helper-create-regexp-features-plugin" "^7.22.15" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/preset-env@7.24.0": +"@babel/preset-env@7.24.0", "@babel/preset-env@^7.23.2": version "7.24.0" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.24.0.tgz#11536a7f4b977294f0bdfad780f01a8ac8e183fc" integrity sha512-ZxPEzV9IgvGn73iK0E6VB9/95Nd7aMFpbE0l8KQFDG70cOV9IxRP7Y2FUPmlK0v6ImlLqYX50iuZ3ZTVhOF2lA== @@ -1503,99 +1408,13 @@ core-js-compat "^3.31.0" semver "^6.3.1" -"@babel/preset-env@^7.23.2": - version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.23.6.tgz#ad0ea799d5a3c07db5b9a172819bbd444092187a" - integrity sha512-2XPn/BqKkZCpzYhUUNZ1ssXw7DcXfKQEjv/uXZUXgaebCMYmkEsfZ2yY+vv+xtXv50WmL5SGhyB6/xsWxIvvOQ== - dependencies: - "@babel/compat-data" "^7.23.5" - "@babel/helper-compilation-targets" "^7.23.6" - "@babel/helper-plugin-utils" "^7.22.5" - "@babel/helper-validator-option" "^7.23.5" - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.23.3" - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.23.3" - "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly" "^7.23.3" - "@babel/plugin-proposal-private-property-in-object" "7.21.0-placeholder-for-preset-env.2" - "@babel/plugin-syntax-async-generators" "^7.8.4" - "@babel/plugin-syntax-class-properties" "^7.12.13" - "@babel/plugin-syntax-class-static-block" "^7.14.5" - "@babel/plugin-syntax-dynamic-import" "^7.8.3" - "@babel/plugin-syntax-export-namespace-from" "^7.8.3" - "@babel/plugin-syntax-import-assertions" "^7.23.3" - "@babel/plugin-syntax-import-attributes" "^7.23.3" - "@babel/plugin-syntax-import-meta" "^7.10.4" - "@babel/plugin-syntax-json-strings" "^7.8.3" - "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" - "@babel/plugin-syntax-numeric-separator" "^7.10.4" - "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" - "@babel/plugin-syntax-optional-chaining" "^7.8.3" - "@babel/plugin-syntax-private-property-in-object" "^7.14.5" - "@babel/plugin-syntax-top-level-await" "^7.14.5" - "@babel/plugin-syntax-unicode-sets-regex" "^7.18.6" - "@babel/plugin-transform-arrow-functions" "^7.23.3" - "@babel/plugin-transform-async-generator-functions" "^7.23.4" - "@babel/plugin-transform-async-to-generator" "^7.23.3" - "@babel/plugin-transform-block-scoped-functions" "^7.23.3" - "@babel/plugin-transform-block-scoping" "^7.23.4" - "@babel/plugin-transform-class-properties" "^7.23.3" - "@babel/plugin-transform-class-static-block" "^7.23.4" - "@babel/plugin-transform-classes" "^7.23.5" - "@babel/plugin-transform-computed-properties" "^7.23.3" - "@babel/plugin-transform-destructuring" "^7.23.3" - "@babel/plugin-transform-dotall-regex" "^7.23.3" - "@babel/plugin-transform-duplicate-keys" "^7.23.3" - "@babel/plugin-transform-dynamic-import" "^7.23.4" - "@babel/plugin-transform-exponentiation-operator" "^7.23.3" - "@babel/plugin-transform-export-namespace-from" "^7.23.4" - "@babel/plugin-transform-for-of" "^7.23.6" - "@babel/plugin-transform-function-name" "^7.23.3" - "@babel/plugin-transform-json-strings" "^7.23.4" - "@babel/plugin-transform-literals" "^7.23.3" - "@babel/plugin-transform-logical-assignment-operators" "^7.23.4" - "@babel/plugin-transform-member-expression-literals" "^7.23.3" - "@babel/plugin-transform-modules-amd" "^7.23.3" - "@babel/plugin-transform-modules-commonjs" "^7.23.3" - "@babel/plugin-transform-modules-systemjs" "^7.23.3" - "@babel/plugin-transform-modules-umd" "^7.23.3" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.22.5" - "@babel/plugin-transform-new-target" "^7.23.3" - "@babel/plugin-transform-nullish-coalescing-operator" "^7.23.4" - "@babel/plugin-transform-numeric-separator" "^7.23.4" - "@babel/plugin-transform-object-rest-spread" "^7.23.4" - "@babel/plugin-transform-object-super" "^7.23.3" - "@babel/plugin-transform-optional-catch-binding" "^7.23.4" - "@babel/plugin-transform-optional-chaining" "^7.23.4" - "@babel/plugin-transform-parameters" "^7.23.3" - "@babel/plugin-transform-private-methods" "^7.23.3" - "@babel/plugin-transform-private-property-in-object" "^7.23.4" - "@babel/plugin-transform-property-literals" "^7.23.3" - "@babel/plugin-transform-regenerator" "^7.23.3" - "@babel/plugin-transform-reserved-words" "^7.23.3" - "@babel/plugin-transform-shorthand-properties" "^7.23.3" - "@babel/plugin-transform-spread" "^7.23.3" - "@babel/plugin-transform-sticky-regex" "^7.23.3" - "@babel/plugin-transform-template-literals" "^7.23.3" - "@babel/plugin-transform-typeof-symbol" "^7.23.3" - "@babel/plugin-transform-unicode-escapes" "^7.23.3" - "@babel/plugin-transform-unicode-property-regex" "^7.23.3" - "@babel/plugin-transform-unicode-regex" "^7.23.3" - "@babel/plugin-transform-unicode-sets-regex" "^7.23.3" - "@babel/preset-modules" "0.1.6-no-external-plugins" - babel-plugin-polyfill-corejs2 "^0.4.6" - babel-plugin-polyfill-corejs3 "^0.8.5" - babel-plugin-polyfill-regenerator "^0.5.3" - core-js-compat "^3.31.0" - semver "^6.3.1" - "@babel/preset-flow@^7.22.15": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.23.3.tgz#8084e08b9ccec287bd077ab288b286fab96ffab1" - integrity sha512-7yn6hl8RIv+KNk6iIrGZ+D06VhVY35wLVf23Cz/mMu1zOr7u4MMP4j0nZ9tLf8+4ZFpnib8cFYgB/oYg9hfswA== + version "7.24.0" + resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.24.0.tgz#0de60271b0a439b415501c5b28f685fbcb080e1c" + integrity sha512-cum/nSi82cDaSJ21I4PgLTVlj0OXovFk6GRguJYe/IKg6y6JHLTbJhybtX4k35WT9wdeJfEVjycTixMhBHd0Dg== dependencies: - "@babel/helper-plugin-utils" "^7.22.5" - "@babel/helper-validator-option" "^7.22.15" + "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-validator-option" "^7.23.5" "@babel/plugin-transform-flow-strip-types" "^7.23.3" "@babel/preset-modules@0.1.6-no-external-plugins": @@ -1631,14 +1450,14 @@ "@babel/plugin-transform-typescript" "^7.23.3" "@babel/register@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.22.15.tgz#c2c294a361d59f5fa7bcc8b97ef7319c32ecaec7" - integrity sha512-V3Q3EqoQdn65RCgTLwauZaTfd1ShhwPmbBv+1dkZV/HpCGMKVyn6oFcRlI7RaKqiDQjX2Qd3AuoEguBgdjIKlg== + version "7.23.7" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.23.7.tgz#485a5e7951939d21304cae4af1719fdb887bc038" + integrity sha512-EjJeB6+kvpk+Y5DAkEAmbOBEFkh9OASx0huoEkqYTFxAZHzOAX2Oh5uwAUuL2rUddqfM0SA+KPXV2TbzoZ2kvQ== dependencies: clone-deep "^4.0.1" find-cache-dir "^2.0.0" make-dir "^2.1.0" - pirates "^4.0.5" + pirates "^4.0.6" source-map-support "^0.5.16" "@babel/regjsgen@^0.8.0": @@ -1710,10 +1529,10 @@ "@babel/parser" "^7.24.0" "@babel/types" "^7.24.0" -"@babel/traverse@^7.18.9", "@babel/traverse@^7.23.6": - version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.6.tgz#b53526a2367a0dd6edc423637f3d2d0f2521abc5" - integrity sha512-czastdK1e8YByZqezMPFiZ8ahwVMh/ESl9vPgvgdB9AmFMGP5jfpFax74AQgl5zj4XHzqeYAg2l8PuUeRS1MgQ== +"@babel/traverse@^7.18.9", "@babel/traverse@^7.24.0": + version "7.24.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.0.tgz#4a408fbf364ff73135c714a2ab46a5eab2831b1e" + integrity sha512-HfuJlI8qq3dEDmNU5ChzzpZRWq+oxCZQyMzIMEqLho+AQnhMnKQUzH6ydo3RBl/YjPCuk68Y6s0Gx0AeyULiWw== dependencies: "@babel/code-frame" "^7.23.5" "@babel/generator" "^7.23.6" @@ -1721,8 +1540,8 @@ "@babel/helper-function-name" "^7.23.0" "@babel/helper-hoist-variables" "^7.22.5" "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/parser" "^7.23.6" - "@babel/types" "^7.23.6" + "@babel/parser" "^7.24.0" + "@babel/types" "^7.24.0" debug "^4.3.1" globals "^11.1.0" @@ -1742,22 +1561,6 @@ debug "^4.1.0" globals "^11.1.0" -"@babel/traverse@^7.24.0": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.0.tgz#4a408fbf364ff73135c714a2ab46a5eab2831b1e" - integrity sha512-HfuJlI8qq3dEDmNU5ChzzpZRWq+oxCZQyMzIMEqLho+AQnhMnKQUzH6ydo3RBl/YjPCuk68Y6s0Gx0AeyULiWw== - dependencies: - "@babel/code-frame" "^7.23.5" - "@babel/generator" "^7.23.6" - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-function-name" "^7.23.0" - "@babel/helper-hoist-variables" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/parser" "^7.24.0" - "@babel/types" "^7.24.0" - debug "^4.3.1" - globals "^11.1.0" - "@babel/types@^7.0.0", "@babel/types@^7.18.6", "@babel/types@^7.20.2", "@babel/types@^7.20.7", "@babel/types@^7.21.0", "@babel/types@^7.21.2", "@babel/types@^7.21.3", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.9.5": version "7.21.3" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.21.3.tgz#4865a5357ce40f64e3400b0f3b737dc6d4f64d05" @@ -1767,10 +1570,10 @@ "@babel/helper-validator-identifier" "^7.19.1" to-fast-properties "^2.0.0" -"@babel/types@^7.18.9", "@babel/types@^7.23.6": - version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.6.tgz#be33fdb151e1f5a56877d704492c240fc71c7ccd" - integrity sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg== +"@babel/types@^7.18.9", "@babel/types@^7.23.6", "@babel/types@^7.24.0": + version "7.24.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.0.tgz#3b951f435a92e7333eba05b7566fd297960ea1bf" + integrity sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w== dependencies: "@babel/helper-string-parser" "^7.23.4" "@babel/helper-validator-identifier" "^7.22.20" @@ -1803,15 +1606,6 @@ "@babel/helper-validator-identifier" "^7.22.5" to-fast-properties "^2.0.0" -"@babel/types@^7.24.0": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.0.tgz#3b951f435a92e7333eba05b7566fd297960ea1bf" - integrity sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w== - dependencies: - "@babel/helper-string-parser" "^7.23.4" - "@babel/helper-validator-identifier" "^7.22.20" - to-fast-properties "^2.0.0" - "@base2/pretty-print-object@1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@base2/pretty-print-object/-/pretty-print-object-1.0.1.tgz#371ba8be66d556812dc7fb169ebc3c08378f69d4" @@ -2590,11 +2384,16 @@ resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== -"@jridgewell/resolve-uri@^3.0.3", "@jridgewell/resolve-uri@^3.1.0": +"@jridgewell/resolve-uri@^3.0.3": version "3.1.1" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== +"@jridgewell/resolve-uri@^3.1.0": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" + integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== + "@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1": version "1.1.2" resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" @@ -2651,13 +2450,18 @@ "@jridgewell/sourcemap-codec" "1.4.14" "@jridgewell/trace-mapping@^0.3.20": - version "0.3.22" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz#72a621e5de59f5f1ef792d0793a82ee20f645e4c" - integrity sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw== + version "0.3.23" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.23.tgz#afc96847f3f07841477f303eed687707a5aacd80" + integrity sha512-9/4foRoUKp8s96tSkh8DlAAc5A0Ty8vLXld+l9gjKKY6ckwI8G15f0hskGmuLZu78ZlGa1vtsfOa+lnB4vG6Jg== dependencies: "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" +"@jsdevtools/ono@^7.1.3": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@jsdevtools/ono/-/ono-7.1.3.tgz#9df03bbd7c696a5c58885c34aa06da41c8543796" + integrity sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg== + "@juggle/resize-observer@^3.3.1": version "3.4.0" resolved "https://registry.yarnpkg.com/@juggle/resize-observer/-/resize-observer-3.4.0.tgz#08d6c5e20cf7e4cc02fd181c4b0c225cd31dbb60" @@ -2800,9 +2604,9 @@ integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== "@pkgr/core@^0.1.0": - version "0.1.0" - resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.0.tgz#7d8dacb7fdef0e4387caf7396cbd77f179867d06" - integrity sha512-Zwq5OCzuwJC2jwqmpEQt7Ds1DTi6BWSwoGkbb1n9pO3hzb35BoJELx7c0T23iDkBGkh2e7tvOtjF3tr3OaQHDQ== + version "0.1.1" + resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" + integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== "@pmmmwh/react-refresh-webpack-plugin@^0.5.11": version "0.5.11" @@ -5153,9 +4957,9 @@ "@babel/types" "^7.3.0" "@types/babel__traverse@^7.18.0": - version "7.20.4" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.4.tgz#ec2c06fed6549df8bc0eb4615b683749a4a92e1b" - integrity sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA== + version "7.20.5" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.5.tgz#7b7502be0aa80cc4ef22978846b983edaafcd4dd" + integrity sha512-WXCyOcRtH37HAUkpXhUduaxdm82b4GSlyTqajXviN4EfiuPgNYR109xMCKvpl6zPIpua0DGlMEDCq+g8EdoheQ== dependencies: "@babel/types" "^7.20.7" @@ -5342,7 +5146,7 @@ "@types/tough-cookie" "*" parse5 "^7.0.0" -"@types/json-schema@*", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": +"@types/json-schema@*", "@types/json-schema@^7.0.6", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.11" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== @@ -5433,9 +5237,9 @@ integrity sha512-wf3Vz+jCmOQ2HV1YUJuCWdL64adYxumkrxtc+H1VUQlnQI04+5HtH+qZCOE21lBE7gIrt+CwX2Wv8Acrw5Ak6w== "@types/node@^20.11.16": - version "20.11.19" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.19.tgz#b466de054e9cb5b3831bee38938de64ac7f81195" - integrity sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ== + version "20.11.21" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.21.tgz#ad67e65652f7be15686e2df87a38076a81c5e9c5" + integrity sha512-/ySDLGscFPNasfqStUuWWPfL78jompfIoVzLJPVVAHBh6rpG68+pI2Gk+fNLeI8/f1yPYL4s46EleVIc20F1Ow== dependencies: undici-types "~5.26.4" @@ -5566,16 +5370,11 @@ resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d" integrity sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ== -"@types/uuid@9.0.8": +"@types/uuid@9.0.8", "@types/uuid@^9.0.1": version "9.0.8" resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.8.tgz#7545ba4fc3c003d6c756f651f3bf163d8f0f29ba" integrity sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA== -"@types/uuid@^9.0.1": - version "9.0.7" - resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.7.tgz#b14cebc75455eeeb160d5fe23c2fcc0c64f724d8" - integrity sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g== - "@types/wrap-ansi@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz#18b97a972f94f60a679fd5c796d96421b9abb9fd" @@ -5636,13 +5435,13 @@ "@typescript-eslint/types" "5.62.0" "@typescript-eslint/visitor-keys" "5.62.0" -"@typescript-eslint/scope-manager@6.19.0": - version "6.19.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.19.0.tgz#b6d2abb825b29ab70cb542d220e40c61c1678116" - integrity sha512-dO1XMhV2ehBI6QN8Ufi7I10wmUovmLU0Oru3n5LVlM2JuzB4M+dVphCPLkVpKvGij2j/pHBWuJ9piuXx+BhzxQ== +"@typescript-eslint/scope-manager@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz#ea8a9bfc8f1504a6ac5d59a6df308d3a0630a2b1" + integrity sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg== dependencies: - "@typescript-eslint/types" "6.19.0" - "@typescript-eslint/visitor-keys" "6.19.0" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" "@typescript-eslint/scope-manager@7.1.0": version "7.1.0" @@ -5667,10 +5466,10 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.62.0.tgz#258607e60effa309f067608931c3df6fed41fd2f" integrity sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ== -"@typescript-eslint/types@6.19.0": - version "6.19.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.19.0.tgz#689b0498c436272a6a2059b09f44bcbd90de294a" - integrity sha512-lFviGV/vYhOy3m8BJ/nAKoAyNhInTdXpftonhWle66XHAtT1ouBlkjL496b5H5hb8dWXHwtypTqgtb/DEa+j5A== +"@typescript-eslint/types@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.21.0.tgz#205724c5123a8fef7ecd195075fa6e85bac3436d" + integrity sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg== "@typescript-eslint/types@7.1.0": version "7.1.0" @@ -5690,13 +5489,13 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/typescript-estree@6.19.0": - version "6.19.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.19.0.tgz#0813ba364a409afb4d62348aec0202600cb468fa" - integrity sha512-o/zefXIbbLBZ8YJ51NlkSAt2BamrK6XOmuxSR3hynMIzzyMY33KuJ9vuMdFSXW+H0tVvdF9qBPTHA91HDb4BIQ== +"@typescript-eslint/typescript-estree@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz#c47ae7901db3b8bddc3ecd73daff2d0895688c46" + integrity sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ== dependencies: - "@typescript-eslint/types" "6.19.0" - "@typescript-eslint/visitor-keys" "6.19.0" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" @@ -5746,16 +5545,16 @@ semver "^7.3.7" "@typescript-eslint/utils@^6.18.1": - version "6.19.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.19.0.tgz#557b72c3eeb4f73bef8037c85dae57b21beb1a4b" - integrity sha512-QR41YXySiuN++/dC9UArYOg4X86OAYP83OWTewpVx5ct1IZhjjgTLocj7QNxGhWoTqknsgpl7L+hGygCO+sdYw== + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.21.0.tgz#4714e7a6b39e773c1c8e97ec587f520840cd8134" + integrity sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ== dependencies: "@eslint-community/eslint-utils" "^4.4.0" "@types/json-schema" "^7.0.12" "@types/semver" "^7.5.0" - "@typescript-eslint/scope-manager" "6.19.0" - "@typescript-eslint/types" "6.19.0" - "@typescript-eslint/typescript-estree" "6.19.0" + "@typescript-eslint/scope-manager" "6.21.0" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/typescript-estree" "6.21.0" semver "^7.5.4" "@typescript-eslint/visitor-keys@5.62.0": @@ -5766,12 +5565,12 @@ "@typescript-eslint/types" "5.62.0" eslint-visitor-keys "^3.3.0" -"@typescript-eslint/visitor-keys@6.19.0": - version "6.19.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.19.0.tgz#4565e0ecd63ca1f81b96f1dd76e49f746c6b2b49" - integrity sha512-hZaUCORLgubBvtGpp1JEFEazcuEdfxta9j4iUwdSAr7mEsYYAp3EAUyCZk3VEEqGj6W+AV4uWyrDGtrlawAsgQ== +"@typescript-eslint/visitor-keys@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz#87a99d077aa507e20e238b11d56cc26ade45fe47" + integrity sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A== dependencies: - "@typescript-eslint/types" "6.19.0" + "@typescript-eslint/types" "6.21.0" eslint-visitor-keys "^3.4.1" "@typescript-eslint/visitor-keys@7.1.0": @@ -6603,15 +6402,6 @@ babel-plugin-jest-hoist@^29.6.3: "@types/babel__core" "^7.1.14" "@types/babel__traverse" "^7.0.6" -babel-plugin-polyfill-corejs2@^0.4.6: - version "0.4.6" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.6.tgz#b2df0251d8e99f229a8e60fc4efa9a68b41c8313" - integrity sha512-jhHiWVZIlnPbEUKSSNb9YoWcQGdlTLq7z1GHL4AjFxaoOUMuuEVJ+Y4pAaQUGOGk93YsVCKPbqbfw3m0SM6H8Q== - dependencies: - "@babel/compat-data" "^7.22.6" - "@babel/helper-define-polyfill-provider" "^0.4.3" - semver "^6.3.1" - babel-plugin-polyfill-corejs2@^0.4.8: version "0.4.8" resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.8.tgz#dbcc3c8ca758a290d47c3c6a490d59429b0d2269" @@ -6621,14 +6411,6 @@ babel-plugin-polyfill-corejs2@^0.4.8: "@babel/helper-define-polyfill-provider" "^0.5.0" semver "^6.3.1" -babel-plugin-polyfill-corejs3@^0.8.5: - version "0.8.6" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.8.6.tgz#25c2d20002da91fe328ff89095c85a391d6856cf" - integrity sha512-leDIc4l4tUgU7str5BWLS2h8q2N4Nf6lGZP6UrNDxdtfF2g69eJ5L0H7S8A5Ln/arfFAfHor5InAdZuIOwZdgQ== - dependencies: - "@babel/helper-define-polyfill-provider" "^0.4.3" - core-js-compat "^3.33.1" - babel-plugin-polyfill-corejs3@^0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.9.0.tgz#9eea32349d94556c2ad3ab9b82ebb27d4bf04a81" @@ -6637,13 +6419,6 @@ babel-plugin-polyfill-corejs3@^0.9.0: "@babel/helper-define-polyfill-provider" "^0.5.0" core-js-compat "^3.34.0" -babel-plugin-polyfill-regenerator@^0.5.3: - version "0.5.3" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.5.3.tgz#d4c49e4b44614607c13fb769bcd85c72bb26a4a5" - integrity sha512-8sHeDOmXC8csczMrYEOf0UTNa4yE2SxV5JGeT/LP1n0OYVDUUFPxG9vdk2AlDlIit4t+Kf0xCtpgXPBwnn/9pw== - dependencies: - "@babel/helper-define-polyfill-provider" "^0.4.3" - babel-plugin-polyfill-regenerator@^0.5.5: version "0.5.5" resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.5.5.tgz#8b0c8fc6434239e5d7b8a9d1f832bb2b0310f06a" @@ -6832,23 +6607,13 @@ browserslist@^4.21.9: node-releases "^2.0.12" update-browserslist-db "^1.0.11" -browserslist@^4.22.1: - version "4.22.1" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.22.1.tgz#ba91958d1a59b87dab6fed8dfbcb3da5e2e9c619" - integrity sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ== - dependencies: - caniuse-lite "^1.0.30001541" - electron-to-chromium "^1.4.535" - node-releases "^2.0.13" - update-browserslist-db "^1.0.13" - -browserslist@^4.22.2: - version "4.22.2" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.22.2.tgz#704c4943072bd81ea18997f3bd2180e89c77874b" - integrity sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A== +browserslist@^4.22.2, browserslist@^4.22.3: + version "4.23.0" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.0.tgz#8f3acc2bbe73af7213399430890f86c63a5674ab" + integrity sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ== dependencies: - caniuse-lite "^1.0.30001565" - electron-to-chromium "^1.4.601" + caniuse-lite "^1.0.30001587" + electron-to-chromium "^1.4.668" node-releases "^2.0.14" update-browserslist-db "^1.0.13" @@ -6915,6 +6680,11 @@ call-bind@^1.0.6, call-bind@^1.0.7: get-intrinsic "^1.2.4" set-function-length "^1.2.1" +call-me-maybe@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.2.tgz#03f964f19522ba643b1b0693acb9152fe2074baa" + integrity sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ== + callsites@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" @@ -6933,7 +6703,7 @@ camelcase@^5.3.1: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -camelcase@^6.2.0: +camelcase@^6.2.0, camelcase@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== @@ -6943,15 +6713,10 @@ caniuse-lite@^1.0.30001449, caniuse-lite@^1.0.30001503, caniuse-lite@^1.0.300015 resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001542.tgz" integrity sha512-UrtAXVcj1mvPBFQ4sKd38daP8dEcXXr5sQe6QNNinaPd0iA/cxg9/l3VrSdL73jgw5sKyuQ6jNgiKO12W3SsVA== -caniuse-lite@^1.0.30001541: - version "1.0.30001553" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001553.tgz#e64e7dc8fd4885cd246bb476471420beb5e474b5" - integrity sha512-N0ttd6TrFfuqKNi+pMgWJTb9qrdJu4JSpgPFLe/lrD19ugC6fZgF0pUewRowDwzdDnb9V41mFcdlYgl/PyKf4A== - -caniuse-lite@^1.0.30001565: - version "1.0.30001568" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001568.tgz#53fa9297273c9a977a560663f48cbea1767518b7" - integrity sha512-vSUkH84HontZJ88MiNrOau1EBrCqEQYgkC5gIySiDlpsm8sGVrhU7Kx4V6h0tnqaHzIHZv08HlJIwPbL4XL9+A== +caniuse-lite@^1.0.30001587: + version "1.0.30001591" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001591.tgz#16745e50263edc9f395895a7cd468b9f3767cf33" + integrity sha512-PCzRMei/vXjJyL5mJtzNiUCKP59dm8Apqc3PH8gJkMnMXZGox93RbE76jHsmLwmIo6/3nsYIpJtx0O7u5PqFuQ== case-sensitive-paths-webpack-plugin@^2.4.0: version "2.4.0" @@ -7184,6 +6949,11 @@ commander@^10.0.1: resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== +commander@^11.0.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-11.1.0.tgz#62fdce76006a68e5c1ab3314dc92e800eb83d906" + integrity sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ== + commander@^2.20.0: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" @@ -7298,19 +7068,12 @@ core-js-compat@^3.31.0: dependencies: browserslist "^4.21.9" -core-js-compat@^3.33.1: - version "3.33.1" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.33.1.tgz#debe80464107d75419e00c2ee29f35982118ff84" - integrity sha512-6pYKNOgD/j/bkC5xS5IIg6bncid3rfrI42oBH1SQJbsmYPKF7rhzcFzYCcxYMmNQQ0rCEB8WqpW7QHndOggaeQ== - dependencies: - browserslist "^4.22.1" - core-js-compat@^3.34.0: - version "3.35.1" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.35.1.tgz#215247d7edb9e830efa4218ff719beb2803555e2" - integrity sha512-sftHa5qUJY3rs9Zht1WEnmkvXputCyDBczPnr7QDgL8n3qrF3CMXY4VPSYtOLLiOUJcah2WNXREd48iOl6mQIw== + version "3.36.0" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.36.0.tgz#087679119bc2fdbdefad0d45d8e5d307d45ba190" + integrity sha512-iV9Pd/PsgjNWBXeq8XRtWVSgz2tKAfhfvBs7qxYty+RlRd+OCksaWmOnc4JKrTc1cToXL1N0s3l/vwlxPtdElw== dependencies: - browserslist "^4.22.2" + browserslist "^4.22.3" core-js-pure@^3.23.3: version "3.30.0" @@ -7831,15 +7594,10 @@ electron-to-chromium@^1.4.477: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.508.tgz#5641ff2f5ba11df4bd960fe6a2f9f70aa8b9af96" integrity sha512-FFa8QKjQK/A5QuFr2167myhMesGrhlOBD+3cYNxO9/S4XzHEXesyTD/1/xF644gC8buFPz3ca6G1LOQD0tZrrg== -electron-to-chromium@^1.4.535: - version "1.4.563" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.563.tgz#dabb424202754c1fed2d2938ff564b23d3bbf0d3" - integrity sha512-dg5gj5qOgfZNkPNeyKBZQAQitIQ/xwfIDmEQJHCbXaD9ebTZxwJXUsDYcBlAvZGZLi+/354l35J1wkmP6CqYaw== - -electron-to-chromium@^1.4.601: - version "1.4.609" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.609.tgz#5790a70aaa96de232501b56e14b64d17aff93988" - integrity sha512-ihiCP7PJmjoGNuLpl7TjNA8pCQWu09vGyjlPYw1Rqww4gvNuCcmvl+44G+2QyJ6S2K4o+wbTS++Xz0YN8Q9ERw== +electron-to-chromium@^1.4.668: + version "1.4.685" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.685.tgz#3ce988e4dfbb3aa984840394b1d7064c01ad74c1" + integrity sha512-yDYeobbTEe4TNooEzOQO6xFqg9XnAkVy2Lod1C1B2it8u47JNLYvl9nLDWBamqUakWB8Jc1hhS1uHUNYTNQdfw== emittery@^0.13.1: version "0.13.1" @@ -9023,7 +8781,7 @@ fs-constants@^1.0.0: resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== -fs-extra@11.1.1, fs-extra@^11.1.0: +fs-extra@11.1.1, fs-extra@^11.1.0, fs-extra@^11.1.1: version "11.1.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.1.1.tgz#da69f7c39f3b002378b0954bb6ae7efdc0876e2d" integrity sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ== @@ -10658,9 +10416,9 @@ js-yaml@^4.1.0: argparse "^2.0.1" jscodeshift@^0.15.1: - version "0.15.1" - resolved "https://registry.yarnpkg.com/jscodeshift/-/jscodeshift-0.15.1.tgz#6c7a9572acdfa4f54098e958f71a05716a4e546b" - integrity sha512-hIJfxUy8Rt4HkJn/zZPU9ChKfKZM1342waJ1QC2e2YsPcWhM+3BJ4dcfQCzArTrk1jJeNLB341H+qOcEHRxJZg== + version "0.15.2" + resolved "https://registry.yarnpkg.com/jscodeshift/-/jscodeshift-0.15.2.tgz#145563860360b4819a558c75c545f39683e5a0be" + integrity sha512-FquR7Okgmc4Sd0aEDwqho3rEiKR3BdvuG9jfdHjLJ6JQoWSMpavug3AoIfnfWhxFlf+5pzQh8qjqz0DWFrNQzA== dependencies: "@babel/core" "^7.23.0" "@babel/parser" "^7.23.0" @@ -10730,6 +10488,13 @@ json-parse-even-better-errors@^2.3.0, json-parse-even-better-errors@^2.3.1: resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== +json-schema-ref-parser@^9.0.9: + version "9.0.9" + resolved "https://registry.yarnpkg.com/json-schema-ref-parser/-/json-schema-ref-parser-9.0.9.tgz#66ea538e7450b12af342fa3d5b8458bc1e1e013f" + integrity sha512-qcP2lmGy+JUoQJ4DOQeLaZDqH9qSkeGCK3suKWxJXS82dg728Mn3j97azDMaOUmJAN4uCq91LdPx4K7E8F1a7Q== + dependencies: + "@apidevtools/json-schema-ref-parser" "9.0.9" + json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" @@ -10992,9 +10757,9 @@ magic-string@^0.30.0: "@jridgewell/sourcemap-codec" "^1.4.13" magic-string@^0.30.5: - version "0.30.5" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.5.tgz#1994d980bd1c8835dc6e78db7cbd4ae4f24746f9" - integrity sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA== + version "0.30.7" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.7.tgz#0cecd0527d473298679da95a2d7aeb8c64048505" + integrity sha512-8vBuFF/I/+OSLRmdf2wwFCJCz+nSn0m6DPvGH1fS/KiQoSaR+sETbov0eIk9KhEKy8CYqIkIAnbohxT/4H0kuA== dependencies: "@jridgewell/sourcemap-codec" "^1.4.15" @@ -11565,6 +11330,17 @@ open@^8.0.4, open@^8.4.0: is-docker "^2.1.1" is-wsl "^2.2.0" +openapi-typescript-codegen@0.25.0: + version "0.25.0" + resolved "https://registry.yarnpkg.com/openapi-typescript-codegen/-/openapi-typescript-codegen-0.25.0.tgz#0cb028f54b33b0a63bd9da3756c1c41b4e1a70e2" + integrity sha512-nN/TnIcGbP58qYgwEEy5FrAAjePcYgfMaCe3tsmYyTgI3v4RR9v8os14L+LEWDvV50+CmqiyTzRkKKtJeb6Ybg== + dependencies: + camelcase "^6.3.0" + commander "^11.0.0" + fs-extra "^11.1.1" + handlebars "^4.7.7" + json-schema-ref-parser "^9.0.9" + optionator@^0.8.1: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" @@ -11822,11 +11598,16 @@ pify@^4.0.1: resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== -pirates@^4.0.4, pirates@^4.0.5: +pirates@^4.0.4: version "4.0.5" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.5.tgz#feec352ea5c3268fb23a37c702ab1699f35a5f3b" integrity sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ== +pirates@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.6.tgz#3018ae32ecfcff6c29ba2267cbf21166ac1f36b9" + integrity sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg== + pkg-dir@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" @@ -12244,9 +12025,9 @@ react-docgen-typescript@^2.2.2: integrity sha512-tvg2ZtOpOi6QDwsb3GZhOjDkkX0h8Z2gipvTg6OVMUyoYoURhEiRNePT8NZItTVCDh39JJHnLdfCOkzoLbFnTg== react-docgen@^7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/react-docgen/-/react-docgen-7.0.1.tgz#b6528fe45385908645ffbee1ec0d65709e1e047c" - integrity sha512-rCz0HBIT0LWbIM+///LfRrJoTKftIzzwsYDf0ns5KwaEjejMHQRtphcns+IXFHDNY9pnz6G8l/JbbI6pD4EAIA== + version "7.0.3" + resolved "https://registry.yarnpkg.com/react-docgen/-/react-docgen-7.0.3.tgz#f811b785f07b1f2023cb899b6bcf9d522b21b95d" + integrity sha512-i8aF1nyKInZnANZ4uZrH49qn1paRgBZ7wZiCNBMnenlPzEv0mRl+ShpTVEI6wZNl8sSc79xZkivtgLKQArcanQ== dependencies: "@babel/core" "^7.18.9" "@babel/traverse" "^7.18.9" @@ -13467,9 +13248,9 @@ terser@^5.16.5: source-map-support "~0.5.20" terser@^5.26.0: - version "5.27.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.27.0.tgz#70108689d9ab25fef61c4e93e808e9fd092bf20c" - integrity sha512-bi1HRwVRskAjheeYl291n3JC4GgO/Ty4z1nVs5AAsmonJulGxpSektecnNedrwK9C7vpvVtcX3cw00VSLt7U2A== + version "5.28.1" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.28.1.tgz#bf00f7537fd3a798c352c2d67d67d65c915d1b28" + integrity sha512-wM+bZp54v/E9eRRGXb5ZFDvinrJIOaTapx3WUokyVGZu5ucVCK55zEgGd5Dl2fSr3jUo5sDiERErUWLY6QPFyA== dependencies: "@jridgewell/source-map" "^0.3.3" acorn "^8.8.2" @@ -13724,9 +13505,9 @@ type-fest@^2.19.0, type-fest@~2.19: integrity sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA== type-fest@^4.9.0: - version "4.9.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.9.0.tgz#d29c8efe5b1e703feeb29cef23d887b2f479844d" - integrity sha512-KS/6lh/ynPGiHD/LnAobrEFq3Ad4pBzOlJ1wAnJx9N4EYoqFhMfLIBjUT2UEx4wg5ZE+cC1ob6DCSpppVo+rtg== + version "4.10.3" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.10.3.tgz#ff01cb0a1209f59583d61e1312de9715e7ea4874" + integrity sha512-JLXyjizi072smKGGcZiAJDCNweT8J+AuRxmPZ1aG7TERg4ijx9REl8CNhbr36RV4qXqL1gO1FF9HL8OkVmmrsA== type-is@~1.6.18: version "1.6.18"