first commit
This commit is contained in:
35
src/types/auth.ts
Normal file
35
src/types/auth.ts
Normal file
@ -0,0 +1,35 @@
|
||||
export interface Client {
|
||||
id: string
|
||||
clientNumber: string
|
||||
name: string
|
||||
phone: string
|
||||
email?: string
|
||||
}
|
||||
|
||||
export interface ClientAuthResponse {
|
||||
exists: boolean
|
||||
client?: Client
|
||||
sessionId: string
|
||||
}
|
||||
|
||||
export interface SMSCodeResponse {
|
||||
success: boolean
|
||||
sessionId: string
|
||||
code: string
|
||||
}
|
||||
|
||||
export interface VerificationResponse {
|
||||
success: boolean
|
||||
client?: Client
|
||||
token?: string
|
||||
}
|
||||
|
||||
export type AuthStep = 'phone' | 'code' | 'registration'
|
||||
|
||||
export interface AuthState {
|
||||
step: AuthStep
|
||||
phone: string
|
||||
sessionId: string
|
||||
client?: Client
|
||||
isExistingClient: boolean
|
||||
}
|
67
src/types/cart.ts
Normal file
67
src/types/cart.ts
Normal file
@ -0,0 +1,67 @@
|
||||
export interface CartItem {
|
||||
id: string
|
||||
productId?: string // для внутренних товаров
|
||||
offerKey?: string // для внешних товаров (AutoEuro)
|
||||
name: string
|
||||
description: string
|
||||
brand?: string
|
||||
article?: string
|
||||
price: number
|
||||
originalPrice?: number
|
||||
currency: string
|
||||
quantity: number
|
||||
deliveryTime?: string
|
||||
deliveryDate?: string
|
||||
warehouse?: string
|
||||
supplier?: string
|
||||
comment?: string
|
||||
selected: boolean
|
||||
favorite: boolean
|
||||
isExternal: boolean // true для товаров из AutoEuro
|
||||
image?: string
|
||||
weight?: number
|
||||
volume?: number
|
||||
canPurchase?: boolean
|
||||
}
|
||||
|
||||
export interface CartSummary {
|
||||
totalItems: number
|
||||
totalPrice: number
|
||||
totalDiscount: number
|
||||
deliveryPrice: number
|
||||
finalPrice: number
|
||||
}
|
||||
|
||||
export interface DeliveryInfo {
|
||||
type: string
|
||||
address: string
|
||||
date?: string
|
||||
time?: string
|
||||
price: number
|
||||
cost?: number
|
||||
}
|
||||
|
||||
export interface CartState {
|
||||
items: CartItem[]
|
||||
summary: CartSummary
|
||||
delivery: DeliveryInfo
|
||||
orderComment: string
|
||||
isLoading: boolean
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface CartContextType {
|
||||
state: CartState
|
||||
addItem: (item: Omit<CartItem, 'id' | 'selected' | 'favorite'>) => void
|
||||
removeItem: (id: string) => void
|
||||
updateQuantity: (id: string, quantity: number) => void
|
||||
toggleSelect: (id: string) => void
|
||||
toggleFavorite: (id: string) => void
|
||||
updateComment: (id: string, comment: string) => void
|
||||
updateOrderComment: (comment: string) => void
|
||||
selectAll: () => void
|
||||
removeAll: () => void
|
||||
removeSelected: () => void
|
||||
updateDelivery: (delivery: Partial<DeliveryInfo>) => void
|
||||
clearCart: () => void
|
||||
}
|
12
src/types/global.d.ts
vendored
Normal file
12
src/types/global.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
declare global {
|
||||
interface Window {
|
||||
WEBFLOW_INITIALIZED?: boolean;
|
||||
Webflow?: {
|
||||
ready?: () => void;
|
||||
require?: (module: string) => any;
|
||||
destroy?: () => void;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
316
src/types/laximo.ts
Normal file
316
src/types/laximo.ts
Normal file
@ -0,0 +1,316 @@
|
||||
export interface LaximoBrand {
|
||||
brand: string
|
||||
code: string
|
||||
icon: string
|
||||
name: string
|
||||
supportdetailapplicability: boolean
|
||||
supportparameteridentification2: boolean
|
||||
supportquickgroups: boolean
|
||||
supportvinsearch: boolean
|
||||
supportframesearch?: boolean
|
||||
vinexample?: string
|
||||
frameexample?: string
|
||||
features: LaximoFeature[]
|
||||
extensions?: LaximoExtensions
|
||||
}
|
||||
|
||||
export interface LaximoFeature {
|
||||
name: string
|
||||
example: string
|
||||
}
|
||||
|
||||
export interface LaximoExtensions {
|
||||
operations?: LaximoOperation[]
|
||||
}
|
||||
|
||||
export interface LaximoOperation {
|
||||
description: string
|
||||
kind: string
|
||||
name: string
|
||||
fields: LaximoField[]
|
||||
}
|
||||
|
||||
export interface LaximoField {
|
||||
description: string
|
||||
example?: string
|
||||
name: string
|
||||
pattern?: string
|
||||
}
|
||||
|
||||
// Новые интерфейсы для поиска автомобилей
|
||||
export interface LaximoCatalogInfo {
|
||||
brand: string
|
||||
code: string
|
||||
icon: string
|
||||
name: string
|
||||
supportdetailapplicability: boolean
|
||||
supportparameteridentification2: boolean
|
||||
supportquickgroups: boolean
|
||||
supportvinsearch: boolean
|
||||
supportplateidentification?: boolean
|
||||
vinexample?: string
|
||||
plateexample?: string
|
||||
features: LaximoFeature[]
|
||||
permissions: string[]
|
||||
}
|
||||
|
||||
export interface LaximoWizardStep {
|
||||
allowlistvehicles: boolean
|
||||
automatic: boolean
|
||||
conditionid: string
|
||||
determined: boolean
|
||||
name: string
|
||||
type: string
|
||||
ssd?: string
|
||||
value?: string
|
||||
valueid?: string
|
||||
options: LaximoWizardOption[]
|
||||
}
|
||||
|
||||
export interface LaximoWizardOption {
|
||||
key: string
|
||||
value: string
|
||||
}
|
||||
|
||||
export interface LaximoVehicleSearchResult {
|
||||
vehicleid: string
|
||||
name?: string
|
||||
brand: string
|
||||
catalog?: string
|
||||
model: string
|
||||
modification: string
|
||||
year: string
|
||||
bodytype: string
|
||||
engine: string
|
||||
notes?: string
|
||||
ssd?: string
|
||||
|
||||
// Дополнительные атрибуты из документации Laximo
|
||||
grade?: string
|
||||
transmission?: string
|
||||
doors?: string
|
||||
creationregion?: string
|
||||
destinationregion?: string
|
||||
date?: string
|
||||
manufactured?: string
|
||||
framecolor?: string
|
||||
trimcolor?: string
|
||||
datefrom?: string
|
||||
dateto?: string
|
||||
frame?: string
|
||||
frames?: string
|
||||
framefrom?: string
|
||||
frameto?: string
|
||||
engine1?: string
|
||||
engine2?: string
|
||||
engine_info?: string
|
||||
engineno?: string
|
||||
options?: string
|
||||
modelyearfrom?: string
|
||||
modelyearto?: string
|
||||
description?: string
|
||||
market?: string
|
||||
prodRange?: string
|
||||
prodPeriod?: string
|
||||
carpet_color?: string
|
||||
seat_combination_code?: string
|
||||
}
|
||||
|
||||
export interface LaximoVehicleInfo {
|
||||
vehicleid: string
|
||||
name: string
|
||||
ssd: string
|
||||
brand: string
|
||||
catalog: string
|
||||
attributes: LaximoVehicleAttribute[]
|
||||
}
|
||||
|
||||
export interface LaximoVehicleAttribute {
|
||||
key: string
|
||||
name: string
|
||||
value: string
|
||||
}
|
||||
|
||||
export interface LaximoQuickGroup {
|
||||
quickgroupid: string
|
||||
name: string
|
||||
link: boolean
|
||||
children?: LaximoQuickGroup[]
|
||||
code?: string
|
||||
imageurl?: string
|
||||
largeimageurl?: string
|
||||
}
|
||||
|
||||
export interface LaximoQuickDetail {
|
||||
quickgroupid: string
|
||||
name: string
|
||||
units: LaximoUnit[]
|
||||
}
|
||||
|
||||
export interface LaximoUnit {
|
||||
unitid: string
|
||||
name: string
|
||||
code?: string
|
||||
description?: string
|
||||
imageurl?: string
|
||||
largeimageurl?: string
|
||||
details?: LaximoDetail[]
|
||||
attributes?: LaximoDetailAttribute[]
|
||||
}
|
||||
|
||||
export interface LaximoDetail {
|
||||
detailid: string
|
||||
name: string
|
||||
oem: string
|
||||
formattedoem?: string
|
||||
parttype?: string
|
||||
filter?: string
|
||||
note?: string
|
||||
brand?: string
|
||||
description?: string
|
||||
applicablemodels?: string
|
||||
attributes?: LaximoDetailAttribute[]
|
||||
}
|
||||
|
||||
export interface LaximoDetailAttribute {
|
||||
key: string
|
||||
name?: string
|
||||
value: string
|
||||
}
|
||||
|
||||
export interface LaximoOEMResult {
|
||||
oemNumber: string
|
||||
categories: LaximoOEMCategory[]
|
||||
}
|
||||
|
||||
export interface LaximoOEMCategory {
|
||||
categoryid: string
|
||||
name: string
|
||||
units: LaximoOEMUnit[]
|
||||
}
|
||||
|
||||
export interface LaximoOEMUnit {
|
||||
unitid: string
|
||||
name: string
|
||||
code?: string
|
||||
imageurl?: string
|
||||
details: LaximoOEMDetail[]
|
||||
}
|
||||
|
||||
export interface LaximoOEMDetail {
|
||||
detailid: string
|
||||
name: string
|
||||
oem: string
|
||||
brand?: string
|
||||
description?: string
|
||||
amount?: string
|
||||
range?: string
|
||||
attributes?: LaximoVehicleAttribute[]
|
||||
}
|
||||
|
||||
// Новые интерфейсы для поиска деталей по названию
|
||||
export interface LaximoFulltextSearchResult {
|
||||
details: LaximoFulltextDetail[]
|
||||
}
|
||||
|
||||
export interface LaximoFulltextDetail {
|
||||
oem: string
|
||||
name: string
|
||||
brand?: string
|
||||
description?: string
|
||||
}
|
||||
|
||||
// Интерфейсы для Doc FindOEM
|
||||
export interface LaximoDocFindOEMResult {
|
||||
details: LaximoDocDetail[]
|
||||
}
|
||||
|
||||
export interface LaximoDocDetail {
|
||||
detailid: string
|
||||
formattedoem: string
|
||||
manufacturer: string
|
||||
manufacturerid: string
|
||||
name: string
|
||||
oem: string
|
||||
volume?: string
|
||||
weight?: string
|
||||
replacements: LaximoDocReplacement[]
|
||||
}
|
||||
|
||||
export interface LaximoDocReplacement {
|
||||
type: string
|
||||
way: string
|
||||
replacementid: string
|
||||
rate?: string
|
||||
detail: LaximoDocReplacementDetail
|
||||
}
|
||||
|
||||
export interface LaximoDocReplacementDetail {
|
||||
detailid: string
|
||||
formattedoem: string
|
||||
manufacturer: string
|
||||
manufacturerid: string
|
||||
name: string
|
||||
oem: string
|
||||
weight?: string
|
||||
icon?: string
|
||||
}
|
||||
|
||||
// Интерфейсы для поиска автомобилей по артикулу
|
||||
export interface LaximoCatalogVehicleResult {
|
||||
catalogCode: string
|
||||
catalogName: string
|
||||
brand: string
|
||||
vehicles: LaximoVehicleSearchResult[]
|
||||
vehicleCount: number
|
||||
}
|
||||
|
||||
export interface LaximoVehiclesByPartResult {
|
||||
partNumber: string
|
||||
catalogs: LaximoCatalogVehicleResult[]
|
||||
totalVehicles: number
|
||||
}
|
||||
|
||||
// Новые интерфейсы для работы с деталями узлов
|
||||
export interface LaximoUnitInfo {
|
||||
unitid: string
|
||||
name: string
|
||||
code?: string
|
||||
description?: string
|
||||
imageurl?: string
|
||||
largeimageurl?: string
|
||||
attributes?: LaximoDetailAttribute[]
|
||||
}
|
||||
|
||||
export interface LaximoUnitDetail {
|
||||
detailid: string
|
||||
name: string
|
||||
oem?: string
|
||||
brand?: string
|
||||
codeonimage?: string
|
||||
code?: string
|
||||
note?: string
|
||||
filter?: string
|
||||
price?: string
|
||||
availability?: string
|
||||
description?: string
|
||||
applicablemodels?: string
|
||||
attributes?: LaximoDetailAttribute[]
|
||||
}
|
||||
|
||||
export interface LaximoUnitImageMap {
|
||||
unitid: string
|
||||
imageurl?: string
|
||||
largeimageurl?: string
|
||||
coordinates?: LaximoImageCoordinate[]
|
||||
}
|
||||
|
||||
export interface LaximoImageCoordinate {
|
||||
detailid: string
|
||||
codeonimage?: string
|
||||
x: number
|
||||
y: number
|
||||
width: number
|
||||
height: number
|
||||
shape: string
|
||||
}
|
72
src/types/partsapi.ts
Normal file
72
src/types/partsapi.ts
Normal file
@ -0,0 +1,72 @@
|
||||
export interface PartsAPICategory {
|
||||
id: string;
|
||||
name: string;
|
||||
level: number;
|
||||
parentId?: string;
|
||||
children?: PartsAPICategory[];
|
||||
}
|
||||
|
||||
export interface PartsAPIArticle {
|
||||
supBrand?: string;
|
||||
supId?: number;
|
||||
productGroup?: string;
|
||||
ptId?: number;
|
||||
artSupBrand?: string;
|
||||
artArticleNr?: string;
|
||||
artId?: string;
|
||||
}
|
||||
|
||||
export interface PartsAPIMedia {
|
||||
artMediaType: string; // Тип медиа: JPEG, PNG, WebP, PDF и т.д.
|
||||
artMediaSource: string; // Полный URL или относительный путь к файлу
|
||||
artMediaSupId: number; // Идентификатор поставщика запчасти
|
||||
artMediaKind?: string; // Вид медиа-материала (может отсутствовать)
|
||||
imageUrl?: string; // Полный URL изображения
|
||||
}
|
||||
|
||||
export type CarType = 'PC' | 'CV' | 'Motorcycle';
|
||||
|
||||
export interface PartsAPICategoriesData {
|
||||
partsAPICategories: PartsAPICategory[];
|
||||
}
|
||||
|
||||
export interface PartsAPICategoriesVariables {
|
||||
carId: number;
|
||||
carType: CarType;
|
||||
}
|
||||
|
||||
export interface PartsAPITopLevelCategoriesData {
|
||||
partsAPITopLevelCategories: PartsAPICategory[];
|
||||
}
|
||||
|
||||
export interface PartsAPITopLevelCategoriesVariables {
|
||||
carId: number;
|
||||
carType: CarType;
|
||||
}
|
||||
|
||||
export interface PartsAPIArticlesData {
|
||||
partsAPIArticles: PartsAPIArticle[];
|
||||
}
|
||||
|
||||
export interface PartsAPIArticlesVariables {
|
||||
strId: number;
|
||||
carId: number;
|
||||
carType: CarType;
|
||||
}
|
||||
|
||||
export interface PartsAPIMediaData {
|
||||
partsAPIMedia: PartsAPIMedia[];
|
||||
}
|
||||
|
||||
export interface PartsAPIMediaVariables {
|
||||
artId: string;
|
||||
lang?: number;
|
||||
}
|
||||
|
||||
export interface PartsAPIMainImageData {
|
||||
partsAPIMainImage: string | null;
|
||||
}
|
||||
|
||||
export interface PartsAPIMainImageVariables {
|
||||
artId: string;
|
||||
}
|
155
src/types/partsindex.ts
Normal file
155
src/types/partsindex.ts
Normal file
@ -0,0 +1,155 @@
|
||||
export interface PartsIndexCatalog {
|
||||
id: string;
|
||||
name: string;
|
||||
image: string | null;
|
||||
groups: PartsIndexGroup[];
|
||||
}
|
||||
|
||||
export interface PartsIndexEntityName {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface PartsIndexGroup {
|
||||
id: string;
|
||||
name: string;
|
||||
lang: string;
|
||||
image: string;
|
||||
lft: number;
|
||||
rgt: number;
|
||||
entityNames: PartsIndexEntityName[];
|
||||
subgroups: PartsIndexGroup[];
|
||||
}
|
||||
|
||||
export interface PartsIndexCatalogsResponse {
|
||||
list: PartsIndexCatalog[];
|
||||
}
|
||||
|
||||
export interface PartsIndexTabData {
|
||||
label: string;
|
||||
heading: string;
|
||||
links: string[];
|
||||
catalogId: string;
|
||||
group?: PartsIndexGroup;
|
||||
}
|
||||
|
||||
export interface PartsIndexCatalogsData {
|
||||
partsIndexCategoriesWithGroups: PartsIndexCatalog[];
|
||||
}
|
||||
|
||||
export interface PartsIndexCatalogsVariables {
|
||||
lang?: string;
|
||||
}
|
||||
|
||||
// Новые типы для товаров каталога
|
||||
export interface PartsIndexParameterValue {
|
||||
id: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface PartsIndexParameter {
|
||||
id: string;
|
||||
code: string;
|
||||
title: string;
|
||||
type: string;
|
||||
values: PartsIndexParameterValue[];
|
||||
}
|
||||
|
||||
export interface PartsIndexBrand {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface PartsIndexProductName {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface PartsIndexEntity {
|
||||
id: string;
|
||||
name: PartsIndexProductName;
|
||||
originalName: string;
|
||||
code: string;
|
||||
brand: PartsIndexBrand;
|
||||
parameters: PartsIndexParameter[];
|
||||
images: string[];
|
||||
}
|
||||
|
||||
export interface PartsIndexPaginationPage {
|
||||
prev: number | null;
|
||||
current: number;
|
||||
next: number | null;
|
||||
}
|
||||
|
||||
export interface PartsIndexPagination {
|
||||
limit: number;
|
||||
page: PartsIndexPaginationPage;
|
||||
}
|
||||
|
||||
export interface PartsIndexSubgroup {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface PartsIndexEntitiesResponse {
|
||||
pagination: PartsIndexPagination;
|
||||
list: PartsIndexEntity[];
|
||||
catalog: {
|
||||
id: string;
|
||||
name: string;
|
||||
image: string | null;
|
||||
};
|
||||
subgroup: PartsIndexSubgroup | null;
|
||||
}
|
||||
|
||||
export interface PartsIndexEntitiesData {
|
||||
partsIndexCatalogEntities: PartsIndexEntitiesResponse;
|
||||
}
|
||||
|
||||
export interface PartsIndexEntitiesVariables {
|
||||
catalogId: string;
|
||||
groupId: string;
|
||||
lang?: string;
|
||||
limit?: number;
|
||||
page?: number;
|
||||
q?: string;
|
||||
engineId?: string;
|
||||
generationId?: string;
|
||||
params?: string;
|
||||
}
|
||||
|
||||
// Типы для параметров фильтрации
|
||||
export interface PartsIndexParamValue {
|
||||
value: string;
|
||||
title: string;
|
||||
available: boolean;
|
||||
selected: boolean;
|
||||
}
|
||||
|
||||
export interface PartsIndexParam {
|
||||
id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
isGeneral: boolean;
|
||||
type: string;
|
||||
values: PartsIndexParamValue[];
|
||||
}
|
||||
|
||||
export interface PartsIndexParamsResponse {
|
||||
list: PartsIndexParam[];
|
||||
paramsQuery: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface PartsIndexParamsData {
|
||||
partsIndexCatalogParams: PartsIndexParamsResponse;
|
||||
}
|
||||
|
||||
export interface PartsIndexParamsVariables {
|
||||
catalogId: string;
|
||||
groupId: string;
|
||||
lang?: string;
|
||||
engineId?: string;
|
||||
generationId?: string;
|
||||
params?: string;
|
||||
q?: string;
|
||||
}
|
Reference in New Issue
Block a user