ldc-showroom/index.d.ts
2025-07-09 11:30:19 +02:00

183 lines
4.7 KiB
TypeScript

export { };
import type { RouteLocation as NRouteLocation } from "vue-router";
import type { ipcRendererObject, versions } from "./electron/preload";
// * --- MODELS From JSON Schema
type Locale = string;
type i18nFieldList = "name" | "slug" | "description" | "sub_title" | "footer_phrase";
type i18nField = Record<string, string>;
type i18nModel = SettingsModel | BrandModel | RangeModel | ProductModel;
/** Showroom Bo json data format */
type AppModel = {
/** Version de l'application */
version: string;
settings: SettingsModel;
items: Array<BrandModel>;
fonts: Array<FontModel>;
}
/** Settings from Showroom Bo */
type SettingsModel = {
/** Langues disponibles dans l'application */
locales: Array<string>
/** Sous-titre de l'application */
sub_title: i18nField;
/** Texte en bas de page */
footer_phrase: i18nField;
/** Logo de l'application, chemin tel que présent dans le zip */
logo: string;
/** Couleur de l'application (hex color) */
color: string;
/** Temps en secondes avant retour sur la page home lorsque inactif */
home_timeout: number;
created_at: string;
updated_at: string;
};
/** A font from Showroom Bo */
type FontModel = {
/** The unique identifier for a font */
id: number;
/** Nom de la marque */
font_name: string;
/** Chemin vers fichier de la font, chemin tel que présent dans le zip*/
font: string|null;
created_at: string;
updated_at: string;
};
/** A brand from Showroom Bo */
type BrandModel = {
/** The unique identifier for a brand */
id: number;
/** Nom de la marque */
name: i18nField;
/** Slug de la marque */
slug: i18nField;
/** Couleur de la marque (hex color) */
color: string;
/** Logo de la marque, chemin tel que présent dans le zip */
picture: string;
/** Les enfant sont rendus sur un étagere */
shelf: boolean;
/** Visible ? (présent dans l'export). Toujours à true in Showroom App */
status: boolean;
created_at: string;
updated_at: string;
ranges: Array<RangeModel>;
};
/** A range from Showroom Bo */
type RangeModel = {
/** The unique identifier for a range */
id: number;
/** Nom de la gamme */
name: i18nField;
/** Slug de la gamme */
slug: i18nField;
/** Logo de la gamme, chemin tel que présent dans le zip */
picture: string;
/** Couleur de la gamme */
color: string;
/** Largeur de la gamme 1 colonne ou 2 colonnes (pleine largeur)e */
width: number;
/** Ordre d'affichage de la gamme */
order: number;
/** Les enfant sont rendus sur un étagere */
shelf: boolean;
/** Visible ? (présent dans l'export). Toujours à true in Showroom App */
status: boolean;
/** Clé étrangère de la marque */
brand_id: number;
/** Clé étrangère de la police */
font_id: number;
created_at: string;
updated_at: string;
products: Array<ProductModel>;
};
/** A product from Showroom Bo */
type ProductModel = {
/** The unique identifier for a product */
id: number;
/** Nom du produit */
name: i18nField;
/** Slug du produit */
slug: i18nField;
/** Description du produit, texte WYSYWYG */
description: i18nField;
/** Logo du produit, chemin tel que présent dans le zip */
picture: string;
/** Visible ? (présent dans l'export). Toujours à true in Showroom App */
status: boolean;
/** Clé étrangère de la gamme */
range_id: number;
created_at: string;
updated_at: string;
};
// * --- END MODELS
type ItemObject = {
id: number
name: string
teaser: string
img: string
description: string
}
type ModalSettings = {
ctaBtnText: string;
ctaDisclaimerText: string;
ctaSaveBtn: string;
}
type ContactModel = {
product_id: number;
email: string;
consent: boolean;
}
type DataModel = {
logo: {
src: string,
width: string
},
title: string,
modalSettings: ModalSettings,
itemsByLine: number,
items: Array<ItemObject>
};
declare global {
type Data = DataModel
type Item = ItemObject
type Settings = ModalSettings;
type Contact = ContactModel;
// * App Models
type TypeApp = AppModel;
type TypeSettings = SettingsModel;
type TypeBrand = BrandModel;
type TypeRange = RangeModel;
type TypeProduct = ProductModel;
type TypeFont = FontModel;
type Typei18nField = i18nField;
type Typei18nFieldList = i18nFieldList;
type Typei18nModel = i18nModel;
type ToastTypeEnum = ToastType;
// Nuxt
type RouteLocation = NRouteLocation;
interface Window {
versions: typeof versions
ipcRendererObject: typeof ipcRendererObject
}
}