@retaila/shared-types 1.1.75 → 1.1.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/common/Media.ts","../src/common/Currency.ts","../src/common/Date.ts","../src/account/types.ts","../src/accountBranch/types.ts","../src/accountDeliveryOption/types.ts","../src/accountDomain/types.ts","../src/accountIntegration/types.ts","../src/accountPaymentMethod/types.ts","../src/accountPaymentMethod/helpers.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/order/helpers.ts","../src/payment/types.ts","../src/payment/helpers.ts","../src/product/types.ts","../src/product/helpers.ts","../src/promotion/types.ts","../src/productAttribute/types.ts","../src/productCategory/types.ts","../src/standardCategory/types.ts","../src/storeBanner/types.ts","../src/storePage/types.ts","../src/pubsub/types.ts","../src/supportConversation/types.ts","../src/fulfillment/types.ts","../src/fulfillment/helpers.ts","../src/geoZone/types.ts","../src/integrationDeliveryZone/types.ts"],"sourcesContent":["// shared-types/src/index.ts - Main exports for shared types package\n\n// Common types\nexport * from './common';\n\n// Entity-specific exports\nexport * from './account';\nexport * from './accountBranch';\nexport * from './accountDeliveryOption';\nexport * from './accountDomain';\nexport * from './accountIntegration';\nexport * from './accountPaymentMethod';\nexport * from './cart';\nexport * from './cartDeliveryMethod';\nexport * from './customer';\nexport * from './integration';\nexport * from './order';\nexport * from './orderDeliveryMethod';\nexport * from './payment'\nexport * from './product';\nexport * from './promotion';\nexport * from './productAttribute';\nexport * from './productCategory';\nexport * from './standardCategory';\nexport * from './storeBanner';\nexport * from './storePage';\nexport * from './pubsub';\nexport * from './supportConversation';\nexport * from './fulfillment';\nexport * from './fulfillmentItem';\nexport * from './fulfillmentLabel';\nexport * from './storeCustomization';\nexport * from './geoZone';\nexport * from './integrationDeliveryZone';\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\";\n\nexport interface Account {\n id: string;\n name: string;\n slug: string;\n address?: string;\n logoId?: string;\n currency: string;\n priceFormatPattern: string;\n instagram?: string;\n facebook?: string;\n whatsapp?: string;\n phone?: string;\n email: string;\n timezone: string;\n hasDelivery: boolean;\n status: AccountStatus;\n themeConfig?: ThemeConfig;\n privateKey?: string;\n demo: boolean;\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date;\n\n priceFormat?: Intl.NumberFormatOptions;\n\n accountDomains?: AccountDomain[];\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 ","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 phone?: Phone | null;\n email?: string | null;\n demo:boolean;\n status: AccountBranchStatus; \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\tSHIPPING = \"SHIPPING\",\n\tPICKUP = \"PICKUP\",\n}\n\n/**\n * Entidad AccountDeliveryOption\n * Representa una opción de envío de una cuenta.\n */\n\nexport interface AccountDeliveryOption {\n\tid: string;\n\taccountId: string;\n\taccountBranchId: string;\n\tname: string;\n\taccountIntegrationId?: string;\n\tisScheduled: boolean;\n\tpriceLogic: AccountDeliveryOptionPriceLogic;\n\tstatus: AccountDeliveryOptionStatus;\n\tdeliveryType: DeliveryType;\n\tdemo:boolean;\n\thideAccountBranchAddress: boolean; // Si true, no se muestra la direccion de la sucursal en el checkout.\n\tcreatedAt: Date;\n\tupdatedAt: Date;\n\tdeletedAt?: Date | null;\n\tdata?: Record<string, unknown>\n\n\tdeliveryZones: AccountDeliveryOptionZone[];\n\tintegration?: AccountIntegration | null;\n\tprice?: number | null;\n\taccountBranch?: AccountBranch | null;\n}\n\nexport enum AccountDeliveryOptionPriceLogic {\n\tFIXED = \"FIXED\",\n\tCALCULATED = \"CALCULATED\",\n}\n\nexport enum AccountDeliveryOptionStatus {\n\tACTIVE = \"ACTIVE\",\n\tINACTIVE = \"INACTIVE\",\n}\n\nexport interface AccountDeliveryOptionCalculatedCost {\n\tbasePrice: number;\n\tdistanceKm: number;\n\tfinalPrice: number;\n\tpriceLogic: AccountDeliveryOptionPriceLogic;\n\tcurrency: string;\n}\n\n\nexport interface AccountDeliveryOptionZone {\n\tid: string;\n\taccountId: string;\n\taccountDeliveryOptionId: string;\n\tgeoZoneId: string;\n\tstatus: AccountDeliveryOptionZoneStatus;\n\tdemo: boolean;\n\tcreatedAt: Date;\n\tupdatedAt: Date;\n\tdeletedAt?: Date | null;\n\n\t// Relations\n\tgeoZone?: GeoZone;\n}\n\nexport enum AccountDeliveryOptionZoneStatus {\n\tACTIVE = \"ACTIVE\",\n\tINACTIVE = \"INACTIVE\",\n}\n\n// DTO Types for API operations\nexport interface DeliveryZoneInput {\n\tgeoZoneId?: string;\n\tgeoZone?: GeoZoneInput;\n}\n\nexport interface GeoZoneInput {\n\tname: string;\n\tarea: MapPosition[];\n\tdescription?: string;\n}\n\nexport interface CreateAccountDeliveryOptionDTO {\n\taccountId: string;\n\taccountBranchId: string;\n\tname: string;\n\taccountIntegrationId?: string | null;\n\tisScheduled?: boolean;\n\tpriceLogic?: AccountDeliveryOptionPriceLogic;\n\tprice?: number;\n\tstatus?: AccountDeliveryOptionStatus;\n\tdeliveryType: DeliveryType;\n\tdeliveryZones?: DeliveryZoneInput[];\n\tdata?: Record<string, unknown>;\n}\n\nexport interface UpdateAccountDeliveryOptionDTO {\n\taccountBranchId: string;\n\tname?: string;\n\taccountIntegrationId?: string | null;\n\tisScheduled?: boolean;\n\tpriceLogic?: AccountDeliveryOptionPriceLogic;\n\tstatus?: AccountDeliveryOptionStatus;\n\tdeliveryType?: DeliveryType;\n\tdeliveryZones?: DeliveryZoneInput[];\n\tdata?: Record<string, unknown>;\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 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 ","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 { StatusInfo } from \"../common/Status\";\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}","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}","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\n customer?: Partial<Customer> | null\n accountDomain?: Partial<AccountDomain> | null\n deliveryMethod?: CartDeliveryMethod | null\n promotions: {\n code: string\n amount: number\n }[]\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}\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 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')\n\tname: string; // Human-readable name (e.g., \"Stripe\", \"Mercado Pago\")\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\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 items?: OrderItem[];\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}\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\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\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};","import { StatusInfo } from \"../common/Status\";\nimport { OrderStatus } from \"./types\";\n\nexport function getOrderStatusInfo(status: OrderStatus): StatusInfo {\n\tconst map: Record<OrderStatus, StatusInfo> = {\n\t\tPENDING: { text: 'Pendiente', class: 'secondary', actionText: '' },\n\t\tCONFIRMED: { text: 'Confirmada', class: 'info', actionText: 'Confirmar orden' },\n\t\tPROCESSING: { text: 'En proceso', class: 'warning', actionText: 'Procesar orden' },\n\t\tPROCESSED: { text: 'Procesada', class: 'primary', actionText: 'Orden procesada' },\n\t\tON_HOLD: { text: 'En espera', class: 'secondary', actionText: 'Orden en espera' },\n\t\tCOMPLETED: { text: 'Completada', class: 'success', actionText: 'Completar orden' }, \n\t\tCANCELLED: { text: 'Cancelada', class: 'danger', actionText: 'Cancelar orden' },\n\t\tFAILED: { text: 'Fallida', class: 'danger', actionText: '' },\n\t};\n\n\treturn map[status] ?? { text: String(status), class: 'secondary' };\n}","// shared-types/src/payment/types.ts\n\nimport { Currency } from \"../common\";\nimport { AccountPaymentMethod } from \"../accountPaymentMethod\";\nimport { Order } from \"../order\";\nimport { StatusInfo } from \"../common/Status\";\n\n\nexport enum PaymentStatus {\n PENDING = 'PENDING', // Pendiente\n PREAUTHORIZED = 'PREAUTHORIZED',\n APPROVED = 'APPROVED', // Pago aprobado online\n PAID = 'PAID', // Pago realizado por redes fisicas\n REJECTED = 'REJECTED', // Pago rechazado\n REFUND_IN_PROCESS = 'REFUND_IN_PROCESS', // En proceso de reembolso con la plataforma de pagos\n PARTIAL_REFUND = 'PARTIAL_REFUND', // Pago parcialmente reembolsado\n REFUNDED = 'REFUNDED', // Pago reembolsado\n ERROR = 'ERROR' // Represents an error in porcessing the payment. Ex: a webhook comes without an esternal reference, so we can't match in our system\n}\n\nexport enum PaymentMethodType {\n BANK_TRANSFER = 'BANK_TRANSFER',\n CREDIT_CARD = 'CREDIT_CARD',\n DEBIT_CARD = 'DEBIT_CARD',\n MERCADOPAGO = 'MERCADOPAGO',\n PHYSICAL = 'PHYSICAL',\n INTERNATIONAL = 'INTERNATIONAL',\n PAYPAL = 'PAYPAL',\n CASH = 'CASH',\n OTHER = 'OTHER', // Added for flexibility\n}\nexport interface Payment {\n id: string;\n accountId: string;\n orderId: string;\n invoiceId?: string;\n accountPaymentMethodId?: string;\n accountIntegrationId?: string;\n referenceCode?: string;\n paymentMethodType?: PaymentMethodType;\n currency: Currency;\n amount: number;\n amountReceived: number;\n amountRefunded: number;\n paidAt?: string | Date;\n refundedAt?: string | Date;\n status: PaymentStatus;\n statusInfo?: StatusInfo;\n cardBrand?: string;\n cardBrandInfo?: PaymentCardBrand;\n cardLast4?: string;\n data?: Record<string, any>\n metadata?: Record<string, any>;\n internalComment?: string;\n demo: boolean;\n createdAt: string | Date;\n updatedAt: string | Date;\n deletedAt?: string | Date;\n\n accountPaymentMethod?: Partial<AccountPaymentMethod> | null; \n order?: Order;\n}\n\n// Provider-level types (entity-agnostic, reusable across projects)\nexport type PaymentProviderKey = 'MERCADOPAGO' | 'PLEXO' | 'MANUAL_PAYMENT';\n\n// TODO: Eventually refactor what is passed to the payment provider constructor, as it most likely just need\nexport interface PaymentProviderContext {\n data: Record<string, unknown>\n}\n\nexport interface PaymentProviderInitInput {\n // Arbitrary provider input. Caller builds this from their domain data\n data: Record<string, any>;\n}\n\nexport interface PaymentProviderInitOutput {\n data: Record<string, any>;\n status: PaymentStatus\n}\n\nexport interface PaymentProviderCaptureInput {\n data: Record<string, any>;\n}\n\nexport interface PaymentProviderCaptureOutput {\n data: Record<string, any>;\n}\n\nexport interface PaymentProviderRefundInput {\n amount: number;\n data: Record<string, any>;\n}\n\nexport interface PaymentProviderRefundOutput {\n data: Record<string, any>;\n}\n\nexport interface PaymentProviderWebhookResult {\n //TODO: Ideally, if later an order can have multiple payments, the way to link thrid party payments with our own payment entity, should be throu something like a \n // payment session in our system, that would be set as the external reference in the third party payment\n paymentId: string | null\n status: PaymentStatus\n data: Record<string, unknown>\n // TODO: Ideally i think this should live inside the data field, not have separate columns and just let the consumer know what\n // attributes to query to resolve them\n paymentDetails: {\n referenceCode?: string,\n method?: string,\n last4?: string\n }\n}\n\nexport interface WebhookPayload {\n // Id of payment provider webhook belongs to, to pass data for processing\n provider: string;\n accountId: string;\n payload: {\n query: Record<string, unknown>\n body: Record<string, unknown>\n headers: Record<string, unknown>\n }\n}\n\nexport enum PaymentCardBrandKey {\n mp_account_money = 'mp_account_money',\n master = 'master',\n debmaster = 'debmaster',\n visa = 'visa',\n debvisa = 'debvisa',\n diners = 'diners',\n oca = 'oca',\n lider = 'lider',\n amex = 'amex',\n redpagos = 'redpagos',\n abitab = 'abitab',\n}\n\nexport interface PaymentCardBrand {\n key: string;\n name: string;\n image: string;\n icon: string;\n}\n\nexport function getPaymentCardBrand(key: PaymentCardBrandKey): PaymentCardBrand {\n const map: Record<PaymentCardBrandKey, PaymentCardBrand> = {\n mp_account_money: {\n key: PaymentCardBrandKey.mp_account_money,\n name: 'Dinero en cuenta Mercado Pago',\n image: 'https://assets.retai.la/payments/mercadopago.png',\n icon: 'https://assets.retai.la/payments/mercadopago-ico.png',\n },\n master: {\n key: PaymentCardBrandKey.master,\n name: 'Mastercard',\n image: 'https://assets.retai.la/payments/master.png',\n icon: 'https://assets.retai.la/payments/master-ico.png',\n },\n debmaster: {\n key: PaymentCardBrandKey.master,\n name: 'Mastercard Débito',\n image: 'https://assets.retai.la/payments/master.png',\n icon: 'https://assets.retai.la/payments/master-ico.png',\n },\n visa: {\n key: PaymentCardBrandKey.visa,\n name: 'Visa',\n image: 'https://assets.retai.la/payments/visa.png',\n icon: 'https://assets.retai.la/payments/visa-ico.png',\n },\n debvisa: {\n key: PaymentCardBrandKey.visa,\n name: 'Visa Débito',\n image: 'https://assets.retai.la/payments/visa.png',\n icon: 'https://assets.retai.la/payments/visa-ico.png',\n },\n diners:{\n key: PaymentCardBrandKey.diners,\n name: 'Diners',\n image: 'https://assets.retai.la/payments/diners.png',\n icon: 'https://assets.retai.la/payments/diners-ico.png',\n },\n oca: {\n key: PaymentCardBrandKey.oca,\n name: 'Oca',\n image: 'https://assets.retai.la/payments/oca.png',\n icon: 'https://assets.retai.la/payments/oca-ico.png',\n },\n lider:{\n key: PaymentCardBrandKey.lider,\n name: 'Lider',\n image: 'https://assets.retai.la/payments/lider.png',\n icon: 'https://assets.retai.la/payments/lider-ico.png',\n },\n amex: {\n key: PaymentCardBrandKey.amex,\n name: 'American Express',\n image: 'https://assets.retai.la/payments/amex.png',\n icon: 'https://assets.retai.la/payments/amex-ico.png',\n },\n redpagos: {\n key: PaymentCardBrandKey.redpagos,\n name: 'Redpagos',\n image: 'https://assets.retai.la/payments/redpagos.png',\n icon: 'https://assets.retai.la/payments/redpagos-ico.png',\n },\n abitab:{\n key: PaymentCardBrandKey.abitab,\n name: 'Abitab',\n image: 'https://assets.retai.la/payments/abitab.png',\n icon: 'https://assets.retai.la/payments/abitab-ico.png',\n }\n }\n return map[key] || {\n key,\n name: '',\n image: null,\n }\n}\n\nexport interface PaymentProviderAdapter {\n readonly key: PaymentProviderKey;\n initPayment(input: PaymentProviderInitInput): Promise<PaymentProviderInitOutput>;\n capture(input: PaymentProviderCaptureInput): Promise<PaymentProviderCaptureOutput>\n refund(input: PaymentProviderRefundInput): Promise<PaymentProviderRefundOutput>;\n processWebhook(input: WebhookPayload['payload']): Promise<PaymentProviderWebhookResult>\n}","import { StatusInfo } from \"../common/Status\";\nimport { PaymentStatus } from \"./types\";\n\nexport function getPaymentStatusInfo(status: PaymentStatus): StatusInfo {\n\tconst map: Record<PaymentStatus, StatusInfo> = {\n\t\tPENDING: { text: 'Pago pendiente', class: 'warning', actionText: '' },\n\t\tPREAUTHORIZED: { text: 'Pago preautorizado', class: 'info', actionText: 'Preautorizar pago' },\n\t\tAPPROVED: { text: 'Pago aprobado', class: 'success', actionText: 'Aprobar pago' },\n\t\tPAID: { text: 'Pago realizado', class: 'success', actionText: 'Pago realizado' },\n\t\tREJECTED: { text: 'Pago rechazado', class: 'danger', actionText: 'Rechazar pago' },\n\t\tREFUND_IN_PROCESS: { text: 'Pago en proceso de reembolso', class: 'warning', actionText: 'Reembolsar pago' },\n\t\tPARTIAL_REFUND: { text: 'Pago parcialmente reembolsado', class: 'warning', actionText: 'Reembolsar pago' },\n\t\tREFUNDED: { text: 'Pago reembolsado', class: 'success', actionText: 'Reembolsado' },\n\t\tERROR: { text: 'Error en pago', class: 'danger', actionText: 'Error en pago' },\n\t};\n\n\treturn map[status] ?? { text: String(status), class: 'secondary' };\n}","import { Media } from \"../common\";\nimport { StatusInfo } from \"../common/Status\";\nimport { ProductCategory } from \"../productCategory\";\n\n/**\n * Entidad Product\n * Representa un producto vendible en la tienda. Es la entidad base que puede tener múltiples variantes.\n */\n\nexport interface Product {\n id: string;\n accountId: string;\n code: string;\n brandId?: string | null;\n supplierId?: string | null;\n productType: ProductType;\n sku?: string | null;\n barcode?: string | null;\n name: string; // e.g., \"Zapatos\", \"Pantalones\", \"Camisas\"\n slug: string;\n description?: string | null;\n isFeatured: boolean;\n\n // Inventory & Shipping\n allowBackorder: boolean; // Permite realizar pedidos aunque no haya stock disponible. Se aplica a las variantes si no está definido allí\n weight?: number | null;\n weightUnit?: string | null; // e.g., \"kg\"\n height?: number | null;\n width?: number | null;\n depth?: number | null; \n dimensionUnit?: string | null; // e.g., \"cm\"\n shippingLeadTime?: string | null; // e.g., \"1-3 days\"\n\n status: ProductStatus; // ACTIVE, INACTIVE\n statusInfo?: StatusInfo;\n \n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n\n media?: Media[]\n\n variants?: ProductVariant[];\n categories?: ProductCategory[];\n}\n\nexport enum ProductStatus {\n ACTIVE = 'ACTIVE', // Available for sale\n INACTIVE = 'INACTIVE', // Not visible/purchasable\n ARCHIVED = 'ARCHIVED', // Not visible, kept for records\n DRAFT = 'DRAFT', // Incomplete product setup\n}\n\nexport enum ProductType {\n SIMPLE = 'SIMPLE', // Product without variants (may have a default hidden variant)\n VARIABLE = 'VARIABLE', // Product with distinct variants (color, size, etc.)\n BUNDLE = 'BUNDLE', // A package of other products/variants\n GIFT_CARD = 'GIFT_CARD', // Virtual or physical gift card\n}\n\n\nexport interface ProductVariant {\n id: string;\n accountId: string;\n productId: string;\n\n sku?: string | null;\n barcode?: string | null; // EAN, UPC, etc.\n\n // Pricing\n currency: string; // ISO 4217 currency code\n price: number;\n compareAtPrice?: number;\n allowBackorder?: boolean;\n \n // Inventory & Shipping\n stock: number;\n weight?: number | null;\n weightUnit?: string | null;\n height?: number | null;\n width?: number | null;\n depth?: number | null;\n dimensionUnit?: string | null;\n shippingLeadTime?: string | null; // e.g., \"1-3 days\"\n \n order: number;\n\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date;\n\n}","import { StatusInfo } from \"../common/Status\";\nimport { ProductStatus } from \"./types\";\n\nexport function getProductStatusInfo(status: ProductStatus): StatusInfo {\n\tconst map: Record<ProductStatus, StatusInfo> = {\n\t\tACTIVE: { text: 'Activo', class: 'success' },\n\t\tINACTIVE: { text: 'Inactivo', class: 'danger' },\n\t\tARCHIVED: { text: 'Archivado', class: 'secondary' },\n\t\tDRAFT: { text: 'Borrador', class: 'secondary' },\n\t};\n\n\treturn map[status] ?? { text: String(status), class: 'secondary' };\n}","/**\n * Promotion Module Types\n * Types for the promotion system including promotions, rules, application methods, and adjustments\n */\n\n// ============================================================================\n// Promotion Core Types\n// ============================================================================\n\n/**\n * Main promotion entity that defines discount rules and metadata\n */\nexport interface Promotion {\n id: string\n accountId: string\n code: string // Unique identifier within account, also serves as coupon code\n type: PromotionType\n isAutomatic: boolean // true = auto-apply, false = requires code\n isStackable: boolean // true = can be combined with other stackable promotions, false = cannot be combined\n campaignId?: string | null // Optional: Group promotions under campaigns\n name: string\n description?: string | null\n status: PromotionStatus\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\nexport enum PromotionType {\n STANDARD = 'standard',\n}\n\nexport enum PromotionStatus {\n ACTIVE = 'active',\n INACTIVE = 'inactive',\n}\n\n// ============================================================================\n// Promotion Rule Types\n// ============================================================================\n\n/**\n * Reusable rule entity that can be attached to either Promotions (cart/order level)\n * or ApplicationMethods (target level)\n */\nexport interface PromotionRule {\n id: string\n accountId: string\n ruleAttribute: string // e.g., \"subtotal\", \"item_count\", \"customer_id\", \"product_id\", \"category_id\"\n ruleOperator: PromotionRuleOperator\n createdAt: Date\n updatedAt: Date\n}\n\nexport enum PromotionRuleOperator {\n GT = 'gt', // greater than\n GTE = 'gte', // greater than or equal\n LT = 'lt', // less than\n LTE = 'lte', // less than or equal\n EQ = 'eq', // equals\n IN = 'in', // in array\n NIN = 'nin', // not in array\n}\n\n/**\n * Stores the values that a PromotionRule is evaluated against\n */\nexport interface PromotionRuleValue {\n id: string\n promotionRuleId: string\n value: string // Flexible string value (can represent numbers, UUIDs, etc.)\n createdAt: Date\n updatedAt: Date\n}\n\n// ============================================================================\n// Pivot Tables - Promotion Rules\n// ============================================================================\n\n/**\n * Many-to-many relationship between Promotion and PromotionRule for cart/order-level rules\n */\nexport interface PromotionPromotionRule {\n promotionId: string\n promotionRuleId: string\n}\n\n/**\n * Many-to-many relationship between PromotionApplicationMethod and PromotionRule for target-level rules\n */\nexport interface PromotionApplicationMethodPromotionRule {\n applicationMethodId: string\n promotionRuleId: string\n}\n\n// ============================================================================\n// Application Method Types\n// ============================================================================\n\n/**\n * Defines how the promotion discount is applied\n */\nexport interface PromotionApplicationMethod {\n id: string\n accountId: string\n promotionId: string // 1-to-1 relationship with Promotion\n targetType: PromotionTargetType\n applicationType: PromotionApplicationType\n value: number // Discount value\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\nexport enum PromotionTargetType {\n ITEMS = 'items', // apply to cart/order line items\n SHIPPING = 'shipping', // apply to cart/order delivery methods\n ORDER = 'order', // apply to order total\n}\n\nexport enum PromotionApplicationType {\n PERCENTAGE = 'percentage', // e.g., 10% off\n FIXED = 'fixed', // e.g., $5 off\n}\n\n// ============================================================================\n// Cart Adjustment Types\n// ============================================================================\n\n/**\n * Tracks promotion adjustments applied to individual cart items\n */\nexport interface CartLineItemAdjustment {\n id: string\n accountId: string\n cartItemId: string\n promotionId?: string | null\n description: string // e.g., \"10% off Summer Sale\"\n code?: string | null // Promotion code if applicable\n amount: number // Discount amount (always positive)\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\n/**\n * Tracks promotion adjustments applied to cart delivery methods\n */\nexport interface CartDeliveryMethodAdjustment {\n id: string\n accountId: string\n cartDeliveryMethodId: string\n promotionId?: string | null\n description: string\n code?: string | null\n amount: number\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\n/**\n * Links carts to applied promotions for easy querying (pivot table)\n */\nexport interface CartPromotion {\n cartId: string\n promotionId: string\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\n// ============================================================================\n// Order Adjustment Types\n// ============================================================================\n\n/**\n * Tracks promotion adjustments on order items (snapshot from cart)\n */\nexport interface OrderLineItemAdjustment {\n id: string\n accountId: string\n orderItemId: string\n promotionId?: string | null\n description: string\n code?: string | null\n amount: number\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\n/**\n * Tracks promotion adjustments on order delivery methods\n */\nexport interface OrderDeliveryMethodAdjustment {\n id: string\n accountId: string\n orderDeliveryMethodId: string\n promotionId?: string | null\n description: string\n code?: string | null\n amount: number\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\n/**\n * Links orders to applied promotions for easy querying (pivot table, snapshot from cart)\n */\nexport interface OrderPromotion {\n orderId: string\n promotionId: string\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n","/**\n * Entidad ProductAttribute\n * Define los atributos disponibles que se pueden asignar a las variantes de producto (ej. Color, Talla).\n * Especifica el nombre y tipo del atributo para ayudar en la representación y filtrado.\n */\n\nimport { ProductCategory } from \"../productCategory/types\";\n\nexport interface ProductAttribute {\n id: string;\n accountId: string;\n name: string; // e.g., \"Color de zapatos\", \"Talle de pantalones\", \"Material\"\n alias: string; // e.g., \"Color\", \"Talla\", \"Material\"\n slug: string;\n type: ProductAttributeType; // Helps frontend render appropriate controls\n isRequired: boolean; // isRequired for product variant\n suffix: string; // suffix for number type\n status: ProductAttributeStatus; // ACTIVE, INACTIVE\n \n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n\n // dejo las categorias planas y los links de la tabla pivot por si necesito acceder a ellas\n productCategories: ProductCategory[]; // conveniente\n productCategoryLinks: Array<{ categoryId: string; isRequired: boolean; displayOrder: number }>;\n\n options: ProductAttributeOption[];\n displayOrder: number; // order to display the attribute in the frontend\n}\n\nexport enum ProductAttributeStatus {\n ACTIVE = 'ACTIVE',\n INACTIVE = 'INACTIVE',\n}\n\n\nexport enum ProductAttributeType {\n TEXT = 'TEXT', // text input\n NUMBER = 'NUMBER', // number input\n COLOR = 'COLOR', // Special type for color swatches\n SELECT = 'SELECT', // Dropdown list\n BOOLEAN = 'BOOLEAN', // checkbox input\n}\n\n/**\n * Una opción específica para un atributo (ej. \"Talle 42\" para el atributo \"Talle\").\n */\nexport interface ProductAttributeOption {\n id: string;\n accountId: string;\n productAttributeId: string;\n value: string;\n imageId?: string | null;\n order: number;\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n\n count: number; // number of options\n}","import { StandardCategory } from \"../standardCategory\";\n\n/**\n * Entidad ProductCategory\n * Define las categorías de productos.\n * Soporta una estructura jerárquica (categorías y subcategorías) mediante el campo parentId.\n * Cada categoría debe estar asociada a una categoría estándar del sistema.\n */\n\nexport interface ProductCategory {\n id: string;\n accountId: string;\n parentId?: string;\n standardCategoryId: string;\n name: string; // e.g., \"Zapatos\", \"Pantalones\", \"Camisas\"\n slug: string;\n description?: string;\n imageId?: string | null;\n order: number;\n isFeatured: boolean;\n status: ProductCategoryStatus; // ACTIVE, INACTIVE\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n\n children: ProductCategory[];\n parent: ProductCategory | null;\n standardCategory: StandardCategory;\n}\n\n\nexport enum ProductCategoryStatus {\n ACTIVE = 'ACTIVE',\n INACTIVE = 'INACTIVE',\n}\n\n","/**\n * Entidad StandardCategory\n * Define las categorías estándar de productos.\n * Estas categorías estan pensadas para unificar o agrupar productos de diferentes cuentas.\n */\n\nexport interface StandardCategory {\n id: string;\n parentId?: string;\n name: string; // e.g., \"Zapatos\", \"Pantalones\", \"Camisas\"\n slug: string;\n description?: string;\n imageId?: string | null;\n order: number;\n status: StandardCategoryStatus; // ACTIVE, INACTIVE\n metadata?: {\n icon?: string;\n displayInMenu?: boolean;\n seoTitle?: string;\n seoDescription?: string;\n attributes?: string[];\n };\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n\n children: StandardCategory[];\n parent: StandardCategory | null;\n}\n\nexport enum StandardCategoryStatus {\n ACTIVE = 'ACTIVE',\n INACTIVE = 'INACTIVE'\n}\n\n","/**\n * Entidad StoreBanner\n * Banners para la portada de la web de la tienda\n */\n\nimport { Media } from \"../common\";\n\nexport interface StoreBanner {\n id: string;\n accountId: string;\n title: string;\n desktopMediaId: string;\n mobileMediaId?: string | null;\n linkUrl?: string | null;\n altText?: string | null;\n displayOrder: number;\n startDate?: Date | null;\n endDate?: Date | null;\n status: StoreBannerStatus;\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n\n // Relationships\n desktopMedia?: Partial<Media> | null;\n mobileMedia?: Partial<Media> | null;\n}\n\nexport enum StoreBannerStatus {\n ACTIVE = \"ACTIVE\",\n INACTIVE = \"INACTIVE\"\n}\n\n ","/**\n * Entidad StorePage\n * Páginas de la web de la tienda\n */\n\nexport interface StorePage {\n id: string;\n accountId: string;\n type: StorePageType;\n title: string;\n slug: string;\n content?: string | null;\n seoTitle?: string | null;\n seoDescription?: string | null;\n \n status: StorePageStatus;\n canDelete: boolean;\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n}\n\nexport enum StorePageStatus {\n PUBLISHED = 'PUBLISHED',\n DRAFT = 'DRAFT',\n ARCHIVED = 'ARCHIVED',\n}\n\nexport enum StorePageType {\n ABOUT_US = 'ABOUT_US',\n CONTACT = 'CONTACT',\n FAQ = 'FAQ',\n TERMS_AND_CONDITIONS = 'TERMS_AND_CONDITIONS',\n PRIVACY_POLICY = 'PRIVACY_POLICY',\n RETURN_POLICY = 'RETURN_POLICY',\n SHIPPING_POLICY = 'SHIPPING_POLICY',\n BRANCHES = 'BRANCHES',\n JOBS = 'JOBS',\n OTHER = 'OTHER',\n}\n\n\n ","export enum PubSubTopics {\n ORDER_PLACED = 'order-placed',\n ORDER_CONFIRMED = 'order-confirmed',\n ORDER_PROCESSING = 'order-processing',\n ORDER_PROCESSED = 'order-processed',\n ORDER_COMPLETED = 'order-completed',\n ORDER_CANCELLED = 'order-cancelled',\n PAYMENT_PAID = 'payment-paid',\n NOTIFICATION_CREATED = 'notification-created',\n }","import { Account } from \"../account/types\";\nimport { Customer } from \"../customer/types\";\n\n\n// origen principal del hilo de conversación\nexport enum SupportConversationChannel {\n\tWEB = 'WEB',\n\tEMAIL = 'EMAIL',\n\tWHATSAPP = 'WHATSAPP'\n}\n\n// quién puede ver el hilo en el tenant\nexport enum SupportConversationVisibility {\n\tINTERNAL = 'INTERNAL',\n\tMERCHANT = 'MERCHANT'\n}\n\nexport enum SupportConversationPriority {\n\tLOW = 'LOW',\n\tMEDIUM = 'MEDIUM',\n\tHIGH = 'HIGH',\n\tURGENT = 'URGENT'\n}\n\nexport enum SupportConversationStatus {\n\tOPEN = 'OPEN',\n\tCLOSED = 'CLOSED',\n\tPENDING = 'PENDING'\n}\n\nexport enum SupportConversationMessageDeliveryStatus {\n\tQUEUED = 'QUEUED',\n\tSENT = 'SENT',\n\tDELIVERED = 'DELIVERED',\n\tREAD = 'READ',\n\tFAILED = 'FAILED'\n}\n\nexport enum SupportConversationMessageAiAnalysisStatus {\n\tPENDING = 'PENDING',\n\tPROCESSING = 'PROCESSING',\n\tCOMPLETED = 'COMPLETED',\n\tFAILED = 'FAILED'\n}\n\n// Dirección del mensaje con respecto al sistema: entrante o saliente\nexport enum SupportConversationMessageDirection {\n\tINBOUND = 'INBOUND',\n\tOUTBOUND = 'OUTBOUND'\n }\n \n // Tipo de emisor del mensaje\n export enum SupportConversationMessageSenderType {\n\tCUSTOMER = 'CUSTOMER',\n\tACCOUNT_USER = 'ACCOUNT_USER',\n\tANONYMOUS = 'ANONYMOUS',\n\tSYSTEM = 'SYSTEM',\n\tAI = 'AI'\n }\n\nexport interface SupportConversation {\n\tid: string;\n\taccountId: string;\n\tsubject?: string | null; // Asunto opcional del hilo (para email o contacto web)\n\tchannel: SupportConversationChannel; // Canal principal de la conversación (email/whatsapp/web, etc.)\n\tassigneeId?: string | null; // Asignación interna (agente/usuario de la cuenta que atiende la conversación)\n\tvisibility: SupportConversationVisibility;\n\tpriority: SupportConversationPriority; // Priorización operativa\n\trequiresMerchantAction: boolean; // Indica si el comercio debe responder o tomar acción\n\trequiresInternalAction: boolean; // Indica si el equipo interno debe intervenir (respuesta, etc.)\n\tcustomerId?: string | null; // Identificador del cliente si está registrado en el sistema\n\tcustomerName?: string | null; // Nombre del contacto (snapshot, no necesariamente el del Customer)\n\tcustomerLastname?: string | null; // Apellido del contacto (snapshot)\n\tcustomerEmail?: string | null; // Email del contacto (snapshot)\n\tcustomerPhone?: string | null; // Teléfono del contacto (snapshot)\n\tstatus: SupportConversationStatus; // Estado simple (string para mantenerlo liviano)\n\tlastMessageAt?: Date | null;\n\tunreadForAgent: number; // Mensajes no leídos por el agente interno\n\tunreadForCustomer: number; // Mensajes no leídos por el cliente/comercio\n\tmetadata?: Object | null; // Metadatos flexibles (headers email, ids de chat, etc.)\n\taiSuggestion?: Object | null; // Sugerencias/Resumen asistidos por IA\n\tcreatedAt: Date;\n\tupdatedAt: Date;\n\tdeletedAt?: Date | null;\n\n\taccount: Account;\n\t// assignee: AccountUser | null;\n\tcustomer: Customer | null;\n\tmessages: SupportConversationMessage[];\n}\n\n\nexport interface SupportConversationMessage {\n id: string;\n accountId: string;\n conversationId: string;\n direction: SupportConversationMessageDirection; // Dirección simple (entrante/saliente)\n senderType: SupportConversationMessageSenderType; // Tipo de emisor del mensaje (cliente, usuario interno, anónimo, sistema o IA)\n senderId?: string | null; // Identificador del emisor cuando aplica (Customer o AccountUser). Puede ser null para anónimos, sistema o IA\n body: string;\n isAiGenerated: boolean;\n isSystem: boolean;\n deliveryStatus: SupportConversationMessageDeliveryStatus; // Estado de entrega (para OUTBOUND). Por defecto QUEUED para ser enviado por el canal.\n requiresAiAnalysis: boolean;\n aiAnalysisStatus: SupportConversationMessageAiAnalysisStatus;\n aiAnalyzedAt?: Date | null;\n externalMessageId?: string | null; // Identificadores de proveedor externo (messageId, threadId)\n externalThreadId?: string | null;\n attachments?: Array<{\n url: string;\n type?: string;\n name?: string;\n sizeBytes?: number;\n }>; // Adjuntos simples (urls o descriptores livianos) \n metadata?: Object | null; // Metadatos flexibles (headers, payloads originales, etc.)\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n}\n","import { Webhook } from \"../common/Webhook\";\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 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 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 // Pickup locations for PICKUP delivery type options\n pickupLocations?: PickupLocation[]\n [key: string]: unknown\n}\n\n// Pickup Location types\nexport interface PickupLocation {\n id: string;\n name: string;\n address: {\n street: string;\n city: string;\n state: string;\n postalCode?: string;\n };\n coordinates?: {\n latitude: number;\n longitude: number;\n };\n hours?: string;\n phone?: string;\n additionalInfo?: Record<string, unknown>;\n}\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\nexport type FulfillmentRecollectionConfig = {\n mode: FulfillmentRecollectionMode;\n scheduledDateTime?: Date; // Required when allowsScheduling=true and mode includes recollection\n recollectionAddress?: {\n street: string;\n city: string;\n state: string;\n };\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}\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}\n\n// Provider-level types (entity-agnostic, reusable across projects)\nexport type FulfillmentProviderKey = 'MANUAL_FULFILLMENT' | 'DAC';\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 getRecollectionCapabilities(): Promise<FulfillmentRecollectionCapabilities>;\n // Create fulfillment with third-party provider\n createFulfillment(input: FulfillmentProviderCreateInput): Promise<FulfillmentProviderCreateOutput>;\n processWebhook(input: FulfillmentProviderProcessWebhookInput): Promise<FulfillmentProviderProcessWebhookOutput | null>\n // cancel(input: FulfillmentProviderCancelInput): Promise<FulfillmentProviderCancelOutput>;\n}","import { StatusInfo } from \"../common/Status\";\nimport { FulfillmentStatus } from \"./types\";\n\nexport function getFulfillmentStatusInfo(status: FulfillmentStatus): StatusInfo {\n\tconst map: Record<FulfillmentStatus, StatusInfo> = {\n\t\tpending: { text: 'Paquete listo', class: 'warning', actionText: '' },\n\t\tshipped: { text: 'Enviado', class: 'warning', actionText: 'Enviado' },\n\t\tdelivered: { text: 'Entregado', class: 'success', actionText: 'Entregado' },\n\t\tcancelled: { text: 'Cancelado', class: 'danger', actionText: 'Cancelado' },\n\t};\n\n\treturn map[status] ?? { text: String(status), class: 'secondary' };\n}","/**\n * GeoZone types\n * Define zonas geográficas reutilizables que pueden ser referenciadas por otras entidades.\n */\n\nimport { MapPosition } from \"../common\";\n\nexport interface GeoZone {\n id: string;\n name: string;\n description?: string;\n accountId?: string | null; // null for system-wide zones (admin/integration created)\n area: MapPosition[]; // Spatial geometry polygon\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n}\n\nexport enum GeoZoneStatus {\n ACTIVE = \"ACTIVE\",\n INACTIVE = \"INACTIVE\",\n}","import { GeoZone } from \"../geoZone\";\nimport { Integration } from \"../integration\";\n\n/**\n * IntegrationDeliveryZone types\n * Define las zonas de entrega permitidas para cada integración de fulfillment provider.\n */\n\nexport interface IntegrationDeliveryZone {\n id: string;\n integrationId: string;\n geoZoneId: string;\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n\n // Relations\n integration?: Integration;\n geoZone?: GeoZone;\n}\n\nexport enum IntegrationDeliveryZoneStatus {\n ACTIVE = \"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ACf,EAAAA,sCAAA,eAAY;AACZ,EAAAA,sCAAA,YAAS;AACT,EAAAA,sCAAA,QAAK;AALQ,SAAAA;AAAA,GAAA;;;AC9CP,IAAK,oBAAL,kBAAKC,uBAAL;AACH,EAAAA,mBAAA,aAAU;AACV,EAAAA,mBAAA,aAAU;AACV,EAAAA,mBAAA,eAAY;AACZ,EAAAA,mBAAA,eAAY;AAJJ,SAAAA;AAAA,GAAA;;;ACHL,SAAS,yBAAyB,QAAuC;AAC/E,QAAM,MAA6C;AAAA,IAClD,SAAS,EAAE,MAAM,iBAAiB,OAAO,WAAW,YAAY,GAAG;AAAA,IACnE,SAAS,EAAE,MAAM,WAAW,OAAO,WAAW,YAAY,UAAU;AAAA,IACpE,WAAW,EAAE,MAAM,aAAa,OAAO,WAAW,YAAY,YAAY;AAAA,IAC1E,WAAW,EAAE,MAAM,aAAa,OAAO,UAAU,YAAY,YAAY;AAAA,EAC1E;AAEA,SAAO,IAAI,MAAM,KAAK,EAAE,MAAM,OAAO,MAAM,GAAG,OAAO,YAAY;AAClE;;;ACMO,IAAK,gBAAL,kBAAKC,mBAAL;AACH,EAAAA,eAAA,YAAS;AACT,EAAAA,eAAA,cAAW;AAFH,SAAAA;AAAA,GAAA;;;ACGL,IAAK,gCAAL,kBAAKC,mCAAL;AACH,EAAAA,+BAAA,YAAS;AACT,EAAAA,+BAAA,cAAW;AAFH,SAAAA;AAAA,GAAA;","names":["MediaType","Currency","DayOfWeek","AccountStatus","AccountBranchStatus","AccountBranchScheduleStatus","AccountBranchScheduleDay","DeliveryType","AccountDeliveryOptionPriceLogic","AccountDeliveryOptionStatus","AccountDeliveryOptionZoneStatus","AccountDomainStatus","AccountIntegrationStatus","AccountIntegrationConnectionStatus","AccountIntegrationEnvironment","AccountPaymentMethodStatus","CartStatus","CartSource","CartDeliveryType","CartItemErrorCode","CustomerStatus","IntegrationCategory","IntegrationStatus","OrderStatus","OrderPaymentStatus","OrderSource","OrderDeliveryType","PaymentStatus","PaymentMethodType","PaymentCardBrandKey","ProductStatus","ProductType","PromotionType","PromotionStatus","PromotionRuleOperator","PromotionTargetType","PromotionApplicationType","ProductAttributeStatus","ProductAttributeType","ProductCategoryStatus","StandardCategoryStatus","StoreBannerStatus","StorePageStatus","StorePageType","PubSubTopics","SupportConversationChannel","SupportConversationVisibility","SupportConversationPriority","SupportConversationStatus","SupportConversationMessageDeliveryStatus","SupportConversationMessageAiAnalysisStatus","SupportConversationMessageDirection","SupportConversationMessageSenderType","FulfillmentStatus","GeoZoneStatus","IntegrationDeliveryZoneStatus"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/common/Media.ts","../src/common/Currency.ts","../src/common/Date.ts","../src/account/types.ts","../src/accountBranch/types.ts","../src/accountDeliveryOption/types.ts","../src/accountDomain/types.ts","../src/accountIntegration/types.ts","../src/accountPaymentMethod/types.ts","../src/accountPaymentMethod/helpers.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/order/helpers.ts","../src/payment/types.ts","../src/payment/helpers.ts","../src/product/types.ts","../src/product/helpers.ts","../src/promotion/types.ts","../src/productAttribute/types.ts","../src/productCategory/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/types.ts","../src/fulfillment/helpers.ts","../src/geoZone/types.ts","../src/integrationDeliveryZone/types.ts"],"sourcesContent":["// shared-types/src/index.ts - Main exports for shared types package\n\n// Common types\nexport * from './common'\n\n// Entity-specific exports\nexport * from './account'\nexport * from './accountBranch'\nexport * from './accountDeliveryOption'\nexport * from './accountDomain'\nexport * from './accountIntegration'\nexport * from './accountPaymentMethod'\nexport * from './cart'\nexport * from './cartDeliveryMethod'\nexport * from './customer'\nexport * from './integration'\nexport * from './order'\nexport * from './orderDeliveryMethod'\nexport * from './payment'\nexport * from './product'\nexport * from './promotion'\nexport * from './productAttribute'\nexport * from './productCategory'\nexport * from './campaign'\nexport * from './standardCategory'\nexport * from './storeBanner'\nexport * from './storePage'\nexport * from './pubsub'\nexport * from './supportConversation'\nexport * from './fulfillment'\nexport * from './fulfillmentItem'\nexport * from './fulfillmentLabel'\nexport * from './storeCustomization'\nexport * from './geoZone'\nexport * from './integrationDeliveryZone'\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\";\n\nexport interface Account {\n id: string;\n name: string;\n slug: string;\n address?: string;\n logoId?: string;\n currency: string;\n priceFormatPattern: string;\n instagram?: string;\n facebook?: string;\n whatsapp?: string;\n phone?: string;\n email: string;\n timezone: string;\n hasDelivery: boolean;\n status: AccountStatus;\n themeConfig?: ThemeConfig;\n privateKey?: string;\n demo: boolean;\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date;\n\n priceFormat?: Intl.NumberFormatOptions;\n\n accountDomains?: AccountDomain[];\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 ","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 phone?: Phone | null;\n email?: string | null;\n demo:boolean;\n status: AccountBranchStatus; \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\tSHIPPING = \"SHIPPING\",\n\tPICKUP = \"PICKUP\",\n}\n\n/**\n * Entidad AccountDeliveryOption\n * Representa una opción de envío de una cuenta.\n */\n\nexport interface AccountDeliveryOption {\n\tid: string;\n\taccountId: string;\n\taccountBranchId: string;\n\tname: string;\n\taccountIntegrationId?: string;\n\tisScheduled: boolean;\n\tpriceLogic: AccountDeliveryOptionPriceLogic;\n\tstatus: AccountDeliveryOptionStatus;\n\tdeliveryType: DeliveryType;\n\tdemo:boolean;\n\thideAccountBranchAddress: boolean; // Si true, no se muestra la direccion de la sucursal en el checkout.\n\tcreatedAt: Date;\n\tupdatedAt: Date;\n\tdeletedAt?: Date | null;\n\tdata?: Record<string, unknown>\n\n\tdeliveryZones: AccountDeliveryOptionZone[];\n\tintegration?: AccountIntegration | null;\n\tprice?: number | null;\n\taccountBranch?: AccountBranch | null;\n}\n\nexport enum AccountDeliveryOptionPriceLogic {\n\tFIXED = \"FIXED\",\n\tCALCULATED = \"CALCULATED\",\n}\n\nexport enum AccountDeliveryOptionStatus {\n\tACTIVE = \"ACTIVE\",\n\tINACTIVE = \"INACTIVE\",\n}\n\nexport interface AccountDeliveryOptionCalculatedCost {\n\tbasePrice: number;\n\tdistanceKm: number;\n\tfinalPrice: number;\n\tpriceLogic: AccountDeliveryOptionPriceLogic;\n\tcurrency: string;\n}\n\n\nexport interface AccountDeliveryOptionZone {\n\tid: string;\n\taccountId: string;\n\taccountDeliveryOptionId: string;\n\tgeoZoneId: string;\n\tstatus: AccountDeliveryOptionZoneStatus;\n\tdemo: boolean;\n\tcreatedAt: Date;\n\tupdatedAt: Date;\n\tdeletedAt?: Date | null;\n\n\t// Relations\n\tgeoZone?: GeoZone;\n}\n\nexport enum AccountDeliveryOptionZoneStatus {\n\tACTIVE = \"ACTIVE\",\n\tINACTIVE = \"INACTIVE\",\n}\n\n// DTO Types for API operations\nexport interface DeliveryZoneInput {\n\tgeoZoneId?: string;\n\tgeoZone?: GeoZoneInput;\n}\n\nexport interface GeoZoneInput {\n\tname: string;\n\tarea: MapPosition[];\n\tdescription?: string;\n}\n\nexport interface CreateAccountDeliveryOptionDTO {\n\taccountId: string;\n\taccountBranchId: string;\n\tname: string;\n\taccountIntegrationId?: string | null;\n\tisScheduled?: boolean;\n\tpriceLogic?: AccountDeliveryOptionPriceLogic;\n\tprice?: number;\n\tstatus?: AccountDeliveryOptionStatus;\n\tdeliveryType: DeliveryType;\n\tdeliveryZones?: DeliveryZoneInput[];\n\tdata?: Record<string, unknown>;\n}\n\nexport interface UpdateAccountDeliveryOptionDTO {\n\taccountBranchId: string;\n\tname?: string;\n\taccountIntegrationId?: string | null;\n\tisScheduled?: boolean;\n\tpriceLogic?: AccountDeliveryOptionPriceLogic;\n\tstatus?: AccountDeliveryOptionStatus;\n\tdeliveryType?: DeliveryType;\n\tdeliveryZones?: DeliveryZoneInput[];\n\tdata?: Record<string, unknown>;\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 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 ","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 { StatusInfo } from \"../common/Status\";\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}","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}","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\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}\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}\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 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')\n\tname: string; // Human-readable name (e.g., \"Stripe\", \"Mercado Pago\")\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\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 items?: OrderItem[]\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\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\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 { StatusInfo } from '../common/Status'\nimport { OrderStatus, OrderPaymentStatus } from './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","// shared-types/src/payment/types.ts\n\nimport { Currency } from \"../common\";\nimport { AccountPaymentMethod } from \"../accountPaymentMethod\";\nimport { Order } from \"../order\";\nimport { StatusInfo } from \"../common/Status\";\n\n\nexport enum PaymentStatus {\n PENDING = 'PENDING', // Pendiente\n PREAUTHORIZED = 'PREAUTHORIZED',\n APPROVED = 'APPROVED', // Pago aprobado online\n PAID = 'PAID', // Pago realizado por redes fisicas\n REJECTED = 'REJECTED', // Pago rechazado\n REFUND_IN_PROCESS = 'REFUND_IN_PROCESS', // En proceso de reembolso con la plataforma de pagos\n PARTIAL_REFUND = 'PARTIAL_REFUND', // Pago parcialmente reembolsado\n REFUNDED = 'REFUNDED', // Pago reembolsado\n ERROR = 'ERROR' // Represents an error in porcessing the payment. Ex: a webhook comes without an esternal reference, so we can't match in our system\n}\n\nexport enum PaymentMethodType {\n BANK_TRANSFER = 'BANK_TRANSFER',\n CREDIT_CARD = 'CREDIT_CARD',\n DEBIT_CARD = 'DEBIT_CARD',\n MERCADOPAGO = 'MERCADOPAGO',\n PHYSICAL = 'PHYSICAL',\n INTERNATIONAL = 'INTERNATIONAL',\n PAYPAL = 'PAYPAL',\n CASH = 'CASH',\n OTHER = 'OTHER', // Added for flexibility\n}\nexport interface Payment {\n id: string;\n accountId: string;\n orderId: string;\n invoiceId?: string;\n accountPaymentMethodId?: string;\n accountIntegrationId?: string;\n referenceCode?: string;\n paymentMethodType?: PaymentMethodType;\n currency: Currency;\n amount: number;\n amountReceived: number;\n amountRefunded: number;\n paidAt?: string | Date;\n refundedAt?: string | Date;\n status: PaymentStatus;\n statusInfo?: StatusInfo;\n cardBrand?: string;\n cardBrandInfo?: PaymentCardBrand;\n cardLast4?: string;\n data?: Record<string, any>\n metadata?: Record<string, any>;\n internalComment?: string;\n demo: boolean;\n createdAt: string | Date;\n updatedAt: string | Date;\n deletedAt?: string | Date;\n\n accountPaymentMethod?: Partial<AccountPaymentMethod> | null; \n order?: Order;\n}\n\n// Provider-level types (entity-agnostic, reusable across projects)\nexport type PaymentProviderKey = 'MERCADOPAGO' | 'PLEXO' | 'MANUAL_PAYMENT';\n\n// TODO: Eventually refactor what is passed to the payment provider constructor, as it most likely just need\nexport interface PaymentProviderContext {\n data: Record<string, unknown>\n}\n\nexport interface PaymentProviderInitInput {\n // Arbitrary provider input. Caller builds this from their domain data\n data: Record<string, any>;\n}\n\nexport interface PaymentProviderInitOutput {\n data: Record<string, any>;\n status: PaymentStatus\n}\n\nexport interface PaymentProviderCaptureInput {\n data: Record<string, any>;\n}\n\nexport interface PaymentProviderCaptureOutput {\n data: Record<string, any>;\n}\n\nexport interface PaymentProviderRefundInput {\n amount: number;\n data: Record<string, any>;\n}\n\nexport interface PaymentProviderRefundOutput {\n data: Record<string, any>;\n}\n\nexport interface PaymentProviderWebhookResult {\n //TODO: Ideally, if later an order can have multiple payments, the way to link thrid party payments with our own payment entity, should be throu something like a \n // payment session in our system, that would be set as the external reference in the third party payment\n paymentId: string | null\n status: PaymentStatus\n data: Record<string, unknown>\n // TODO: Ideally i think this should live inside the data field, not have separate columns and just let the consumer know what\n // attributes to query to resolve them\n paymentDetails: {\n referenceCode?: string,\n method?: string,\n last4?: string\n }\n}\n\nexport interface WebhookPayload {\n // Id of payment provider webhook belongs to, to pass data for processing\n provider: string;\n accountId: string;\n payload: {\n query: Record<string, unknown>\n body: Record<string, unknown>\n headers: Record<string, unknown>\n }\n}\n\nexport enum PaymentCardBrandKey {\n mp_account_money = 'mp_account_money',\n master = 'master',\n debmaster = 'debmaster',\n visa = 'visa',\n debvisa = 'debvisa',\n diners = 'diners',\n oca = 'oca',\n lider = 'lider',\n amex = 'amex',\n redpagos = 'redpagos',\n abitab = 'abitab',\n}\n\nexport interface PaymentCardBrand {\n key: string;\n name: string;\n image: string;\n icon: string;\n}\n\nexport function getPaymentCardBrand(key: PaymentCardBrandKey): PaymentCardBrand {\n const map: Record<PaymentCardBrandKey, PaymentCardBrand> = {\n mp_account_money: {\n key: PaymentCardBrandKey.mp_account_money,\n name: 'Dinero en cuenta Mercado Pago',\n image: 'https://assets.retai.la/payments/mercadopago.png',\n icon: 'https://assets.retai.la/payments/mercadopago-ico.png',\n },\n master: {\n key: PaymentCardBrandKey.master,\n name: 'Mastercard',\n image: 'https://assets.retai.la/payments/master.png',\n icon: 'https://assets.retai.la/payments/master-ico.png',\n },\n debmaster: {\n key: PaymentCardBrandKey.master,\n name: 'Mastercard Débito',\n image: 'https://assets.retai.la/payments/master.png',\n icon: 'https://assets.retai.la/payments/master-ico.png',\n },\n visa: {\n key: PaymentCardBrandKey.visa,\n name: 'Visa',\n image: 'https://assets.retai.la/payments/visa.png',\n icon: 'https://assets.retai.la/payments/visa-ico.png',\n },\n debvisa: {\n key: PaymentCardBrandKey.visa,\n name: 'Visa Débito',\n image: 'https://assets.retai.la/payments/visa.png',\n icon: 'https://assets.retai.la/payments/visa-ico.png',\n },\n diners:{\n key: PaymentCardBrandKey.diners,\n name: 'Diners',\n image: 'https://assets.retai.la/payments/diners.png',\n icon: 'https://assets.retai.la/payments/diners-ico.png',\n },\n oca: {\n key: PaymentCardBrandKey.oca,\n name: 'Oca',\n image: 'https://assets.retai.la/payments/oca.png',\n icon: 'https://assets.retai.la/payments/oca-ico.png',\n },\n lider:{\n key: PaymentCardBrandKey.lider,\n name: 'Lider',\n image: 'https://assets.retai.la/payments/lider.png',\n icon: 'https://assets.retai.la/payments/lider-ico.png',\n },\n amex: {\n key: PaymentCardBrandKey.amex,\n name: 'American Express',\n image: 'https://assets.retai.la/payments/amex.png',\n icon: 'https://assets.retai.la/payments/amex-ico.png',\n },\n redpagos: {\n key: PaymentCardBrandKey.redpagos,\n name: 'Redpagos',\n image: 'https://assets.retai.la/payments/redpagos.png',\n icon: 'https://assets.retai.la/payments/redpagos-ico.png',\n },\n abitab:{\n key: PaymentCardBrandKey.abitab,\n name: 'Abitab',\n image: 'https://assets.retai.la/payments/abitab.png',\n icon: 'https://assets.retai.la/payments/abitab-ico.png',\n }\n }\n return map[key] || {\n key,\n name: '',\n image: null,\n }\n}\n\nexport interface PaymentProviderAdapter {\n readonly key: PaymentProviderKey;\n initPayment(input: PaymentProviderInitInput): Promise<PaymentProviderInitOutput>;\n capture(input: PaymentProviderCaptureInput): Promise<PaymentProviderCaptureOutput>\n refund(input: PaymentProviderRefundInput): Promise<PaymentProviderRefundOutput>;\n processWebhook(input: WebhookPayload['payload']): Promise<PaymentProviderWebhookResult>\n}","import { StatusInfo } from '../common/Status'\nimport { PaymentStatus } from './types'\n\nexport function getPaymentStatusInfo(status: PaymentStatus): StatusInfo {\n const map: Record<PaymentStatus, StatusInfo> = {\n PENDING: { text: 'Pago pendiente', class: 'warning', actionText: '' },\n PREAUTHORIZED: { text: 'Pago preautorizado', class: 'info', actionText: 'Preautorizar pago' },\n APPROVED: { text: 'Pago aprobado', class: 'success', actionText: 'Aprobar pago' },\n PAID: { text: 'Pago realizado', class: 'success', actionText: 'Pago realizado' },\n REJECTED: { text: 'Pago rechazado', class: 'danger', actionText: 'Rechazar pago' },\n REFUND_IN_PROCESS: { text: 'Pago en proceso de reembolso', class: 'warning', actionText: 'Reembolsar pago' },\n PARTIAL_REFUND: { text: 'Pago parcialmente reembolsado', class: 'warning', actionText: 'Reembolsar pago' },\n REFUNDED: { text: 'Pago reembolsado', class: 'success', actionText: 'Reembolsado' },\n ERROR: { text: 'Error en pago', class: 'danger', actionText: 'Error en pago' },\n }\n\n return map[status] ?? { text: String(status), class: 'secondary' }\n}\n","import { Media } from \"../common\";\nimport { StatusInfo } from \"../common/Status\";\nimport { ProductCategory } from \"../productCategory\";\n\n/**\n * Entidad Product\n * Representa un producto vendible en la tienda. Es la entidad base que puede tener múltiples variantes.\n */\n\nexport interface Product {\n id: string;\n accountId: string;\n code: string;\n brandId?: string | null;\n supplierId?: string | null;\n productType: ProductType;\n sku?: string | null;\n barcode?: string | null;\n name: string; // e.g., \"Zapatos\", \"Pantalones\", \"Camisas\"\n slug: string;\n description?: string | null;\n isFeatured: boolean;\n\n // Inventory & Shipping\n allowBackorder: boolean; // Permite realizar pedidos aunque no haya stock disponible. Se aplica a las variantes si no está definido allí\n weight?: number | null;\n weightUnit?: string | null; // e.g., \"kg\"\n height?: number | null;\n width?: number | null;\n depth?: number | null; \n dimensionUnit?: string | null; // e.g., \"cm\"\n shippingLeadTime?: string | null; // e.g., \"1-3 days\"\n\n status: ProductStatus; // ACTIVE, INACTIVE\n statusInfo?: StatusInfo;\n \n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n\n media?: Media[]\n\n variants?: ProductVariant[];\n categories?: ProductCategory[];\n}\n\nexport enum ProductStatus {\n ACTIVE = 'ACTIVE', // Available for sale\n INACTIVE = 'INACTIVE', // Not visible/purchasable\n ARCHIVED = 'ARCHIVED', // Not visible, kept for records\n DRAFT = 'DRAFT', // Incomplete product setup\n}\n\nexport enum ProductType {\n SIMPLE = 'SIMPLE', // Product without variants (may have a default hidden variant)\n VARIABLE = 'VARIABLE', // Product with distinct variants (color, size, etc.)\n BUNDLE = 'BUNDLE', // A package of other products/variants\n GIFT_CARD = 'GIFT_CARD', // Virtual or physical gift card\n}\n\n\nexport interface ProductVariant {\n id: string;\n accountId: string;\n productId: string;\n\n sku?: string | null;\n barcode?: string | null; // EAN, UPC, etc.\n\n // Pricing\n currency: string; // ISO 4217 currency code\n price: number;\n compareAtPrice?: number;\n allowBackorder?: boolean;\n \n // Inventory & Shipping\n stock: number;\n weight?: number | null;\n weightUnit?: string | null;\n height?: number | null;\n width?: number | null;\n depth?: number | null;\n dimensionUnit?: string | null;\n shippingLeadTime?: string | null; // e.g., \"1-3 days\"\n \n order: number;\n\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date;\n\n}","import { StatusInfo } from \"../common/Status\";\nimport { ProductStatus } from \"./types\";\n\nexport function getProductStatusInfo(status: ProductStatus): StatusInfo {\n\tconst map: Record<ProductStatus, StatusInfo> = {\n\t\tACTIVE: { text: 'Activo', class: 'success' },\n\t\tINACTIVE: { text: 'Inactivo', class: 'danger' },\n\t\tARCHIVED: { text: 'Archivado', class: 'secondary' },\n\t\tDRAFT: { text: 'Borrador', class: 'secondary' },\n\t};\n\n\treturn map[status] ?? { text: String(status), class: 'secondary' };\n}","/**\n * Promotion Module Types\n * Types for the promotion system including promotions, rules, application methods, and adjustments\n */\n\n// ============================================================================\n// Promotion Core Types\n// ============================================================================\n\n/**\n * Main promotion entity that defines discount rules and metadata\n */\nexport interface Promotion {\n id: string\n accountId: string\n code: string // Unique identifier within account, also serves as coupon code\n type: PromotionType\n isAutomatic: boolean // true = auto-apply, false = requires code\n isStackable: boolean // true = can be combined with other stackable promotions, false = cannot be combined\n campaignId?: string | null // Optional: Group promotions under campaigns\n name: string\n description?: string | null\n status: PromotionStatus\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\nexport enum PromotionType {\n STANDARD = 'standard',\n}\n\nexport enum PromotionStatus {\n ACTIVE = 'active',\n INACTIVE = 'inactive',\n}\n\n// ============================================================================\n// Promotion Rule Types\n// ============================================================================\n\n/**\n * Reusable rule entity that can be attached to either Promotions (cart/order level)\n * or ApplicationMethods (target level)\n */\nexport interface PromotionRule {\n id: string\n accountId: string\n ruleAttribute: string // e.g., \"subtotal\", \"item_count\", \"customer_id\", \"product_id\", \"category_id\"\n ruleOperator: PromotionRuleOperator\n createdAt: Date\n updatedAt: Date\n}\n\nexport enum PromotionRuleOperator {\n GT = 'gt', // greater than\n GTE = 'gte', // greater than or equal\n LT = 'lt', // less than\n LTE = 'lte', // less than or equal\n EQ = 'eq', // equals\n IN = 'in', // in array\n NIN = 'nin', // not in array\n}\n\n/**\n * Stores the values that a PromotionRule is evaluated against\n */\nexport interface PromotionRuleValue {\n id: string\n promotionRuleId: string\n value: string // Flexible string value (can represent numbers, UUIDs, etc.)\n createdAt: Date\n updatedAt: Date\n}\n\n// ============================================================================\n// Pivot Tables - Promotion Rules\n// ============================================================================\n\n/**\n * Many-to-many relationship between Promotion and PromotionRule for cart/order-level rules\n */\nexport interface PromotionPromotionRule {\n promotionId: string\n promotionRuleId: string\n}\n\n/**\n * Many-to-many relationship between PromotionApplicationMethod and PromotionRule for target-level rules\n */\nexport interface PromotionApplicationMethodPromotionRule {\n applicationMethodId: string\n promotionRuleId: string\n}\n\n// ============================================================================\n// Application Method Types\n// ============================================================================\n\n/**\n * Defines how the promotion discount is applied\n */\nexport interface PromotionApplicationMethod {\n id: string\n accountId: string\n promotionId: string // 1-to-1 relationship with Promotion\n targetType: PromotionTargetType\n applicationType: PromotionApplicationType\n value: number // Discount value\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\nexport enum PromotionTargetType {\n ITEMS = 'items', // apply to cart/order line items\n SHIPPING = 'shipping', // apply to cart/order delivery methods\n ORDER = 'order', // apply to order total\n}\n\nexport enum PromotionApplicationType {\n PERCENTAGE = 'percentage', // e.g., 10% off\n FIXED = 'fixed', // e.g., $5 off\n}\n\n// ============================================================================\n// Cart Adjustment Types\n// ============================================================================\n\n/**\n * Tracks promotion adjustments applied to individual cart items\n */\nexport interface CartLineItemAdjustment {\n id: string\n accountId: string\n cartItemId: string\n promotionId?: string | null\n description: string // e.g., \"10% off Summer Sale\"\n code?: string | null // Promotion code if applicable\n amount: number // Discount amount (always positive)\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\n/**\n * Tracks promotion adjustments applied to cart delivery methods\n */\nexport interface CartDeliveryMethodAdjustment {\n id: string\n accountId: string\n cartDeliveryMethodId: string\n promotionId?: string | null\n description: string\n code?: string | null\n amount: number\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\n/**\n * Links carts to applied promotions for easy querying (pivot table)\n */\nexport interface CartPromotion {\n cartId: string\n promotionId: string\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\n// ============================================================================\n// Order Adjustment Types\n// ============================================================================\n\n/**\n * Tracks promotion adjustments on order items (snapshot from cart)\n */\nexport interface OrderLineItemAdjustment {\n id: string\n accountId: string\n orderItemId: string\n promotionId?: string | null\n description: string\n code?: string | null\n amount: number\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\n/**\n * Tracks promotion adjustments on order delivery methods\n */\nexport interface OrderDeliveryMethodAdjustment {\n id: string\n accountId: string\n orderDeliveryMethodId: string\n promotionId?: string | null\n description: string\n code?: string | null\n amount: number\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\n/**\n * Links orders to applied promotions for easy querying (pivot table, snapshot from cart)\n */\nexport interface OrderPromotion {\n orderId: string\n promotionId: string\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\n// ============================================================================\n// DTOs y contratos de API/Front\n// ============================================================================\n\nexport interface PromotionRuleInput {\n ruleAttribute: string\n ruleOperator: PromotionRuleOperator\n values: string[]\n}\n\nexport interface PromotionApplicationMethodInput {\n targetType: PromotionTargetType\n applicationType: PromotionApplicationType\n value: number\n}\n\nexport interface CreatePromotionDTO {\n name: string\n description?: string | null\n code?: string | null\n isAutomatic: boolean\n isStackable?: boolean\n status: PromotionStatus\n type?: PromotionType\n campaignId?: string | null\n promotionRules?: PromotionRuleInput[]\n targetRules?: PromotionRuleInput[]\n applicationMethod: PromotionApplicationMethodInput\n}\n\nexport interface UpdatePromotionDTO extends Partial<CreatePromotionDTO> {\n id: string\n}\n\nexport interface PromotionListFilters {\n page?: number\n limit?: number\n search?: string | null\n status?: PromotionStatus | null\n isAutomatic?: boolean | null\n}\n","/**\n * Entidad ProductAttribute\n * Define los atributos disponibles que se pueden asignar a las variantes de producto (ej. Color, Talla).\n * Especifica el nombre y tipo del atributo para ayudar en la representación y filtrado.\n */\n\nimport { ProductCategory } from \"../productCategory/types\";\n\nexport interface ProductAttribute {\n id: string;\n accountId: string;\n name: string; // e.g., \"Color de zapatos\", \"Talle de pantalones\", \"Material\"\n alias: string; // e.g., \"Color\", \"Talla\", \"Material\"\n slug: string;\n type: ProductAttributeType; // Helps frontend render appropriate controls\n isRequired: boolean; // isRequired for product variant\n suffix: string; // suffix for number type\n status: ProductAttributeStatus; // ACTIVE, INACTIVE\n \n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n\n // dejo las categorias planas y los links de la tabla pivot por si necesito acceder a ellas\n productCategories: ProductCategory[]; // conveniente\n productCategoryLinks: Array<{ categoryId: string; isRequired: boolean; displayOrder: number }>;\n\n options: ProductAttributeOption[];\n displayOrder: number; // order to display the attribute in the frontend\n}\n\nexport enum ProductAttributeStatus {\n ACTIVE = 'ACTIVE',\n INACTIVE = 'INACTIVE',\n}\n\n\nexport enum ProductAttributeType {\n TEXT = 'TEXT', // text input\n NUMBER = 'NUMBER', // number input\n COLOR = 'COLOR', // Special type for color swatches\n SELECT = 'SELECT', // Dropdown list\n BOOLEAN = 'BOOLEAN', // checkbox input\n}\n\n/**\n * Una opción específica para un atributo (ej. \"Talle 42\" para el atributo \"Talle\").\n */\nexport interface ProductAttributeOption {\n id: string;\n accountId: string;\n productAttributeId: string;\n value: string;\n imageId?: string | null;\n order: number;\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n\n count: number; // number of options\n}","import { StandardCategory } from \"../standardCategory\";\n\n/**\n * Entidad ProductCategory\n * Define las categorías de productos.\n * Soporta una estructura jerárquica (categorías y subcategorías) mediante el campo parentId.\n * Cada categoría debe estar asociada a una categoría estándar del sistema.\n */\n\nexport interface ProductCategory {\n id: string;\n accountId: string;\n parentId?: string;\n standardCategoryId: string | null;\n name: string; // e.g., \"Zapatos\", \"Pantalones\", \"Camisas\"\n slug: string;\n description?: string;\n imageId?: string | null;\n order: number;\n isFeatured: boolean;\n status: ProductCategoryStatus; // ACTIVE, INACTIVE\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n\n children: ProductCategory[];\n parent: ProductCategory | null;\n standardCategory: StandardCategory;\n}\n\n\nexport enum ProductCategoryStatus {\n ACTIVE = 'ACTIVE',\n INACTIVE = 'INACTIVE',\n}\n\n","// shared-types/src/campaign/types.ts\n// Campaign core types aligned with DB entities\n\nexport enum CampaignStatus {\n ACTIVE = 'active',\n INACTIVE = 'inactive',\n}\n\nexport interface Campaign {\n id: string\n accountId: string\n name: string\n description?: string | null\n startDate?: Date | null\n endDate?: Date | null\n status: CampaignStatus\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\nexport enum CampaignBudgetType {\n USAGE = 'usage',\n SPEND = 'spend',\n USAGE_BY_ATTRIBUTE = 'usage_by_attribute',\n SPEND_BY_ATTRIBUTE = 'spend_by_attribute',\n}\n\nexport interface CampaignBudget {\n id: string\n accountId: string\n campaignId: string\n type: CampaignBudgetType\n limit?: number | null\n used: number\n attribute?: string | null\n createdAt: Date\n updatedAt: Date\n deletedAt?: Date | null\n}\n\nexport interface CampaignBudgetUsage {\n id: string\n campaignBudgetId: string\n attributeValue: string\n used: number\n createdAt: Date\n updatedAt: Date\n}\n\n","/**\n * Entidad StandardCategory\n * Define las categorías estándar de productos.\n * Estas categorías estan pensadas para unificar o agrupar productos de diferentes cuentas.\n */\n\nexport interface StandardCategory {\n id: string;\n parentId?: string;\n name: string; // e.g., \"Zapatos\", \"Pantalones\", \"Camisas\"\n slug: string;\n description?: string;\n imageId?: string | null;\n order: number;\n status: StandardCategoryStatus; // ACTIVE, INACTIVE\n metadata?: {\n icon?: string;\n displayInMenu?: boolean;\n seoTitle?: string;\n seoDescription?: string;\n attributes?: string[];\n };\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n\n children: StandardCategory[];\n parent: StandardCategory | null;\n}\n\nexport enum StandardCategoryStatus {\n ACTIVE = 'ACTIVE',\n INACTIVE = 'INACTIVE'\n}\n\n","/**\n * Entidad StoreBanner\n * Banners para la portada de la web de la tienda\n */\n\nimport { Media } from \"../common\";\n\nexport interface StoreBanner {\n id: string;\n accountId: string;\n title: string;\n desktopMediaId: string;\n mobileMediaId?: string | null;\n linkUrl?: string | null;\n altText?: string | null;\n displayOrder: number;\n startDate?: Date | null;\n endDate?: Date | null;\n status: StoreBannerStatus;\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n\n // Relationships\n desktopMedia?: Partial<Media> | null;\n mobileMedia?: Partial<Media> | null;\n}\n\nexport enum StoreBannerStatus {\n ACTIVE = \"ACTIVE\",\n INACTIVE = \"INACTIVE\"\n}\n\n ","/**\n * Entidad StorePage\n * Páginas de la web de la tienda\n */\n\nexport interface StorePage {\n id: string;\n accountId: string;\n type: StorePageType;\n title: string;\n slug: string;\n content?: string | null;\n seoTitle?: string | null;\n seoDescription?: string | null;\n \n status: StorePageStatus;\n canDelete: boolean;\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n}\n\nexport enum StorePageStatus {\n PUBLISHED = 'PUBLISHED',\n DRAFT = 'DRAFT',\n ARCHIVED = 'ARCHIVED',\n}\n\nexport enum StorePageType {\n ABOUT_US = 'ABOUT_US',\n CONTACT = 'CONTACT',\n FAQ = 'FAQ',\n TERMS_AND_CONDITIONS = 'TERMS_AND_CONDITIONS',\n PRIVACY_POLICY = 'PRIVACY_POLICY',\n RETURN_POLICY = 'RETURN_POLICY',\n SHIPPING_POLICY = 'SHIPPING_POLICY',\n BRANCHES = 'BRANCHES',\n JOBS = 'JOBS',\n OTHER = 'OTHER',\n}\n\n\n ","export enum PubSubTopics {\n ORDER_PLACED = 'order-placed',\n ORDER_CONFIRMED = 'order-confirmed',\n ORDER_PROCESSING = 'order-processing',\n ORDER_PROCESSED = 'order-processed',\n ORDER_COMPLETED = 'order-completed',\n ORDER_CANCELLED = 'order-cancelled',\n PAYMENT_PAID = 'payment-paid',\n NOTIFICATION_CREATED = 'notification-created',\n }","import { Account } from \"../account/types\";\nimport { Customer } from \"../customer/types\";\n\n\n// origen principal del hilo de conversación\nexport enum SupportConversationChannel {\n\tWEB = 'WEB',\n\tEMAIL = 'EMAIL',\n\tWHATSAPP = 'WHATSAPP'\n}\n\n// quién puede ver el hilo en el tenant\nexport enum SupportConversationVisibility {\n\tINTERNAL = 'INTERNAL',\n\tMERCHANT = 'MERCHANT'\n}\n\nexport enum SupportConversationPriority {\n\tLOW = 'LOW',\n\tMEDIUM = 'MEDIUM',\n\tHIGH = 'HIGH',\n\tURGENT = 'URGENT'\n}\n\nexport enum SupportConversationStatus {\n\tOPEN = 'OPEN',\n\tCLOSED = 'CLOSED',\n\tPENDING = 'PENDING'\n}\n\nexport enum SupportConversationMessageDeliveryStatus {\n\tQUEUED = 'QUEUED',\n\tSENT = 'SENT',\n\tDELIVERED = 'DELIVERED',\n\tREAD = 'READ',\n\tFAILED = 'FAILED'\n}\n\nexport enum SupportConversationMessageAiAnalysisStatus {\n\tPENDING = 'PENDING',\n\tPROCESSING = 'PROCESSING',\n\tCOMPLETED = 'COMPLETED',\n\tFAILED = 'FAILED'\n}\n\n// Dirección del mensaje con respecto al sistema: entrante o saliente\nexport enum SupportConversationMessageDirection {\n\tINBOUND = 'INBOUND',\n\tOUTBOUND = 'OUTBOUND'\n }\n \n // Tipo de emisor del mensaje\n export enum SupportConversationMessageSenderType {\n\tCUSTOMER = 'CUSTOMER',\n\tACCOUNT_USER = 'ACCOUNT_USER',\n\tANONYMOUS = 'ANONYMOUS',\n\tSYSTEM = 'SYSTEM',\n\tAI = 'AI'\n }\n\nexport interface SupportConversation {\n\tid: string;\n\taccountId: string;\n\tsubject?: string | null; // Asunto opcional del hilo (para email o contacto web)\n\tchannel: SupportConversationChannel; // Canal principal de la conversación (email/whatsapp/web, etc.)\n\tassigneeId?: string | null; // Asignación interna (agente/usuario de la cuenta que atiende la conversación)\n\tvisibility: SupportConversationVisibility;\n\tpriority: SupportConversationPriority; // Priorización operativa\n\trequiresMerchantAction: boolean; // Indica si el comercio debe responder o tomar acción\n\trequiresInternalAction: boolean; // Indica si el equipo interno debe intervenir (respuesta, etc.)\n\tcustomerId?: string | null; // Identificador del cliente si está registrado en el sistema\n\tcustomerName?: string | null; // Nombre del contacto (snapshot, no necesariamente el del Customer)\n\tcustomerLastname?: string | null; // Apellido del contacto (snapshot)\n\tcustomerEmail?: string | null; // Email del contacto (snapshot)\n\tcustomerPhone?: string | null; // Teléfono del contacto (snapshot)\n\tstatus: SupportConversationStatus; // Estado simple (string para mantenerlo liviano)\n\tlastMessageAt?: Date | null;\n\tunreadForAgent: number; // Mensajes no leídos por el agente interno\n\tunreadForCustomer: number; // Mensajes no leídos por el cliente/comercio\n\tmetadata?: Object | null; // Metadatos flexibles (headers email, ids de chat, etc.)\n\taiSuggestion?: Object | null; // Sugerencias/Resumen asistidos por IA\n\tcreatedAt: Date;\n\tupdatedAt: Date;\n\tdeletedAt?: Date | null;\n\n\taccount: Account;\n\t// assignee: AccountUser | null;\n\tcustomer: Customer | null;\n\tmessages: SupportConversationMessage[];\n}\n\n\nexport interface SupportConversationMessage {\n id: string;\n accountId: string;\n conversationId: string;\n direction: SupportConversationMessageDirection; // Dirección simple (entrante/saliente)\n senderType: SupportConversationMessageSenderType; // Tipo de emisor del mensaje (cliente, usuario interno, anónimo, sistema o IA)\n senderId?: string | null; // Identificador del emisor cuando aplica (Customer o AccountUser). Puede ser null para anónimos, sistema o IA\n body: string;\n isAiGenerated: boolean;\n isSystem: boolean;\n deliveryStatus: SupportConversationMessageDeliveryStatus; // Estado de entrega (para OUTBOUND). Por defecto QUEUED para ser enviado por el canal.\n requiresAiAnalysis: boolean;\n aiAnalysisStatus: SupportConversationMessageAiAnalysisStatus;\n aiAnalyzedAt?: Date | null;\n externalMessageId?: string | null; // Identificadores de proveedor externo (messageId, threadId)\n externalThreadId?: string | null;\n attachments?: Array<{\n url: string;\n type?: string;\n name?: string;\n sizeBytes?: number;\n }>; // Adjuntos simples (urls o descriptores livianos) \n metadata?: Object | null; // Metadatos flexibles (headers, payloads originales, etc.)\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n}\n","import { Webhook } from \"../common/Webhook\";\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 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 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 // Pickup locations for PICKUP delivery type options\n pickupLocations?: PickupLocation[]\n [key: string]: unknown\n}\n\n// Pickup Location types\nexport interface PickupLocation {\n id: string;\n name: string;\n address: {\n street: string;\n city: string;\n state: string;\n postalCode?: string;\n };\n coordinates?: {\n latitude: number;\n longitude: number;\n };\n hours?: string;\n phone?: string;\n additionalInfo?: Record<string, unknown>;\n}\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\nexport type FulfillmentRecollectionConfig = {\n mode: FulfillmentRecollectionMode;\n scheduledDateTime?: Date; // Required when allowsScheduling=true and mode includes recollection\n recollectionAddress?: {\n street: string;\n city: string;\n state: string;\n };\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}\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}\n\n// Provider-level types (entity-agnostic, reusable across projects)\nexport type FulfillmentProviderKey = 'MANUAL_FULFILLMENT' | 'DAC';\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 getRecollectionCapabilities(): Promise<FulfillmentRecollectionCapabilities>;\n // Create fulfillment with third-party provider\n createFulfillment(input: FulfillmentProviderCreateInput): Promise<FulfillmentProviderCreateOutput>;\n processWebhook(input: FulfillmentProviderProcessWebhookInput): Promise<FulfillmentProviderProcessWebhookOutput | null>\n // cancel(input: FulfillmentProviderCancelInput): Promise<FulfillmentProviderCancelOutput>;\n}","import { StatusInfo } from \"../common/Status\";\nimport { FulfillmentStatus } from \"./types\";\n\nexport function getFulfillmentStatusInfo(status: FulfillmentStatus): StatusInfo {\n\tconst map: Record<FulfillmentStatus, StatusInfo> = {\n\t\tpending: { text: 'Paquete listo', class: 'warning', actionText: '' },\n\t\tshipped: { text: 'Enviado', class: 'warning', actionText: 'Enviado' },\n\t\tdelivered: { text: 'Entregado', class: 'success', actionText: 'Entregado' },\n\t\tcancelled: { text: 'Cancelado', class: 'danger', actionText: 'Cancelado' },\n\t};\n\n\treturn map[status] ?? { text: String(status), class: 'secondary' };\n}","/**\n * GeoZone types\n * Define zonas geográficas reutilizables que pueden ser referenciadas por otras entidades.\n */\n\nimport { MapPosition } from \"../common\";\n\nexport interface GeoZone {\n id: string;\n name: string;\n description?: string;\n accountId?: string | null; // null for system-wide zones (admin/integration created)\n area: MapPosition[]; // Spatial geometry polygon\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n}\n\nexport enum GeoZoneStatus {\n ACTIVE = \"ACTIVE\",\n INACTIVE = \"INACTIVE\",\n}","import { GeoZone } from \"../geoZone\";\nimport { Integration } from \"../integration\";\n\n/**\n * IntegrationDeliveryZone types\n * Define las zonas de entrega permitidas para cada integración de fulfillment provider.\n */\n\nexport interface IntegrationDeliveryZone {\n id: string;\n integrationId: string;\n geoZoneId: string;\n createdAt: Date;\n updatedAt: Date;\n deletedAt?: Date | null;\n\n // Relations\n integration?: Integration;\n geoZone?: GeoZone;\n}\n\nexport enum IntegrationDeliveryZoneStatus {\n ACTIVE = \"ACTIVE\",\n INACTIVE = \"INACTIVE\",\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACqBO,IAAK,YAAL,kBAAKA,eAAL;AACL,EAAAA,WAAA,WAAQ;AACR,EAAAA,WAAA,WAAQ;AACR,EAAAA,WAAA,aAAU;AACV,EAAAA,WAAA,cAAW;AACX,EAAAA,WAAA,WAAQ;AACR,EAAAA,WAAA,aAAU;AACV,EAAAA,WAAA,WAAQ;AAPE,SAAAA;AAAA,GAAA;;;ACrBL,IAAK,WAAL,kBAAKC,cAAL;AACL,EAAAA,UAAA,SAAM;AACN,EAAAA,UAAA,SAAM;AACN,EAAAA,UAAA,SAAM;AACN,EAAAA,UAAA,SAAM;AACN,EAAAA,UAAA,SAAM;AACN,EAAAA,U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AA;AAAA,GAAA;;;AC9CP,IAAK,oBAAL,kBAAKC,uBAAL;AACH,EAAAA,mBAAA,aAAU;AACV,EAAAA,mBAAA,aAAU;AACV,EAAAA,mBAAA,eAAY;AACZ,EAAAA,mBAAA,eAAY;AAJJ,SAAAA;AAAA,GAAA;;;ACHL,SAAS,yBAAyB,QAAuC;AAC/E,QAAM,MAA6C;AAAA,IAClD,SAAS,EAAE,MAAM,iBAAiB,OAAO,WAAW,YAAY,GAAG;AAAA,IACnE,SAAS,EAAE,MAAM,WAAW,OAAO,WAAW,YAAY,UAAU;AAAA,IACpE,WAAW,EAAE,MAAM,aAAa,OAAO,WAAW,YAAY,YAAY;AAAA,IAC1E,WAAW,EAAE,MAAM,aAAa,OAAO,UAAU,YAAY,YAAY;AAAA,EAC1E;AAEA,SAAO,IAAI,MAAM,KAAK,EAAE,MAAM,OAAO,MAAM,GAAG,OAAO,YAAY;AAClE;;;ACMO,IAAK,gBAAL,kBAAKC,mBAAL;AACH,EAAAA,eAAA,YAAS;AACT,EAAAA,eAAA,cAAW;AAFH,SAAAA;AAAA,GAAA;;;ACGL,IAAK,gCAAL,kBAAKC,mCAAL;AACH,EAAAA,+BAAA,YAAS;AACT,EAAAA,+BAAA,cAAW;AAFH,SAAAA;AAAA,GAAA;","names":["MediaType","Currency","DayOfWeek","AccountStatus","AccountBranchStatus","AccountBranchScheduleStatus","AccountBranchScheduleDay","DeliveryType","AccountDeliveryOptionPriceLogic","AccountDeliveryOptionStatus","AccountDeliveryOptionZoneStatus","AccountDomainStatus","AccountIntegrationStatus","AccountIntegrationConnectionStatus","AccountIntegrationEnvironment","AccountPaymentMethodStatus","CartStatus","CartSource","CartDeliveryType","CartItemErrorCode","CustomerStatus","IntegrationCategory","IntegrationStatus","OrderStatus","OrderPaymentStatus","OrderSource","OrderDeliveryType","PaymentStatus","PaymentMethodType","PaymentCardBrandKey","ProductStatus","ProductType","PromotionType","PromotionStatus","PromotionRuleOperator","PromotionTargetType","PromotionApplicationType","ProductAttributeStatus","ProductAttributeType","ProductCategoryStatus","CampaignStatus","CampaignBudgetType","StandardCategoryStatus","StoreBannerStatus","StorePageStatus","StorePageType","PubSubTopics","SupportConversationChannel","SupportConversationVisibility","SupportConversationPriority","SupportConversationStatus","SupportConversationMessageDeliveryStatus","SupportConversationMessageAiAnalysisStatus","SupportConversationMessageDirection","SupportConversationMessageSenderType","FulfillmentStatus","GeoZoneStatus","IntegrationDeliveryZoneStatus"]}
package/dist/index.mjs CHANGED
@@ -347,6 +347,17 @@ function getOrderStatusInfo(status) {
347
347
  };
