UNPKG

@retaila/shared-types

Version:

Tipos compartidos para el proyecto Retail

1 lines 180 kB
{"version":3,"sources":["../src/common/Country.ts","../src/common/Media.ts","../src/common/Currency.ts","../src/common/Date.ts","../src/account/types.ts","../src/ai/types.ts","../src/accountBranch/types.ts","../src/accountDeliveryOption/types.ts","../src/accountDomain/types.ts","../src/accountEmailDomain/types.ts","../src/accountIntegration/types.ts","../src/accountPaymentMethod/types.ts","../src/accountPaymentMethod/helpers.ts","../src/accountPaymentMethod/resolveChargeCurrency.ts","../src/cart/types.ts","../src/cart/dto.ts","../src/customer/types.ts","../src/integration/types.ts","../src/integration/helpers.ts","../src/order/types.ts","../src/fulfillment/types.ts","../src/order/helpers.ts","../src/payment/types.ts","../src/payment/helpers.ts","../src/payment/supportedPaymentMethodsOrder.ts","../src/product/types.ts","../src/product/helpers.ts","../src/promotion/types.ts","../src/productAttribute/types.ts","../src/productCategory/types.ts","../src/sizeGuide/types.ts","../src/collection/types.ts","../src/campaign/types.ts","../src/standardCategory/types.ts","../src/storeBanner/types.ts","../src/storePage/types.ts","../src/pubsub/types.ts","../src/supportConversation/types.ts","../src/fulfillment/helpers.ts","../src/storeCustomization/types.ts","../src/storeCustomization/revisionTypes.ts","../src/storeCustomization/normalizeLayout.ts","../src/geoZone/types.ts","../src/integrationDeliveryZone/types.ts","../src/accountExchangeRate/types.ts","../src/storeTemplate/portable.ts","../src/analytics/types.ts","../src/notificationSettings.ts","../src/serviceBilling/types.ts","../src/serviceBilling/billingSchedule.ts","../src/holiday/types.ts","../src/lead/types.ts","../src/gestionUser/types.ts","../src/chatbot/tone.ts"],"sourcesContent":["// shared-types/src/common/Country.ts - Supported country codes and default config per country\n\nexport const SUPPORTED_COUNTRIES = ['UY', 'AR'] as const\nexport type SupportedCountryCode = (typeof SUPPORTED_COUNTRIES)[number]\n\nexport function isSupportedCountry(code: string): code is SupportedCountryCode {\n return SUPPORTED_COUNTRIES.includes(code as SupportedCountryCode)\n}\n\nexport interface CountryDefaultBranchAddress {\n country: string\n department: string\n locality: string\n street: string\n number: string\n mapPosition: { lat: number; lng: number }\n}\n\nexport interface CountryDefaultTax {\n name: string\n rate: number\n rateType: string\n}\n\nexport interface CountryDefaultConfig {\n /** Display name for the country (e.g. for select options). */\n name: string\n timezone: string\n currency: string\n phoneCountryCode: string\n locale: string\n defaultBranchAddress: CountryDefaultBranchAddress\n defaultTaxes: CountryDefaultTax[]\n}\n\n/** Default configurations for enabled countries. Only countries with defaults are listed. */\nexport const COUNTRY_DEFAULTS: Record<string, CountryDefaultConfig> = {\n UY: {\n name: 'Uruguay',\n timezone: 'America/Montevideo',\n currency: 'UYU',\n phoneCountryCode: '+598',\n locale: 'es-UY',\n defaultBranchAddress: {\n country: 'Uruguay',\n department: 'Montevideo',\n locality: 'Centro',\n street: 'Calle 123',\n number: '123',\n mapPosition: { lat: -34.9211269, lng: -56.161656 },\n },\n defaultTaxes: [{ name: 'IVA', rate: 22, rateType: 'PERCENTAGE' }],\n },\n AR: {\n name: 'Argentina',\n timezone: 'America/Argentina/Buenos_Aires',\n currency: 'ARS',\n phoneCountryCode: '+54',\n locale: 'es-AR',\n defaultBranchAddress: {\n country: 'Argentina',\n department: 'Buenos Aires',\n locality: 'CABA',\n street: 'Calle ejemplo',\n number: '123',\n mapPosition: { lat: -34.6037, lng: -58.3816 },\n },\n defaultTaxes: [{ name: 'IVA', rate: 21, rateType: 'PERCENTAGE' }],\n },\n}\n\nexport function getCountryDefaults(code: string): CountryDefaultConfig | null {\n if (!code || code.length !== 2) return null\n const key = code.toUpperCase()\n return COUNTRY_DEFAULTS[key] ?? null\n}\n","/**\n * Entidad Media\n * Se utiliza para almacenar y gestionar archivos y recursos multimedia.\n */\n\nexport interface Media {\n id: string;\n accountId: string;\n filename: string;\n url: string;\n thumbnailUrl: string;\n mimeType: string;\n extension: string;\n size: number;\n type: MediaType;\n altText: string;\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n}\n\nexport enum MediaType {\n IMAGE = 'IMAGE',\n VIDEO = 'VIDEO',\n FAVICON = 'FAVICON',\n DOCUMENT = 'DOCUMENT',\n AUDIO = 'AUDIO',\n ARCHIVE = 'ARCHIVE',\n OTHER = 'OTHER',\n}\n\n\n","export enum Currency {\n ARS = 'ARS', // Peso argentino\n BRL = 'BRL', // Real brasileño\n CLP = 'CLP', // Peso chileno\n COP = 'COP', // Peso colombiano\n EUR = 'EUR', // Euro\n MXN = 'MXN', // Peso mexicano\n PEN = 'PEN', // Sol peruano\n PYG = 'PYG', // Guaraní paraguayo\n USD = 'USD', // Dólar estadounidense\n UYU = 'UYU', // Peso uruguayo\n}\n\n\n\nexport function getCurrencySymbol(currencyCode: Currency): string {\n const currencySymbols: { [key: string]: string } = {\n [Currency.USD]: 'U$S',\n [Currency.EUR]: '€',\n [Currency.UYU]: '$',\n [Currency.ARS]: '$',\n [Currency.BRL]: 'R$',\n };\n \n return currencySymbols[currencyCode] || currencyCode.toString();\n} \n\n\n/**\n * Analiza un patrón de formato de precio y extrae la configuración necesaria\n * @param pattern - Patrón de ejemplo como '1,000.12', '1.000,12', '1000.12', '1000'\n * @returns Configuración de formato de precio para Intl.NumberFormat\n * \n * Patrones soportados:\n * - '1.000,12' → es-ES (punto para miles, coma para decimales)\n * - '1,000.12' → en-US (coma para miles, punto para decimales)\n * - '1000,12' → sin separador de miles, coma para decimales\n * - '1000.12' → sin separador de miles, punto para decimales\n * - '1.000' → punto para miles, sin decimales\n * - '1,000' → coma para miles, sin decimales\n * - '1000' → sin separadores, sin decimales\n */\nexport function parsePriceFormatPattern(pattern: string): {\n locale: string;\n useGrouping: boolean;\n minimumFractionDigits: number;\n maximumFractionDigits: number;\n} {\n // Detectar separador de miles y decimales\n const hasComma = pattern.includes(',');\n const hasPeriod = pattern.includes('.');\n \n let locale = 'es-UY'; // Por defecto\n let useGrouping = false;\n let minimumFractionDigits = 0;\n let maximumFractionDigits = 0;\n \n // Caso 1: Tiene coma y punto → determinar cuál es miles y cuál decimales\n if (hasComma && hasPeriod) {\n const commaIndex = pattern.indexOf(',');\n const periodIndex = pattern.indexOf('.');\n \n if (commaIndex < periodIndex) {\n // '1,000.12' → coma es miles, punto es decimales (formato en-US)\n locale = 'en-US';\n useGrouping = true;\n const decimalPart = pattern.split('.')[1];\n minimumFractionDigits = decimalPart ? decimalPart.length : 0;\n maximumFractionDigits = decimalPart ? decimalPart.length : 2;\n } else {\n // '1.000,12' → punto es miles, coma es decimales (formato es-ES)\n locale = 'es-ES';\n useGrouping = true;\n const decimalPart = pattern.split(',')[1];\n minimumFractionDigits = decimalPart ? decimalPart.length : 0;\n maximumFractionDigits = decimalPart ? decimalPart.length : 2;\n }\n }\n // Caso 2: Solo tiene coma\n else if (hasComma && !hasPeriod) {\n const parts = pattern.split(',');\n const integerPart = parts[0];\n const decimalPart = parts[1];\n \n // Si la parte después de la coma tiene más de 2 dígitos, es separador de miles\n // Ejemplo: '1,000' → miles\n // Ejemplo: '1000,12' → decimales\n if (decimalPart && decimalPart.length <= 2 && integerPart.length <= 4) {\n // Es separador decimal\n locale = 'es-ES';\n useGrouping = false;\n minimumFractionDigits = decimalPart.length;\n maximumFractionDigits = decimalPart.length;\n } else if (decimalPart && decimalPart.length === 3) {\n // Es separador de miles\n locale = 'en-US';\n useGrouping = true;\n minimumFractionDigits = 0;\n maximumFractionDigits = 0;\n } else if (!decimalPart) {\n // Solo una coma sin parte decimal, asumir formato internacional con miles\n locale = 'en-US';\n useGrouping = true;\n minimumFractionDigits = 0;\n maximumFractionDigits = 0;\n }\n }\n // Caso 3: Solo tiene punto\n else if (hasPeriod && !hasComma) {\n const parts = pattern.split('.');\n const integerPart = parts[0];\n const decimalPart = parts[1];\n \n // Si la parte después del punto tiene más de 2 dígitos, es separador de miles\n // Ejemplo: '1.000' → miles\n // Ejemplo: '1000.12' → decimales\n if (decimalPart && decimalPart.length <= 2 && integerPart.length <= 4) {\n // Es separador decimal\n locale = 'en-US';\n useGrouping = false;\n minimumFractionDigits = decimalPart.length;\n maximumFractionDigits = decimalPart.length;\n } else if (decimalPart && decimalPart.length === 3) {\n // Es separador de miles\n locale = 'es-ES';\n useGrouping = true;\n minimumFractionDigits = 0;\n maximumFractionDigits = 0;\n } else if (!decimalPart) {\n // Solo un punto sin parte decimal\n locale = 'es-ES';\n useGrouping = true;\n minimumFractionDigits = 0;\n maximumFractionDigits = 0;\n }\n }\n // Caso 4: Sin separadores\n else {\n // '1000' → sin separadores\n locale = 'es-UY';\n useGrouping = false;\n minimumFractionDigits = 0;\n maximumFractionDigits = 0;\n }\n \n return {\n locale,\n useGrouping,\n minimumFractionDigits,\n maximumFractionDigits\n };\n} \n\n\n","export enum DayOfWeek {\n MONDAY = 'MONDAY',\n TUESDAY = 'TUESDAY',\n WEDNESDAY = 'WEDNESDAY',\n THURSDAY = 'THURSDAY',\n FRIDAY = 'FRIDAY',\n SATURDAY = 'SATURDAY',\n SUNDAY = 'SUNDAY',\n}","// shared-types/src/account/types.ts - Account entity types\nimport { AccountDomain } from '../accountDomain'\nimport { Seller } from '../seller'\n\n/** Billing data for Retaila service invoices (tenant / legal entity). Stored as JSON on `account.billingProfile`. */\nexport interface AccountBillingProfile {\n legalName?: string | null\n /** Tax id (e.g. RUT in UY/PY). */\n taxId?: string | null\n address?: string | null\n billingContactEmail?: string | null\n /**\n * Whether VAT (IVA) is charged/invoiced on top of service amounts.\n * Service plan amounts in the system are always stored net (sin IVA); this flag is for documents and UI.\n */\n invoiceVat?: boolean | null\n /** VAT rate when `invoiceVat` is true (e.g. 22 for Uruguay). Percent 0–100. */\n vatPercent?: number | null\n}\n\nexport interface Account {\n id: string\n name: string\n slug: string\n logoId?: string\n currency: string\n email: string\n timezone: string\n status: AccountStatus\n country: string\n themeConfig?: ThemeConfig\n privateKey?: string\n demo: boolean\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date\n sellerId?: string\n seller?: Seller\n accountDomains?: AccountDomain[]\n billingProfile?: AccountBillingProfile | null\n /** Set when the backoffice onboarding wizard was finished successfully. */\n onboardingWizardCompletedAt?: Date | null\n /** Set when the merchant chose to skip the onboarding wizard. */\n onboardingWizardSkippedAt?: Date | null\n /** True until the wizard is completed or skipped (backoffice gate). */\n needsOnboardingWizard?: boolean\n}\n\nexport enum AccountStatus {\n ACTIVE = 'ACTIVE',\n INACTIVE = 'INACTIVE',\n PENDING = 'PENDING',\n SUSPENDED = 'SUSPENDED',\n}\n\nexport interface ThemeConfig {\n backgroundColor: string\n textColor: string\n primaryColor: string\n secondaryColor: string\n}\n","// shared-types/src/ai/types.ts - AI credits entity types\n\nexport enum AiCreditType {\n IMAGE = 'IMAGE',\n TEXT = 'TEXT',\n}\n\nexport enum AiCreditSource {\n FREE = 'FREE',\n PAID = 'PAID',\n}\n\nexport enum AiCreditTransactionReason {\n GENERATION = 'generation',\n MONTHLY_REFILL = 'monthly_refill',\n PURCHASE = 'purchase',\n MANUAL_ADJUSTMENT = 'manual_adjustment',\n}\n\nexport interface AccountAiCredits {\n accountId: string\n monthlyFreeImageCredits: number\n paidImageCredits: number\n monthlyFreeTextCredits: number\n paidTextCredits: number\n lastMonthlyRefill: Date | null\n updatedAt: Date\n}\n\nexport interface AccountAiCreditTransaction {\n id: string\n accountId: string\n type: AiCreditType\n amount: number\n source: AiCreditSource\n reason: AiCreditTransactionReason\n createdAt: Date\n}\n\nexport interface AiCreditsBalance {\n imageCredits: number\n textCredits: number\n}\n","import { AccountDeliveryOption } from \"../accountDeliveryOption/types\";\nimport { Address, MapPosition, Phone } from \"../common\";\n\n/**\n * Entidad AccountBranch\n * Representa una sucursal de una cuenta.\n */\n\nexport interface AccountBranch {\n id: string;\n accountId: string;\n name: string;\n address?: Address; \n addressInstructions?: string;\n isAddressPublic?: boolean;\n phone?: Phone | null;\n email?: string | null;\n demo:boolean;\n status: AccountBranchStatus; \n isOpen?: boolean;\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n\n schedule: AccountBranchSchedule[];\n deliveryOptions: AccountDeliveryOption[];\n}\n\nexport enum AccountBranchStatus {\n ACTIVE = \"ACTIVE\",\n INACTIVE = \"INACTIVE\"\n}\n\n \nexport interface AccountBranchSchedule {\n id: string;\n accountBranchId: string;\n day: AccountBranchScheduleDay;\n start: number;\n end: number;\n status: AccountBranchScheduleStatus;\n demo:boolean;\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n}\n\nexport enum AccountBranchScheduleStatus {\n ACTIVE = \"ACTIVE\",\n INACTIVE = \"INACTIVE\"\n}\n\nexport enum AccountBranchScheduleDay {\n MONDAY = \"MONDAY\",\n TUESDAY = \"TUESDAY\",\n WEDNESDAY = \"WEDNESDAY\",\n THURSDAY = \"THURSDAY\",\n FRIDAY = \"FRIDAY\",\n SATURDAY = \"SATURDAY\",\n SUNDAY = \"SUNDAY\"\n}","import { MapPosition } from '../common'\nimport { AccountIntegration } from '../accountIntegration/types'\nimport { AccountBranch } from '../accountBranch/types'\nimport { GeoZone } from '../geoZone'\n\n/**\n * Delivery types to distinguish between shipping and pickup options\n */\nexport enum DeliveryType {\n SHIPPING = 'SHIPPING',\n PICKUP = 'PICKUP',\n}\n\n/**\n * Entidad AccountDeliveryOption\n * Representa una opción de envío de una cuenta.\n */\n\nexport interface AccountDeliveryOption {\n id: string\n accountId: string\n accountBranchId: string\n name: string\n accountIntegrationId?: string\n isScheduled: boolean\n priceLogic: AccountDeliveryOptionPriceLogic\n status: AccountDeliveryOptionStatus\n deliveryType: DeliveryType\n demo: boolean\n hideAccountBranchAddress: boolean // Si true, no se muestra la direccion de la sucursal en el checkout.\n /** When true, estimated delivery times are calculated by AI and shown to customers at checkout */\n showEstimatedDeliveryTime: boolean\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n data?: Record<string, unknown>\n\n deliveryZones: AccountDeliveryOptionZone[]\n integration?: AccountIntegration | null\n price?: number | null\n accountBranch?: AccountBranch | null\n /** Computed by api-public when listing delivery options; ISO date strings */\n estimatedDelivery?: {\n start: string\n end: string\n }\n}\n\nexport enum AccountDeliveryOptionPriceLogic {\n FIXED = 'FIXED',\n BY_ZONE = 'BY_ZONE',\n PROVIDER = 'PROVIDER',\n /** @deprecated Use BY_ZONE instead */\n CALCULATED = 'CALCULATED',\n}\n\nexport enum AccountDeliveryOptionStatus {\n ACTIVE = 'ACTIVE',\n INACTIVE = 'INACTIVE',\n}\n\nexport interface AccountDeliveryOptionCalculatedCost {\n basePrice: number\n distanceKm: number\n finalPrice: number\n priceLogic: AccountDeliveryOptionPriceLogic\n currency: string\n}\n\nexport interface AccountDeliveryOptionZone {\n id: string\n accountId: string\n accountDeliveryOptionId: string\n geoZoneId: string\n price?: number | null\n status: AccountDeliveryOptionZoneStatus\n demo: boolean\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n\n // Relations\n geoZone?: GeoZone\n}\n\nexport enum AccountDeliveryOptionZoneStatus {\n ACTIVE = 'ACTIVE',\n INACTIVE = 'INACTIVE',\n}\n\n// DTO Types for API operations\nexport interface DeliveryZoneInput {\n geoZoneId?: string\n geoZone?: GeoZoneInput\n price?: number | null\n}\n\nexport interface GeoZoneInput {\n name: string\n area: MapPosition[]\n description?: string\n}\n\nexport interface CreateAccountDeliveryOptionDTO {\n accountId: string\n accountBranchId: string\n name: string\n accountIntegrationId?: string | null\n isScheduled?: boolean\n priceLogic?: AccountDeliveryOptionPriceLogic\n price?: number\n status?: AccountDeliveryOptionStatus\n deliveryType: DeliveryType\n deliveryZones?: DeliveryZoneInput[]\n data?: Record<string, unknown>\n showEstimatedDeliveryTime?: boolean\n}\n\nexport interface UpdateAccountDeliveryOptionDTO {\n accountBranchId: string\n name?: string\n accountIntegrationId?: string | null\n isScheduled?: boolean\n priceLogic?: AccountDeliveryOptionPriceLogic\n status?: AccountDeliveryOptionStatus\n deliveryType?: DeliveryType\n deliveryZones?: DeliveryZoneInput[]\n data?: Record<string, unknown>\n showEstimatedDeliveryTime?: boolean\n}\n\n/** Rule types for estimated delivery calculation */\nexport enum DeliveryOptionRuleType {\n PROCESSING_DAYS = 'PROCESSING_DAYS',\n SAME_DAY_CUTOFF = 'SAME_DAY_CUTOFF',\n DELIVERY_DAYS = 'DELIVERY_DAYS',\n PICKUP_READY_HOURS = 'PICKUP_READY_HOURS',\n FIXED_OFFSET_DAYS = 'FIXED_OFFSET_DAYS',\n /** ISO weekday numbers (1=Mon..7=Sun) that count as operating days */\n BUSINESS_DAYS = 'BUSINESS_DAYS',\n /** Delivery time-of-day window inferred by AI from historical orders */\n DELIVERY_HOURS = 'DELIVERY_HOURS',\n /** Extra days added to the pessimistic end when volume is high */\n BUFFER_SAFETY_MARGIN = 'BUFFER_SAFETY_MARGIN',\n}\n\nexport interface AccountDeliveryOptionRule {\n id: string\n accountId: string\n accountDeliveryOptionId: string\n ruleType: DeliveryOptionRuleType\n params?: Record<string, unknown>\n priority: number\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\nexport interface CreateDeliveryOptionRuleDTO {\n ruleType: DeliveryOptionRuleType\n params?: Record<string, unknown>\n priority?: number\n}\n\nexport interface UpdateDeliveryOptionRuleDTO {\n ruleType?: DeliveryOptionRuleType\n params?: Record<string, unknown>\n priority?: number\n}\n\n/** Params per rule type for estimation */\nexport interface ProcessingDaysParams {\n minDays: number\n maxDays?: number\n}\n\nexport interface SameDayCutoffParams {\n cutoffTime: string // \"HH:mm\"\n}\n\nexport interface DeliveryDaysParams {\n minDays: number\n maxDays: number\n}\n\nexport interface PickupReadyHoursParams {\n hours?: number\n minHours?: number\n maxHours?: number\n}\n\nexport interface FixedOffsetDaysParams {\n minDays: number\n maxDays?: number\n}\n\nexport interface BusinessDaysParams {\n /** ISO weekday numbers: 1=Monday … 7=Sunday */\n days: number[]\n}\n\nexport interface DeliveryHoursParams {\n /** Start of delivery window \"HH:mm\" */\n start: string\n /** End of delivery window \"HH:mm\" */\n end: string\n}\n\nexport interface BufferSafetyMarginParams {\n /** Extra days added to the pessimistic (end) delivery date */\n extraDays: number\n}\n\n/** Unified delivery config shape used by the backoffice form */\nexport interface UnifiedDeliveryConfig {\n businessDays: number[]\n cutoffEnabled: boolean\n cutoffTime: string\n processingMinDays: number\n processingMaxDays: number\n deliveryMinDays: number\n deliveryMaxDays: number\n pickupHours: number\n}\n","/**\n * Entidad AccountDomain\n * Representa un dominio personalizado asociado a una cuenta.\n * Permite dominios completos y subdominios, con control de estado y verificación.\n */\n\nexport interface AccountDomain {\n id: string;\n accountId: string;\n domain: string; /** Dominio completo (ej: example.com) */\n subdomain?: string;/** Subdominio opcional (ej: shop, blog) */\n isPrimary: boolean; /** Indica si este es el dominio principal de la cuenta */\n preferWww: boolean; /** Preferencia de dominio: true = www.example.com, false = example.com */\n status: AccountDomainStatus; /** Estado del dominio: PENDING, ACTIVE, INACTIVE */\n verifiedAt?: Date; /** Fecha de verificación del dominio */\n \n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n}\n\nexport enum AccountDomainStatus {\n PENDING = \"PENDING\",\n ACTIVE = \"ACTIVE\",\n INACTIVE = \"INACTIVE\"\n}\n\n ","// shared-types/src/accountEmailDomain/types.ts\n\nexport enum AccountEmailDomainStatus {\n PENDING = 'PENDING',\n DNS_PENDING = 'DNS_PENDING',\n ACTIVE = 'ACTIVE',\n INACTIVE = 'INACTIVE',\n}\n\nexport interface AccountEmailDomain {\n id: string;\n accountId: string;\n accountDomainId: string;\n domain: string;\n status: AccountEmailDomainStatus;\n activatedAt: Date | null;\n createdAt: Date;\n updatedAt: Date;\n deletedAt: Date | null;\n}\n","import { Integration } from \"../integration\";\n/**\n * Entidad AccountIntegration\n * Contiene información de la integración y sus credenciales.\n */\n\nexport enum AccountIntegrationStatus {\n\tACTIVE = 'ACTIVE',\n\tINACTIVE = 'INACTIVE',\n\tBETA = 'BETA',\n\tDEPRECATED = 'DEPRECATED',\n}\nexport enum AccountIntegrationConnectionStatus {\n\tCONNECTED = 'CONNECTED',\n\tDISCONNECTED = 'DISCONNECTED',\n\tERROR = 'ERROR',\n\tWARNING = 'WARNING',\n}\n\nexport enum AccountIntegrationEnvironment {\n\tPRODUCTION = 'PRODUCTION',\n\tDEVELOPMENT = 'DEVELOPMENT',\n}\n\nexport interface AccountIntegration {\n\tid: string;\n\taccountId: string;\n\tintegrationId: string;\n\tsettingsProduction: Object | null;\n\tsettingsDevelopment: Object | null;\n\tenvironment: AccountIntegrationEnvironment;\n\tproductionStatus: AccountIntegrationConnectionStatus;\n\tdevelopmentStatus: AccountIntegrationConnectionStatus;\n\tstatus: AccountIntegrationStatus;\n\tdemo: boolean;\n\tcreatedAt: Date;\n\tupdatedAt: Date;\n\tdeletedAt?: Date | null;\n\n\tintegration: Integration;\n\n\tsettings: Record<string, any>; // settings for requested environment\n}","// shared-types/src/accountPaymentMethod/types.ts\n\nimport { Account } from \"../account\";\nimport { AccountIntegration } from \"../accountIntegration\";\nimport { Currency } from \"../common/Currency\";\nimport { StatusInfo } from \"../common/Status\";\nimport { EffectiveExchangeRate } from \"../accountExchangeRate/types\";\n\nexport enum AccountPaymentMethodStatus {\n ACTIVE = 'ACTIVE', // Active\n INACTIVE = 'INACTIVE', // Disabled\n}\n\nexport interface AccountPaymentMethod {\n id: string;\n accountId: string;\n accountIntegrationId?: string;\n name: string;\n description?: string;\n customerInstructions?: string;\n order: number;\n availableForWeb?: boolean;\n \n status: AccountPaymentMethodStatus;\n demo: boolean;\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date;\n\n accountIntegration?: AccountIntegration;\n account?: Account;\n statusInfo?: StatusInfo;\n typeName?: string;\n /** Currency the gateway will charge in (API-resolved; do not infer from provider in UI). */\n chargeCurrency?: Currency;\n /** Present when account store currency differs from chargeCurrency and a rate exists. */\n exchangeRate?: EffectiveExchangeRate;\n}","import { StatusInfo } from \"../common/Status\";\nimport { AccountPaymentMethodStatus } from \"./types\";\n\nexport function getAccountPaymentMethodStatusInfo(status: AccountPaymentMethodStatus): StatusInfo {\n\tconst map: Record<AccountPaymentMethodStatus, StatusInfo> = {\n\t\tACTIVE: { text: 'Activo', class: 'success', actionText: '' },\n\t\tINACTIVE: { text: 'Inactivo', class: 'danger', actionText: '' },\n\t};\n\n\treturn map[status] ?? { text: String(status), class: 'secondary' };\n}","// shared-types/src/accountPaymentMethod/resolveChargeCurrency.ts\nimport { Currency } from '../common/Currency'\n\nfunction normalizedAccountCurrency(accountCurrency?: string | null): Currency | undefined {\n const t = accountCurrency?.trim()\n if (!t) return undefined\n return t as Currency\n}\n\n/**\n * Currency in which the payment gateway will settle the charge for checkout.\n * Centralizes provider-specific rules; consumers (e.g. storefront) should use\n * {@link AccountPaymentMethod.chargeCurrency} from the API instead of branching on providerKey.\n */\nexport function resolveChargeCurrency(params: {\n providerKey?: string | null\n settingsCurrency?: string | null\n /** Store / account currency; used when settings omit currency or for MANUAL_PAYMENT. */\n accountCurrency?: string | null\n}): Currency | undefined {\n const pk = params.providerKey?.toUpperCase()\n if (pk === 'PAYPAL') {\n return Currency.USD\n }\n const accountCur = normalizedAccountCurrency(params.accountCurrency)\n if (pk === 'MANUAL_PAYMENT') {\n return accountCur\n }\n const raw = params.settingsCurrency?.trim()\n if (!raw) {\n return accountCur\n }\n return raw as Currency\n}\n","import { CartItemValidation } from './dto'\nimport { Customer } from '../customer'\nimport { AccountDomain } from '../accountDomain'\nimport { CartDeliveryMethod } from '../cartDeliveryMethod'\nimport { CartLineItemAdjustment } from '../promotion'\n\n/**\n * Entidad Cart\n * Define el carrito de compras de un cliente en el sitio web.\n */\n\nexport interface Cart {\n id: string\n code: string\n customerId?: string\n sessionId?: string\n items: CartItem[]\n currency: string\n subtotal: number\n total: number\n deliveryType: CartDeliveryType\n deliveryFirstName?: string\n deliveryLastName?: string\n deliveryAddress?: string\n deliveryPhone?: string\n pickupBranchId?: string\n accountPaymentMethodId?: string\n itemCount: number\n createdAt: Date\n updatedAt: Date\n status: CartStatus\n source: CartSource\n sourceAccountDomainId?: string\n recoveryToken?: string\n customerNote?: string\n hasIssues: boolean // Indica si el carrito tiene problemas que resolver\n issuesCount: number // Número de items con problemas\n // Nuevos campos de precios\n subtotalPrice?: number\n totalDiscounts?: number\n totalShippingPrice?: number\n totalTax?: number\n totalPrice?: number\n taxDetails?: any\n /** BIN de la tarjeta (primeros 6–8 dígitos) cuando se escribe en el checkout; usado para promociones por BIN. */\n cardBin?: string | null\n\n customer?: Partial<Customer> | null\n accountDomain?: Partial<AccountDomain> | null\n deliveryMethod?: CartDeliveryMethod | null\n promotions: {\n code: string\n amount: number\n name?: string\n description?: string\n isAutomatic?: boolean\n }[]\n freeShippingProgress?: {\n threshold: number\n currentSubtotal: number\n remaining: number\n qualified: boolean\n } | null\n}\n\nexport interface CartItem {\n id: string\n productId: string\n productVariantId: string\n name: string\n unitPrice: number // Precio cuando se agregó al carrito\n quantity: number\n image?: string\n thumbnailUrl?: string // URL del thumbnail de la variante\n sku?: string\n attributeDetails: CartItemAttributeDetail[] // Detalles legibles de atributos\n\n validation?: CartItemValidation // Información de validación del item en dto\n adjustments?: CartLineItemAdjustment[]\n}\n\nexport interface CartItemAttributeDetail {\n name: string // Nombre del atributo (ej: \"Talle\", \"Color\")\n alias: string // Alias del atributo (ej: \"size\", \"color\")\n value: string // Valor del atributo (ej: \"M\", \"Rojo\")\n type?: string // Tipo del atributo (opcional)\n}\n\nexport enum CartStatus {\n ACTIVE = 'ACTIVE',\n LOCKED = 'LOCKED',\n EXPIRED = 'EXPIRED',\n CONVERTED = 'CONVERTED',\n ABANDONED = 'ABANDONED',\n MERGED = 'MERGED',\n}\n\nexport enum CartSource {\n WEB = 'WEB',\n POS = 'POS',\n API = 'API',\n}\n\nexport enum CartDeliveryType {\n SHIPPING = 'SHIPPING',\n PICKUP = 'PICKUP',\n}\n","import { OrderSource } from \"../order\";\n\n/**\n * Add an item to the cart\n*/\nexport interface CartItemAddDto {\n cartId: string;\n productId: string;\n variantId?: string;\n quantity: number;\n attributes?: { [key: string]: string | number; };\n userEmail?: string;\n userId?: string;\n}\n\n/**\n * Update an item in the cart\n */\nexport interface CartItemUpdateDto {\n cartId: string;\n itemId: string;\n quantity: number;\n}\n\n/**\n * Remove an item from the cart\n */\nexport interface CartItemRemoveDto {\n cartId: string;\n itemId: string;\n}\n\nexport interface CartUpdateDto {\n cartId: string;\n source: OrderSource;\n accountDomainId?: string;\n customer: {\n email: string;\n };\n delivery: {\n type: 'SHIPPING' | 'PICKUP';\n pickupBranchId?: string;\n firstname: string;\n lastname: string;\n phone: {\n countryCode: string;\n national: string;\n international: string;\n type: string;\n validated: boolean;\n };\n address: {\n country: string;\n department: string;\n locality: string;\n street: string;\n complement?: string;\n notes?: string;\n postalCode: string;\n mapPosition: {\n lat: number;\n lng: number;\n };\n };\n };\n billing: {\n name: string;\n address: string;\n city: string;\n department: string;\n };\n accountPaymentMethodId?: string;\n customerNote?: string | null;\n}\n\n/**\n * Confirm a cart\n */\nexport interface CartConfirmDto {\n cartId: string;\n}\n\n/**\n * Validation information for a cart item\n */\nexport interface CartItemValidation {\n hasIssues: boolean; // Indica si hay problemas con este item\n issues: string[]; // Lista de problemas encontrados (mensajes legibles)\n errorCode?: CartItemErrorCode; // Código específico del error principal\n currentPrice?: number; // Precio actual del producto (si cambió)\n availableStock?: number; // Stock disponible actual\n isProductActive?: boolean; // Si el producto está activo\n}\n\n/**\n * Error codes for cart items\n */\nexport enum CartItemErrorCode {\n PRICE_INCREASED = 'PRICE_INCREASED', // Precio aumentó\n PRICE_DECREASED = 'PRICE_DECREASED', // Precio disminuyó \n PRODUCT_INACTIVE = 'PRODUCT_INACTIVE', // Producto ya no está disponible\n STOCK_INSUFFICIENT = 'STOCK_INSUFFICIENT', // Stock insuficiente (hay algo disponible)\n STOCK_UNAVAILABLE = 'STOCK_UNAVAILABLE', // Sin stock (0 disponible)\n VALIDATION_ERROR = 'VALIDATION_ERROR' // Error general de validación\n}\n","/**\n * Entidad Customer\n * Cliente de la tienda\n*/\nimport { Phone } from \"../common/Phone\";\n\nexport interface Customer {\n id: string;\n accountId: string;\n firstName?: string;\n lastName?: string;\n email: string;\n phone?: Phone;\n newsletter: boolean;\n status: CustomerStatus;\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n}\n\nexport enum CustomerStatus {\n ACTIVE = 'ACTIVE',\n INACTIVE = 'INACTIVE',\n BLACKLISTED = 'BLACKLISTED', // e.g., for fraudulent activity\n PENDING = 'PENDING', // e.g., email verification needed\n}","import { AccountIntegration } from \"../accountIntegration\";\n/**\n * Entidad Integration\n * Define las integraciones de terceros disponibles en la plataforma (ej. pasarelas de pago, transportistas).\n * Almacena información sobre el proveedor, categoría y esquema de parámetros requeridos.\n */\n\nexport enum IntegrationCategory {\n\tPAYMENT_GATEWAY = 'PAYMENT_GATEWAY',\n\tSHIPPING_CARRIER = 'SHIPPING_CARRIER',\n\tMARKETPLACE = 'MARKETPLACE',\n\tEMAIL_MARKETING = 'EMAIL_MARKETING',\n\tANALYTICS = 'ANALYTICS',\n\tACCOUNTING = 'ACCOUNTING',\n\tSOCIAL_MEDIA = 'SOCIAL_MEDIA',\n\tOTHER = 'OTHER',\n}\n\nexport enum IntegrationStatus {\n\tACTIVE = 'ACTIVE',\n\tINACTIVE = 'INACTIVE',\n\tBETA = 'BETA',\n\tDEPRECATED = 'DEPRECATED',\n}\n\nexport interface Integration {\n\tid: string;\n\tcategory: IntegrationCategory;\n\tproviderKey: string; // Unique identifier key (e.g., 'stripe', 'mercadopago-marketplace')\n\tname: string; // Human-readable name (e.g., \"Stripe\", \"Mercado Pago Marketplace\")\n\tslug: string;\n\tdescription?: string;\n\tsetupInstructions?: string; // General instructions or link to docs\n\tlogoUrl?: string; // URL to the integration's logo\n\trequiredParamsSchema?: any; // Define required parameters/credentials structure\n\tsupportedPaymentMethods?: string[]; // List of supported payment methods (e.g., 'visa', 'mastercard', 'american_express', 'bank_transfer', 'cash')\n\tpaymentCanRecapture?: boolean; // Can the payment be recaptured by the provider?\n\tpaymentCanRefund?: boolean; // Can the payment be refunded by the provider?\n\tstatus: IntegrationStatus;\n\tcreatedAt: Date;\n\tupdatedAt: Date;\n\tdeletedAt?: Date | null;\n\torder: number;\n\t/** ISO country codes where this integration is available. Null or empty = all countries. */\n\tcountries?: string[] | null;\n\n\taccountIntegration: AccountIntegration | null;\n}","\nimport { IntegrationCategory } from \"./types\";\n\nexport function getIntegrationCategoryName(category: IntegrationCategory): string {\n\tconst map: Record<IntegrationCategory, string> = {\n\t\tPAYMENT_GATEWAY: 'Pasarelas de pago',\n\t\tSHIPPING_CARRIER: 'Envíos',\n\t\tMARKETPLACE: 'Marketplaces',\n\t\tEMAIL_MARKETING: 'Email marketing',\n\t\tANALYTICS: 'Medición y análisis',\n\t\tACCOUNTING: 'Contabilidad',\n\t\tSOCIAL_MEDIA: 'Redes sociales',\n\t\tOTHER: 'Otros',\n\t};\n\n\treturn map[category] ?? 'Otro';\n}","import { Currency, Media } from '../common'\nimport { Customer } from '../customer'\nimport { AccountIntegration } from '../accountIntegration'\nimport { AccountDomain } from '../accountDomain'\nimport { Product } from '../product'\nimport { FulfillmentStatus } from '../fulfillment/types'\nimport { StatusInfo } from '../common/Status'\nimport { Payment, PaymentStatus } from '../payment'\nimport { OrderDeliveryMethod } from '../orderDeliveryMethod'\nimport { Account } from '../account'\nimport { AccountPaymentMethod } from '../accountPaymentMethod'\n\n/**\n * Entidad Order\n * Define la orden de compra de un cliente en el sitio web.\n */\n\nexport interface Order {\n id: string\n accountId: string\n customerId: string\n cartId?: string\n code: string\n deliveryType: OrderDeliveryType\n deliveryFirstName?: string\n deliveryLastName?: string\n deliveryAddress?: any\n deliveryPhone?: any\n pickupBranchId?: string\n accountPaymentMethodId?: string\n paymentMethodIntegrationId?: string\n billingInformation?: any\n currency: Currency\n currencySymbol?: string\n subtotalPrice: number\n totalDiscounts: number\n totalShippingPrice: number\n totalTax: number\n taxDetails?: any\n totalPrice: number\n totalRefunded: number\n status: OrderStatus\n statusInfo?: StatusInfo\n paymentStatus: OrderPaymentStatus\n paymentStatusInfo?: StatusInfo\n fulfillmentStatus: FulfillmentStatus\n statusHistory?: StatusChangeHistory[]\n customerNote?: string\n internalNote?: string\n source: OrderSource\n sourceAccountDomainId?: string\n demo: boolean\n createdAt: Date\n updatedAt: Date\n cancelledAt?: Date\n cancelReason?: string\n deletedAt?: Date\n /** Estimated delivery window start (from delivery option rules) */\n estimatedDeliveryStart?: Date\n /** Estimated delivery window end (from delivery option rules) */\n estimatedDeliveryEnd?: Date\n items?: OrderItem[]\n /** Applied promotions snapshot at order creation (checkout promos with name/code/amount). */\n promotions?: OrderAppliedPromotion[]\n\n customer?: Customer | null\n paymentMethodIntegration?: AccountIntegration | null\n accountDomain?: AccountDomain\n deliveryMethod?: OrderDeliveryMethod | null\n account?: Account\n accountPaymentMethod?: Partial<AccountPaymentMethod> | null\n payments?: Payment[]\n\n statusFlow?: StatusFlow[]\n // Estados permitidos para cambiar el estado de la orden\n statusChangeAllowed?: OrderStatus[]\n hasShipment?: boolean\n}\n\nexport interface OrderItem {\n id: string\n accountId: string\n orderId: string\n productId: string\n productVariantId: string\n sku?: string\n productName: string\n variantName?: string\n currency: Currency\n currencySymbol?: string\n unitPrice: number\n totalDiscount: number\n totalPrice: number\n quantity: number\n quantityFulfilled: number\n quantityRefunded: number\n quantityReturned: number\n totalTax: number\n taxName?: string\n createdAt: Date\n updatedAt: Date\n\n // Snapshot del producto en el momento de la compra\n productSnapshot?: OrderItemSnapshot\n\n product?: Product\n}\n\nexport enum OrderStatus {\n PENDING = 'PENDING', // Order placed, awaiting payment confirmation\n CONFIRMED = 'CONFIRMED', // Payment received, order confirmed\n PROCESSING = 'PROCESSING', // Order being prepared\n PROCESSED = 'PROCESSED', // Order ready to be shipped\n ON_HOLD = 'ON_HOLD', // Order temporarily paused\n COMPLETED = 'COMPLETED', // Order finished (e.g., after return period)\n CANCELLED = 'CANCELLED', // Order cancelled before fulfillment\n FAILED = 'FAILED', // Order failed (e.g., payment failed irrecoverably)\n}\n\nexport enum OrderPaymentStatus {\n PENDING = 'PENDING',\n PARTIAL = 'PARTIAL',\n PAID = 'PAID',\n OVERPAID = 'OVERPAID',\n REFUNDED = 'REFUNDED',\n PARTIALLY_REFUNDED = 'PARTIALLY_REFUNDED',\n}\n\nexport enum OrderSource {\n WEB = 'WEB',\n POS = 'POS',\n API = 'API',\n}\n\nexport enum OrderDeliveryType {\n SHIPPING = 'SHIPPING',\n PICKUP = 'PICKUP',\n}\n\n/**\n * Pseudo-estado amigable para la vista/filtro de órdenes en backoffice.\n * Cada valor se deriva de combinaciones de status, paymentStatus, fulfillmentStatus y deliveryType.\n */\nexport enum DisplayOrderStatus {\n PENDIENTES_DE_PAGO = 'PENDIENTES_DE_PAGO',\n EN_PROCESO = 'EN_PROCESO',\n LISTAS_PARA_ENVIAR = 'LISTAS_PARA_ENVIAR',\n LISTAS_PARA_RETIRAR = 'LISTAS_PARA_RETIRAR',\n ENVIADAS = 'ENVIADAS',\n ENTREGADAS = 'ENTREGADAS',\n EN_ESPERA = 'EN_ESPERA',\n CON_PROBLEMAS = 'CON_PROBLEMAS',\n CANCELADAS = 'CANCELADAS',\n REEMBOLSADAS = 'REEMBOLSADAS',\n}\n\nexport interface StatusChangeHistory {\n type: 'order' | 'fulfillment' | 'payment'\n status: OrderStatus | FulfillmentStatus | PaymentStatus\n timestamp: Date\n reason?: string\n userId?: string\n metadata?: Record<string, any>\n}\n\nexport interface OrderItemSnapshot {\n sku?: string\n productName: string\n variantName?: string\n media?: Media[]\n}\n\n/** Promotion applied to an order (snapshot at checkout time). */\nexport interface OrderAppliedPromotion {\n code: string\n amount: number\n name?: string\n description?: string\n isAutomatic?: boolean\n}\n\ntype StatusByType = {\n order: OrderStatus\n fulfillment: FulfillmentStatus\n payment: PaymentStatus\n}\n\nexport type StatusFlow<T extends keyof StatusByType = keyof StatusByType> = {\n type: T\n status: StatusByType[T]\n text?: string\n doneAt: Date | null\n}\n\nexport type NextStatusAction<T extends keyof StatusByType = keyof StatusByType> = {\n type: T\n status: StatusByType[T]\n text: string\n fulfillmentId?: string // for fulfillment status updates\n}\n","import { Webhook } from '../common/Webhook'\nimport { Address } from '../common/Address'\nimport { FulfillmentItem } from '../fulfillmentItem'\nimport { FulfillmentLabel } from '../fulfillmentLabel'\nimport { Order } from '../order'\nimport { WebhookPayload } from '../payment'\n\nexport enum FulfillmentStatus {\n PENDING = 'pending',\n SHIPPED = 'shipped',\n DELIVERED = 'delivered',\n CANCELLED = 'cancelled',\n}\n\nexport type FulfillmentTrackingEvent = {\n providerStatus: string\n providerStatusLabel?: string\n retailaStatus: FulfillmentStatus\n at: string\n raw?: Record<string, unknown>\n}\n\nexport type Fulfillment = {\n id: string\n code: string\n accountId: string\n orderId: string\n accountBranchId: string\n deliveryOptionId: string\n items: FulfillmentItem[]\n labels: FulfillmentLabel[]\n status: FulfillmentStatus\n data: Record<string, unknown> | null\n trackingEvents?: FulfillmentTrackingEvent[]\n shippedAt: Date | null\n deliveredAt: Date | null\n cancelledAt: Date | null\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date\n}\n\n// Fulfillment Provider types\nexport type FulfillmentDeliveryOption = {\n // useful to store the fulfillment option id, to later interact with that service level\n id: string\n // Name to show to the admin when creating the delivery option (could also be used in the storefront)\n name: string\n // Delivery type (SHIPPING or PICKUP) to filter options based on user selection\n deliveryType?: 'SHIPPING' | 'PICKUP'\n // Pickup locations for PICKUP delivery type options\n pickupLocations?: PickupLocation[]\n [key: string]: unknown\n}\n\n// Pickup Location: same address structure as orders and branches (Address) for consistency and no format conversion.\nexport interface PickupLocation {\n id: string\n name: string\n address: Address\n hours?: string\n phone?: string\n additionalInfo?: Record<string, unknown>\n}\n\n// Recollection specific types\nexport type FulfillmentRecollectionMode = 'RECOLLECTION' | 'DROP_OFF'\n\n// Simplified scheduling - just define when recollections are possible\nexport type FulfillmentRecollectionSchedule = {\n dayOfWeek: number // 0-6 (Sun-Sat)\n startHour: number // 9 (for 9:00 AM)\n endHour: number // 17 (for 5:00 PM)\n intervalMinutes?: number // Optional: 30, 60, etc. Default could be 60\n}\n\nexport type FulfillmentRecollectionCapabilities = {\n supportsRecollection: boolean\n supportsDropOff: boolean\n allowsScheduling: boolean\n recollectionSchedule?: FulfillmentRecollectionSchedule[]\n leadTimeHours: number // Minimum hours before recollection\n maxAdvanceDays: number // Maximum days in advance to schedule\n dropOffLocationsUrl?: string // Link to provider's page showing drop-off locations\n}\n\n// Recollection configuration for a specific fulfillment request.\n// recollectionAddress uses the same structure as order and branch addresses (Address) so no format conversion or geocoding is needed.\nexport type FulfillmentRecollectionConfig = {\n mode: FulfillmentRecollectionMode\n scheduledDateTime?: Date // Required when allowsScheduling=true and mode includes recollection\n recollectionAddress?: Address\n contactInfo?: {\n name: string\n phone: string\n email?: string\n }\n specialInstructions?: string\n}\n\n// Input for creating a fulfillment with third-party provider\nexport type FulfillmentProviderCreateInput = {\n data: Record<string, unknown> // Order delivery method data\n items: FulfillmentItem[]\n order: Order\n fulfillment: Fulfillment\n recollectionConfig?: FulfillmentRecollectionConfig\n /** ISO 3166-1 alpha-2 country code (e.g. 'UY', 'AR') for provider defaults (e.g. phone fallback). */\n accountCountryCode?: string\n}\n\n// Output from creating a fulfillment with third-party provider\nexport type FulfillmentProviderCreateOutput = {\n // Provider-specific data to store in fulfillment entity\n data?: Record<string, unknown>\n // Array of shipping labels/tracking information\n labels: {\n trackingNumber: string\n trackingUrl?: string\n label?: {\n url?: string\n base64?: string\n format?: 'pdf' | 'png' | 'zpl' // Label format\n }\n }[]\n}\n\nexport type FulfillmentProviderProcessWebhookInput = WebhookPayload & {\n // TODO: Put the actual service type once we move it from /api to here\n fulfillmentService: any\n}\n\nexport type FulfillmentProviderProcessWebhookOutput = {\n fulfillmentId: string\n fulfillmentStatus: FulfillmentStatus\n data: Record<string, any>\n trackingEvent?: FulfillmentTrackingEvent\n}\n\n// Provider-level types (entity-agnostic, reusable across projects)\nexport type FulfillmentProviderKey = 'MANUAL_FULFILLMENT' | 'DAC' | 'PEDIDOSYA'\n\n// Provider context for initialization\nexport type FulfillmentProviderContext = {\n data: Record<string, any>\n}\n\n// Base adapter interface that all fulfillment providers must implement\nexport interface FulfillmentProviderAdapter {\n readonly key: FulfillmentProviderKey\n listDeliveryOptions(): Promise<FulfillmentDeliveryOption[]>\n // Useful to execute when trying to calculate a delivery option price in the checkout,\n // to validate it can be calculated\n canCalculate(data: Record<string, unknown>): Promise<boolean>\n calculatePrice(data: Record<string, unknown>): Promise<number>\n getRecollectionCapabilities(): Promise<FulfillmentRecollectionCapabilities>\n // Create fulfillment with third-party provider\n createFulfillment(input: FulfillmentProviderCreateInput): Promise<FulfillmentProviderCreateOutput>\n processWebhook(\n input: FulfillmentProviderProcessWebhookInput\n ): Promise<FulfillmentProviderProcessWebhookOutput | null>\n /** Optional: cancel the fulfillment with the provider (e.g. cancel shipping label). */\n cancelFulfillment?(fulfillment: Fulfillment): Promise<void>\n}\n","import { StatusInfo } from '../common/Status'\nimport {\n OrderStatus,\n OrderPaymentStatus,\n OrderDeliveryType,\n DisplayOrderStatus,\n type Order,\n} from './types'\nimport { FulfillmentStatus } from '../fulfillment/types'\n\nexport function getOrderStatusInfo(status: OrderStatus): StatusInfo {\n const map: Record<OrderStatus, StatusInfo> = {\n PENDING: { text: 'Pendiente', class: 'secondary', actionText: '' },\n CONFIRMED: { text: 'Confirmada', class: 'info', actionText: 'Confirmar orden' },\n PROCESSING: { text: 'En proceso', class: 'warning', actionText: 'Procesar orden' },\n PROCESSED: { text: 'Procesada', class: 'primary', actionText: 'Orden procesada' },\n ON_HOLD: { text: 'En espera', class: 'secondary', actionText: 'Orden en espera' },\n COMPLETED: { text: 'Completada', class: 'success', actionText: 'Completar orden' },\n CANCELLED: { text: 'Cancelada', class: 'danger', actionText: 'Cancelar orden' },\n FAILED: { text: 'Fallida', class: 'danger', actionText: '' },\n }\n\n return map[status] ?? { text: String(status), class: 'secondary' }\n}\n\nexport function getOrderPaymentStatusInfo(status: OrderPaymentStatus): StatusInfo {\n const map: Record<OrderPaymentStatus, StatusInfo> = {\n PENDING: { text: 'Pago pendiente', class: 'warning', actionText: '' },\n PARTIAL: { text: 'Pago parcial', class: 'info', actionText: '' },\n PAID: { text: 'Pago completo', class: 'success', actionText: '' },\n OVERPAID: { text: 'Pago excedido', class: 'info', actionText: '' },\n REFUNDED: { text: 'Reembolsado', class: 'success', actionText: '' },\n PARTIALLY_REFUNDED: { text: 'Parcialmente reembolsado', class: 'warning', actionText: '' },\n }\n\n return map[status] ?? { text: String(status), class: 'secondary' }\n}\n\nconst DISPLAY_ORDER_STATUS_INFO: Record<DisplayOrderStatus, StatusInfo> = {\n [DisplayOrderStatus.PENDIENTES_DE_PAGO]: { text: 'Pendientes de pago', class: 'warning', actionText: '' },\n [DisplayOrderStatus.EN_PROCESO]: { text: 'En proceso', class: 'info', actionText: '' },\n [DisplayOrderStatus.LISTAS_PARA_ENVIAR]: { text: 'Listas para enviar', class: 'primary', actionText: '' },\n [DisplayOrderStatus.LISTAS_PARA_RETIRAR]: { text: 'Listas para retirar', class: 'primary', actionText: '' },\n [DisplayOrderStatus.ENVIADAS]: { text: 'Enviadas', class: 'warning', actionText: '' },\n [DisplayOrderStatus.ENTREGADAS]: { text: 'Entregadas', class: 'success', actionText: '' },\n [DisplayOrderStatus.EN_ESPERA]: { text: 'En espera', class: 'secondary', actionText: '' },\n [DisplayOrderStatus.CON_PROBLEMAS]: { text: 'Con problemas', class: 'danger', acti