import { OnsiteCoreWindow } from "@mailbiz/onsite-core"; //#region [Window] interface NuvemshopWindow extends OnsiteCoreWindow { LS: LSContext | LSContextNavigation; next?: NextContext; } //#endregion //#region [Navigation - LS Context] interface LSContextNavigationCart { id: number; hash: string; subtotal: number; has_non_shippable_products: boolean; has_shippable_products: boolean; items: LSContextNavigationItem[]; } interface LSContextNavigationItem { id: number; item_id: number; variant_id: number; product_id: number; name: string; short_variant_name: string; unit_price: number; quantity: number; requires_shipping: boolean; sku: string; google_item_id: string; google_item_categories: { item_category?: string; item_category2?: string; }; gads_category: string; url: string; brand: string; } interface LSContextNavigation extends LSContextBase { cart: LSContextNavigationCart; currency: LSContextCurrency; } //#endregion //#region [LS Context - Base] interface LSContextBase { store: LSContextStore; langCode: string; lang: string; customer?: number; ready: any; product?: LSContextProduct; variants?: LSContextVariant[]; } //#endregion //#region [LS Context - Checkout] interface LSContext extends LSContextBase { cart: LSContextCart; currency: string; abExperiments: any; order?: LSContextOrder; } interface LSContextStore { id: number; url: string; } interface LSContextCart { id: number; subtotal: number; items: LSContextItem[]; shippingAddress: ShippingAddress; contact: LSContextContact; isAhora12Eligible: boolean; prices: SlimPrices; } interface LSContextItem { id: number; variant_id: number; name: string; unit_price: number; quantity: number; sku: string; is_ahora_12_eligible: boolean; } interface LSContextContact { accepts_marketing: boolean; accepts_marketing_updated_at: string; phone: string | null; email: string | null; } interface LSContextOrder { id: number; number: number; hash: string; created_at: string; coupon: any; discount: number; total: number; total_in_usd: number; gateway: string; } interface LSContextProduct { id: number; name: string; requires_shipping: boolean; tags: string[]; } interface LSContextVariant { product_id: number; price_short: string; price_long: string; price_number: number; compare_at_price_short: string | null; compare_at_price_long: string | null; compare_at_price_number: number | null; stock: number; sku: string; available: boolean; contact: boolean; option0: string | null; option1: string | null; option2: string | null; id: number; image: number; image_url: string; installments_data: string; } //#endregion //#region [Checkout - Next framework] interface NextContext { router: { components: { "/start": NextContextRoute; "/next": NextContextRoute; "/success": NextContextRoute; }; }; } interface NextContextRoute { props: NextContextProps; } interface NextContextProps { pageProps: { initialState: NextContextPropsInitialState; params: Partial<{ cartHash: string; cartId: string; from_store: string; }>; }; } interface NextContextPropsInitialState { customer: Partial; form: any; order: NextContextOrder; partners: any; payment: NextContextPayment; shipping: NextContextShipping; store: any; ui: any; } //#region [Checkout - Next framework - Customer] interface NextContextCustomer { contact: Partial; shippingAddress: ShippingAddress; billingAddress: BillingAddress; copyAddressCheckbox: any; otherPickerCheckbox: any; smartSignIn: { email: any; hasPassword: any; codeSentToEmail: boolean; showModalPassword: boolean; }; validateSmartSignIn: boolean; } interface NextContextCustomerContact { email: string; name: string; phone: string; accepts_marketing: boolean; accepts_marketing_updated_at: string; } //#endregion //#region [Checkout - Next framework - Order] interface NextContextOrder { countries?: any[]; order: { cart: NextContextCart; promotionalDiscount: PromotionalDiscount; defaultAddressId: any; addresses: any[]; contact: NextContextContact; shippingAddress: ShippingAddress; billingAddress: BillingAddress; customer: NextContextOrderCustomer | null; payment: NextContextOrderPayment; orderStatus: NextContextOrderStatus; storeId: number; conversionCode: string | null; conversionCodeGatewayRedirect: string | null; purchaseNotifications: { analytics: boolean; fb_pixel: boolean; }; checkout: string; theme: string; ab_experiments: any; loaded: boolean; }; orderNotifications: any; showOrderDetails: boolean; } interface NextContextOrderCustomer { id: number; first_name: string; last_name: string | null; email: string; id_number: string; phone: string; default_address_id: number; addresses: BillingAddress[]; has_password: boolean; accepts_marketing: boolean; accepts_marketing_updated_at: string; } interface NextContextCart { id: number; hash: string; number: any; prices: ExpandedPrices; lineItems: NextContextItem[]; currency: string; currencyFormat: { short: string; long: string; }; lang: string; langCode: string; coupon: Coupon | null; shipping: NextContextCartShipping; status: NextContextStatus; completedAt: any; minimumValue: any; hasNonShippableProducts: boolean; hasShippableProducts: boolean; hasToExecuteAssortedJs: boolean; isAhora12Eligible: boolean; } interface NextContextItem { id: number; name: string; price: string; quantity: number; free_shipping: boolean; product_id: number; variant_id: number; thumbnail: string; variant_values: string; sku: string; properties: any[]; url: string; is_ahora_12_eligible: boolean; brand: string; } interface NextContextCartShipping { type: string | null; method: string | null; option: string | null; branch: any | null; disabled: any | null; raw_name: string | null; suboption: any | null; } interface NextContextStatus { order: string; order_cancellation_reason: any; fulfillment: string; payment: string; } interface NextContextContact { email: string | null; name: string; phone: string | null; accepts_marketing: boolean; accepts_marketing_updated_at: string; } interface NextContextOrderPayment { option: any; category: any; boleto_url: any; went_to_gateway: boolean; brand: any; logo: any; external_id: any; external_resource_url: any; external_resource_code: any; external_resource_expires_at: any; external_resource_image: any; instructions: string; can_be_refunded: boolean; } interface NextContextOrderStatus { shipping_eta: any; shipping_tracking_code: any; pickup_location: { name: any; address: any; city: any; province: any; }; pickup_hours: any[] | null; payment_state: string; payment_state_reason: any; shipping_extra: any; history: Array<{ type: string; timestamp: any; }>; } //#endregion //#region [Checkout - Next framework - Payment] interface NextContextPayment { data: { form: any; }; selectedOption: Partial<{ id: string; appId: any; PaymentProviderId: string; methodName: string; gatewayLogoUrl: any; methodLogoUrl: any; type: string; methodType: string; bypassGateway: boolean; renderGatewayName: boolean; method: any; template: string; name: string; priority: number; discount: number; categories: Array; customLabel: any; additionalData: { supportedPaymentMethods: { pix: { payment_method_type: string; discount?: number; logos: Array; }; }; }; category: string; billing_address: boolean; }>; error: { method: string; msg: string; }; } //#endregion //#region [Checkout - Next framework - Shipping] interface NextContextShipping { options: Array<{ id: string; original_name?: string | null; name: string; code: any; reference: any; type: string; price: number; price_merchant: number; currency: string; min_delivery_date?: string; max_delivery_date?: string; phone_required: boolean; id_required: boolean; accepts_cod: boolean; availability?: boolean; address?: any; hours?: any; free_shipping_eligible: boolean; extra: { extra?: string; show_time: boolean; warning: { enable: boolean; message?: string; }; shipping_transaction_fee?: number; additional_fee_rate?: number; is_nuvem_shipping_contract?: boolean; additional_cost?: number; additional_services_costs?: { same_person_cost_value: number; ack_cost_value: number; declared_value_cost_value: number; without_additional_services_cost_value: number; }; }; method: string; app_id: any; hidden: boolean; priority: number; pickup_hours?: Array; shippable: boolean; shipping_internal_option_code?: string; show_time: boolean; smart_date: { translate_old_string: string; translate_string: string; total_old_time: string; total_exact_time: string; final_time: string; show_time: boolean; days: string; from_week_day: string; from_date: string; to_week_day: string; to_date: string; from?: number; to?: number; min_days?: number; max_days?: number; extra_days: any; }; }> | null; selectedOption: Partial<{ id: string; original_name: any; name: string; code: string; reference: any; type: string; price: number | string; price_merchant: number; currency: string; min_delivery_date: string; max_delivery_date: string; phone_required: boolean; id_required: boolean; accepts_cod: boolean; free_shipping_eligible: boolean; extra: { warning: { enable: boolean; message: string; }; show_time: boolean; shipping_transaction_fee: number; additional_fee_rate: number; is_nuvem_shipping_contract: boolean; additional_cost: number; additional_services_costs: { same_person_cost_value: number; ack_cost_value: number; declared_value_cost_value: number; without_additional_services_cost_value: number; }; }; method: string; app_id: any; hidden: boolean; priority: number; shippable: boolean; shipping_internal_option_code: string; show_time: boolean; smart_date: { translate_old_string: string; translate_string: string; total_old_time: string; total_exact_time: string; final_time: string; show_time: boolean; days: string; from_week_day: string; from_date: string; to_week_day: string; to_date: string; from: number; to: number; min_days: number; max_days: number; extra_days: any; }; shippingAcceptsCode: boolean; option: string; }> | null; loading: boolean; type: string | null; suboption: any; showAllShippingOptions: boolean; } //#endregion //#region [Generics] interface LSContextCurrency { code: string; display_short?: string; display_long?: string; cents_separator?: string; thousands_separator?: string; } interface ShippingAddress extends BaseAddress { first_name: string; last_name: string | null; state: string | null; between_streets: any | null; reference: any | null; } interface BillingAddress extends BaseAddress { id?: number | null; id_number?: string | null; first_name: string | null; last_name: string | null; state: string | null; created_at?: string | null; updated_at?: string | null; default?: boolean | null; } interface BaseAddress { zipcode: string | null; address: string | null; number: string | null; floor: string | null; locality: string | null; city: string | null; country: string | null; phone: string | null; } interface PromotionalDiscount { id: any; store_id: number; order_id: number; created_at: string; total_discount_amount: string; contents: any[]; promotions_applied: any[]; } interface Coupon { categories: string[] | null; code: string; end_date: any; id: number; max_uses: any; min_price: any; start_date: any; type: string; used: number; valid: boolean; value: string; } interface DiscountPrices { discount_gateway: number; discount_coupon: number; discount_promotion: number; } interface SlimPrices extends DiscountPrices { subtotal: number; total: number; } interface ExpandedPrices extends SlimPrices { shipping: number | string; discount_coupon_and_promotions: number; subtotal_with_promotions_applied: number; subtotal_with_promotions_and_coupon_applied: number; total_usd: number; } declare global { interface Window extends NuvemshopWindow { } }