152 lines
3.6 KiB
TypeScript
152 lines
3.6 KiB
TypeScript
import type VueTagsInput from "@sipec/vue3-tags-input";
|
|
|
|
|
|
|
|
// * Enum
|
|
interface EnumInterface {
|
|
label: string;
|
|
value: number | string;
|
|
}
|
|
|
|
type HexColorType = string;
|
|
type HexColorNameType = string;
|
|
type ColorType = {
|
|
name: HexColorNameType;
|
|
color: HexColorType;
|
|
}
|
|
|
|
// * Product Option
|
|
type ProductOptionChoiceType = {
|
|
/** Nom du choix */
|
|
label: string;
|
|
/** Valeur en centimes */
|
|
value: number;
|
|
};
|
|
type OrderOptionType = {
|
|
name: string;
|
|
choice: ProductOptionChoiceType,
|
|
/** Valeur en centimes */
|
|
price: number;
|
|
}
|
|
type ProductOptionType = {
|
|
name: string;
|
|
choices: Array<ProductOptionChoiceType>
|
|
}
|
|
|
|
// * Basket Item
|
|
type BasketItemType = {
|
|
id: number;
|
|
slug: string;
|
|
name: string;
|
|
url: string;
|
|
price: number;
|
|
price_ori: number;
|
|
discount_type: "product" | "customer" | null;
|
|
discount_value: number;
|
|
quantity: number;
|
|
tax: number;
|
|
weight: float;
|
|
color: Color|null;
|
|
options: BasketOptionsType;
|
|
}
|
|
|
|
// * Basket Options
|
|
type BasketOptionsType = Record<string, OrderOptionType>;
|
|
|
|
// * Laravel Paginator
|
|
|
|
interface PaginatorLink {
|
|
url: null | string;
|
|
label: string;
|
|
active: boolean;
|
|
}
|
|
|
|
interface Paginator {
|
|
current_page: number;
|
|
first_page_url: string;
|
|
from: number;
|
|
last_page: number;
|
|
last_page_url: string;
|
|
links: Array<PaginatorLink>;
|
|
next_page_url: string | null;
|
|
path: string;
|
|
per_page: number;
|
|
prev_page_url: string | null;
|
|
to: number;
|
|
total: number;
|
|
}
|
|
|
|
// * Recursive List<string>
|
|
type StringList = Record<PropertyKey, string>;
|
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
interface NestedStringListInterface
|
|
extends Record<PropertyKey, NestedStringListInterface | StringList> {}
|
|
|
|
// * Recursive List<number>
|
|
type NumberList = Record<PropertyKey, number>;
|
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
interface NestedNumberListInterface
|
|
extends Record<PropertyKey, NestedNumberListInterface | NumberList> {}
|
|
|
|
// * Recursive List<Model>
|
|
type Model = Record<
|
|
string,
|
|
| string
|
|
| boolean
|
|
| number
|
|
| object
|
|
| NestedStringList
|
|
| NestedNumberList
|
|
| NestedModelInterface
|
|
| ModelListInterface
|
|
>;
|
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
interface NestedModelInterface extends Model {}
|
|
|
|
type NestedStringList = NestedStringListInterface | StringList | string;
|
|
type NestedNumberList = NestedNumberListInterface | NumberList | number;
|
|
|
|
type ModelList = Array<Model>;
|
|
type ModelListInterface = ModelList
|
|
|
|
|
|
|
|
declare global {
|
|
type CustomTag = LaravelModel & VueTagsInput.ITag;
|
|
type LaravelModel = Model;
|
|
type LaravelModelList = ModelList;
|
|
type LaravelPaginator = Paginator;
|
|
type LaravelPaginatorLink = PaginatorLink;
|
|
|
|
type Color = ColorType;
|
|
type HexColor = HexColorType;
|
|
type HexColorName = HexColorNameType;
|
|
type Enum = EnumInterface;
|
|
type ValueOf<T> = T[keyof T];
|
|
type LaravelValidationErrors = Record<string, string[]>;
|
|
|
|
var SweetAlertConfirm: confirm;
|
|
var bootstrap: typeof import("bootstrap");
|
|
var CookieNotice: import("@ldc-web/cookie-notice");
|
|
|
|
var vueDebug: boolean | undefined;
|
|
|
|
var __SYSTEM: {
|
|
_appEnv?: string;
|
|
_asset: Record<string, string>;
|
|
_vite_asset: Record<string, string>;
|
|
_locale: string;
|
|
_permissions?: Record<string, unknown>;
|
|
_routes: Record<string, string>;
|
|
_sentryDsn?: string;
|
|
_sentryTunnel?: string;
|
|
_paypal?: {
|
|
clientId: string;
|
|
currency: string;
|
|
};
|
|
_translations: {
|
|
json: NestedStringList;
|
|
php: NestedStringList;
|
|
};
|
|
};
|
|
}
|