348
348
  return map[status] ?? { text: String(status), class: "secondary" };
349
349
  }
350
+ function getOrderPaymentStatusInfo(status) {
351
+ const map = {
352
+ PENDING: { text: "Pago pendiente", class: "warning", actionText: "" },
353
+ PARTIAL: { text: "Pago parcial", class: "info", actionText: "" },
354
+ PAID: { text: "Pago completo", class: "success", actionText: "" },
355
+ OVERPAID: { text: "Pago excedido", class: "info", actionText: "" },
356
+ REFUNDED: { text: "Reembolsado", class: "success", actionText: "" },
357
+ PARTIALLY_REFUNDED: { text: "Parcialmente reembolsado", class: "warning", actionText: "" }
358
+ };
359
+ return map[status] ?? { text: String(status), class: "secondary" };
360
+ }
350
361
 
351
362
  // src/payment/types.ts
352
363
  var PaymentStatus = /* @__PURE__ */ ((PaymentStatus2) => {
@@ -560,6 +571,20 @@ var ProductCategoryStatus = /* @__PURE__ */ ((ProductCategoryStatus2) => {
560
571
  return ProductCategoryStatus2;
561
572
  })(ProductCategoryStatus || {});
562
573
 
574
+ // src/campaign/types.ts
575
+ var CampaignStatus = /* @__PURE__ */ ((CampaignStatus2) => {
576
+ CampaignStatus2["ACTIVE"] = "active";
577
+ CampaignStatus2["INACTIVE"] = "inactive";
578
+ return CampaignStatus2;
579
+ })(CampaignStatus || {});
580
+ var CampaignBudgetType = /* @__PURE__ */ ((CampaignBudgetType2) => {
581
+ CampaignBudgetType2["USAGE"] = "usage";
582
+ CampaignBudgetType2["SPEND"] = "spend";
583
+ CampaignBudgetType2["USAGE_BY_ATTRIBUTE"] = "usage_by_attribute";
584
+ CampaignBudgetType2["SPEND_BY_ATTRIBUTE"] = "spend_by_attribute";
585
+ return CampaignBudgetType2;
586
+ })(CampaignBudgetType || {});
587
+
563
588
  // src/standardCategory/types.ts
564
589
  var StandardCategoryStatus = /* @__PURE__ */ ((StandardCategoryStatus2) => {
565
590
  StandardCategoryStatus2["ACTIVE"] = "ACTIVE";
@@ -708,6 +733,8 @@ export {
708
733
  AccountIntegrationStatus,
709
734
  AccountPaymentMethodStatus,
710
735
  AccountStatus,
736
+ CampaignBudgetType,
737
+ CampaignStatus,
711
738
  CartDeliveryType,
712
739
  CartItemErrorCode,
713
740
  CartSource,
@@ -756,6 +783,7 @@ export {
756
783
  getCurrencySymbol,
757
784
  getFulfillmentStatusInfo,
758
785
  getIntegrationCategoryName,
786
+ getOrderPaymentStatusInfo,
759
787
  getOrderStatusInfo,
760
788
  getPaymentCardBrand,
761
789
  getPaymentStatusInfo,