import type { JSX } from 'react'; import { Address } from './address'; import { Basket } from './basket'; import { RetailStore } from './misc'; import { PaymentOption } from './order'; import { Product } from './product'; import { RootState, TypedDispatch } from 'redux/store'; export enum CheckoutStep { Shipping = 'shipping', Payment = 'payment', Confirmation = 'confirmation' } export interface CreditCardType { logo: string; name: string; slug: string; } export interface DeliveryOption { delivery_option_type: string; name: string; pk: number; slug: string; sort_order: number; } export interface ShippingOption { description: string; kwargs: any; logo: null; name: string; pk: number; shipping_amount: string; slug: string; } export interface DataSource { pk: number; name: string; data_source_shipping_options: DataSourceShippingOption[]; } export interface DataSourceShippingOption { pk: number; shipping_amount: string; shipping_option_name: string; shipping_option_logo: string | null; data_source: { pk: number; title: string | null; }; } export interface CheckoutAddressType { label: string; text: string; value: number; requestParam: string; } export interface CheckoutPaymentOption { pk?: number; slug?: string; payment_type?: string; view?: (...args) => JSX.Element; viewProps?: any; } export interface LoyaltyBalanceItem { label_id: number | null; label: string | null; balance: string; currency?: string; } export interface AccountUsage { label_id: number | null; amount: number; } export interface GiftBox { note: string; gift_video: boolean; gift_video_notification_sent: boolean; price: string; } export interface PreOrder { basket?: Basket; payment_option?: PaymentOption; payment_choice?: PaymentChoice; delivery_option?: DeliveryOption; shipping_address?: Address; billing_address?: Address; billing_and_shipping_same?: boolean; shipping_option?: ShippingOption; shipping_amount?: string; total_amount?: string; total_amount_with_interest?: string; unpaid_amount?: string; notes?: string; user_phone_number?: string; loyalty_money?: string; loyalty_account_usages?: AccountUsage[]; currency_type_label?: string; is_guest?: boolean; is_post_order?: boolean; is_redirected?: boolean; installment: InstallmentOption; retail_store?: RetailStore; gift_box?: GiftBox; credit_payment_option?: CheckoutCreditPaymentOption; data_source_shipping_options: any; attribute_based_shipping_options: any; bags?: Product[]; bags_fee?: string; extra_field?: ExtraField; wallet_method?: string; context_extras?: ExtraField; token?: string; agreement_confirmed?: boolean; phone_number?: string; number?: string; } export type ExtraField = Record; export interface GuestLoginFormParams { user_email: string; phone_number: string; sms_allowed: boolean; kvkk_confirm: boolean; } export interface PaymentChoice { label: string; price: string; value: string; } export interface CheckoutCreditPaymentOption { name: string; pk: number; slug: string; } export interface CheckoutContext { page_name: string; page_slug: string; page_context: { has_gift_box?: boolean; can_guest_purchase?: boolean; delivery_options?: DeliveryOption[]; addresses?: Address[]; shipping_options?: ShippingOption[]; payment_options?: PaymentOption[]; credit_payment_options?: CheckoutCreditPaymentOption[]; payment_choices?: PaymentChoice[]; card_type: CreditCardType; installments?: InstallmentOption[]; bank_accounts?: BankAccount[]; retail_stores?: RetailStore[]; redirect_url?: string; context_data?: any; balance?: string; balances?: LoyaltyBalanceItem[]; accounts?: LoyaltyBalanceItem[]; attribute_based_shipping_options?: AttributeBasedShippingOption[]; paymentData?: any; paymentMethod?: string; [key: string]: any; }; } export interface InstallmentOption { installment_count: number; label: string; monthly_price_with_accrued_interest: string; pk: number; price_with_accrued_interest: string; } export interface BankAccount { bank: { logo: string; name: string; pk: number; slug: string; }; description: string; holder_name: string; iban: string; pk: number; sort_order: number; } export interface AttributeBasedShippingOption { pk: number; shipping_amount: string | null; shipping_option_name: string | null; shipping_option_logo: string | null; attribute_value: string | null; attribute_key: string; [key: string]: any; } export interface CheckoutResult { payload: { errors?: Record; pre_order?: PreOrder; context_list?: CheckoutContext[]; }; } export interface MiddlewareParams { getState: () => RootState; dispatch: TypedDispatch; } export interface MiddlewareAction { type: string; payload?: { status?: number; [key: string]: unknown }; meta?: { arg?: { endpointName?: string }; baseQueryMeta?: { request?: { url?: string } }; }; } export type SendSmsType = { phone_number: string; }; export type VerifySmsType = { verify_code: string; };