@azzas/azzas-tracker-web 1.0.72 → 1.0.73
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/README.md +130 -130
- package/dist/mod.cjs +4 -7
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.d.cts +0 -0
- package/dist/mod.d.ts +0 -0
- package/dist/mod.global.js +4 -7
- package/dist/mod.global.js.map +1 -1
- package/dist/mod.js +4 -7
- package/dist/mod.js.map +1 -1
- package/dist/mod.vtex.global.js +39 -40
- package/package.json +38 -38
package/dist/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/constants.ts","../src/adapters/datalayer.ts","../src/core/utils.ts","../src/adapters/dito.ts","../src/adapters/index.ts","../src/params/utils/index.ts","../src/params/resolvers/brand/fromOrderForm.ts","../src/params/resolvers/brand/fromItem.ts","../src/params/brand.ts","../src/params/resolvers/items/fromOrderForm.ts","../src/params/resolvers/items/fromItem.ts","../src/params/resolvers/items/fromList.ts","../src/params/resolvers/items/fromPdp.ts","../src/params/resolvers/items/fromBanner.ts","../src/params/items.ts","../src/params/resolvers/paymentType/fromOrderForm.ts","../src/params/resolvers/paymentType/fromOrderGroup.ts","../src/params/paymentType.ts","../src/params/index.ts","../src/formatter/index.ts","../src/index.ts"],"sourcesContent":["export const EVENTS = {\r\n CUSTOM_VIEW_CART: {\r\n name: \"custom_view_cart\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\r\n \"brand\",\r\n \"region\",\r\n \"line_items\",\r\n \"currency\",\r\n \"value\",\r\n \"total_discount\",\r\n \"subtotal\",\r\n \"items\",\r\n ],\r\n },\r\n\r\n ADD_TO_WISHLIST: {\r\n name: \"add_to_wishlist\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\r\n \"brand\",\r\n \"region\",\r\n \"line_items\",\r\n \"currency\",\r\n \"value\",\r\n \"items\",\r\n ],\r\n },\r\n\r\n ADD_TO_CART: {\r\n name: \"add_to_cart\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\r\n \"brand\",\r\n \"region\",\r\n \"line_items\",\r\n \"currency\",\r\n \"value\",\r\n \"items\",\r\n ],\r\n },\r\n\r\n REMOVE_FROM_CART: {\r\n name: \"remove_from_cart\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\r\n \"brand\",\r\n \"region\",\r\n \"line_items\",\r\n \"currency\",\r\n \"value\",\r\n \"items\",\r\n ],\r\n },\r\n\r\n ADD_COUPON: {\r\n name: \"add_coupon\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\r\n \"brand\",\r\n \"region\",\r\n \"coupon\",\r\n \"coupon_message\",\r\n \"seller_cod_name\",\r\n ],\r\n },\r\n\r\n SEARCH: {\r\n name: \"search\",\r\n hasEcommerce: false,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\"brand\", \"search_term\", \"search_found\", \"search_quantity\"],\r\n },\r\n\r\n SEARCH_ZIPCODE: {\r\n name: 'search_zipcode',\r\n hasEcommerce: false,\r\n destinations: ['DataLayer'],\r\n requiredParams: ['brand', 'region', 'shippings', 'zipcode', 'flag_pickup'],\r\n },\r\n\r\n VIEW_PROMOTION: {\r\n name: \"view_promotion\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\r\n \"brand\",\r\n \"region\",\r\n \"currency\",\r\n \"promotion_name\",\r\n \"creative_slot\",\r\n \"creative_name\",\r\n \"items\",\r\n ],\r\n },\r\n\r\n SELECT_PROMOTION: {\r\n name: \"select_promotion\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\r\n \"brand\",\r\n \"region\",\r\n \"currency\",\r\n \"promotion_name\",\r\n \"creative_slot\",\r\n \"creative_name\",\r\n \"items\",\r\n ],\r\n },\r\n\r\n SELECT_CONTENT: {\r\n name: \"select_content\",\r\n hasEcommerce: false,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\"brand\", 'content_type'],\r\n },\r\n\r\n SELECT_ITEM: {\r\n name: \"select_item\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\"brand\", \"region\", \"items\", \"line_items\"],\r\n },\r\n\r\n VIEW_ITEM: {\r\n name: \"view_item\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\r\n \"brand\",\r\n \"line_items\",\r\n \"currency\",\r\n \"value\",\r\n \"available_grid\",\r\n \"items\",\r\n ],\r\n },\r\n\r\n CUSTOM_VIEW_ITEM: { // IO STORES\r\n name: \"custom_view_item\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\r\n \"brand\",\r\n \"line_items\",\r\n \"currency\",\r\n \"value\",\r\n \"available_grid\",\r\n \"items\",\r\n ],\r\n },\r\n\r\n VIEW_ITEM_LIST: {\r\n name: \"view_item_list\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\"region\", \"brand\", \"line_items\", \"items\"],\r\n },\r\n\r\n BEGIN_CHECKOUT: {\r\n name: \"begin_checkout\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\"brand\", \"line_items\", \"currency\", \"value\", \"total_discount\", \"subtotal\", \"items\"],\r\n },\r\n\r\n CUSTOM_BEGIN_CHECKOUT: {\r\n name: \"custom_begin_checkout\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\"brand\", \"line_items\", \"currency\", \"value\", \"total_discount\", \"subtotal\", \"items\"],\r\n },\r\n\r\n AUTH_ACTION: {\r\n name: \"auth_action\",\r\n hasEcommerce: false,\r\n requiredParams: [\"region\"],\r\n },\r\n\r\n ADD_PERSONAL_INFO: {\r\n name: \"add_personal_info\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\"brand\", \"pre_filled\", \"line_items\", \"currency\", \"value\", \"total_discount\", \"subtotal\"],\r\n },\r\n\r\n CUSTOM_ADD_SHIPPING_INFO: {\r\n name: \"add_shipping_info\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\r\n \"brand\",\r\n \"pre_filled\",\r\n \"shipping\",\r\n \"shipping_tier\",\r\n \"line_items\",\r\n \"currency\",\r\n \"value\",\r\n \"total_discount\",\r\n \"subtotal\",\r\n \"items\"\r\n ],\r\n },\r\n\r\n CUSTOM_ADD_PAYMENT_INFO: {\r\n name: \"add_payment_info\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\r\n \"brand\",\r\n \"pre_filled\",\r\n \"line_items\",\r\n \"currency\",\r\n \"value\",\r\n \"total_discount\",\r\n \"payment_type\",\r\n \"subtotal\",\r\n \"items\"\r\n ],\r\n },\r\n\r\n ORDER_REVIEWED: {\r\n name: \"order_reviewed\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\"brand\", \"line_items\", \"currency\", \"value\", \"total_discount\", \"subtotal\", \"payment_type\"],\r\n },\r\n\r\n PURCHASE: {\r\n name: \"purchase\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\r\n 'brand',\r\n 'shipping_tier',\r\n 'line_items',\r\n 'currency',\r\n 'value',\r\n 'shipping',\r\n 'transaction_id',\r\n 'total_discount',\r\n 'payment_type',\r\n 'seller_cod_name',\r\n 'subtotal',\r\n 'coupon',\r\n 'items'\r\n ],\r\n },\r\n\r\n CUSTOM_PURCHASE: {\r\n name: \"custom_purchase\",\r\n hasEcommerce: true,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: [\r\n 'brand',\r\n 'shipping_tier',\r\n 'line_items',\r\n 'currency',\r\n 'value',\r\n 'shipping',\r\n 'transaction_id',\r\n 'total_discount',\r\n 'payment_type',\r\n 'seller_cod_name',\r\n 'subtotal',\r\n 'coupon',\r\n 'items'\r\n ],\r\n },\r\n\r\n CUSTOM_USER_INFO: {\r\n name: 'custom_user_info',\r\n hasEcommerce: false,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: ['user_info']\r\n },\r\n\r\n NOTIFY_ME: {\r\n name: 'notify_me',\r\n hasEcommerce: false,\r\n destinations: [\"DataLayer\"],\r\n requiredParams: ['brand', 'line_items', 'size', 'item_ref']\r\n }\r\n};\r\n","import type { EventContext, EventName } from \"../types\";\r\nimport { EVENTS } from \"../core/constants\";\r\n\r\n/**\r\n * Pushes an ecommerce tracking event to the appropriate dataLayer and logs the payload.\r\n *\r\n * Ensures a dataLayer array exists on the target (prefer `ecomm.window` if present, otherwise the global `window`)\r\n * and pushes an object containing `event` and the `ecomm` payload. Also logs the pushed payload for debugging.\r\n *\r\n * @param event - The tracking event name to push\r\n * @param context - The event context payload; if it contains a `window` property that object's `dataLayer` will be used as the target\r\n */\r\nexport function pushToDataLayer(event: string, context: EventContext) {\r\n const targetWindow = context.window || (typeof window !== 'undefined' ? window : null);\r\n if (!targetWindow) return;\r\n\r\n const payload = Object.assign({}, context);\r\n delete payload.window; // delete window prop and avoid to push as payload to dayalayer\r\n\r\n const eventName = event.toUpperCase() as EventName;\r\n const eventConfig = EVENTS[eventName] as { hasEcommerce: boolean };\r\n\r\n targetWindow.dataLayer = targetWindow.dataLayer || [];\r\n\r\n if (eventConfig?.hasEcommerce) {\r\n targetWindow.dataLayer.push({ ecommerce: null });\r\n targetWindow.dataLayer.push({ event: event, ecommerce: payload });\r\n } else {\r\n targetWindow.dataLayer.push({ event: event, ...payload });\r\n }\r\n}","import { EventContext } from \"../types\";\r\n\r\nexport function dataTrackingLog(data: EventContext, color: string) {\r\n console.log(\r\n `%c[DT] EVENTO DISPARADO:%c `,\r\n `background: ${color}; color: white; font-weight: bold; padding: 2px 4px; border-radius: 3px;`,\r\n 'color: #fff;',\r\n data || ''\r\n );\r\n}\r\n\r\nexport function setCookie(name: string, value: string, days = 7) {\r\n const encodedValue = encodeURIComponent(value);\r\n\r\n let expires = \"\";\r\n if (days) {\r\n const date = new Date();\r\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\r\n expires = \"; expires=\" + date.toUTCString();\r\n }\r\n\r\n document.cookie = `${name}=${encodedValue}${expires}; path=/;`;\r\n}\r\n\r\nexport const paymentTypeMap = [\r\n ['vale', 'vale crédito'],\r\n ['pagaleve', 'pix'],\r\n ['pix parcel', 'pix parcelado'],\r\n ['pix', 'pix'],\r\n ['apple', 'apple pay'],\r\n ['google', 'google pay'],\r\n ['boleto', 'boleto'],\r\n ['paypal', 'paypal'],\r\n ['cred', 'cartão'],\r\n ['visa', 'cartão'],\r\n ['master', 'cartão'],\r\n ['amex', 'cartão'],\r\n ['elo', 'cartão'],\r\n ['hiper', 'cartão'],\r\n ['diner', 'cartão'],\r\n ['deb', 'cartão'],\r\n];\r\n\r\n\r\nexport const toNum = (val: unknown) => typeof val === 'string' ? Number(val.replace(/[^\\d,]/g, '').replace(',', '.')) : val","import { dataTrackingLog } from \"../core/utils\";\r\nimport type { EventContext } from \"../types\";\r\n\r\nexport function pushToDito(event: string, ecomm: EventContext) {\r\n dataTrackingLog({ id: event, custom_data: ecomm }, '#00c851');\r\n}","import { EVENTS } from '../core/constants';\r\nimport { pushToDataLayer } from './datalayer';\r\nimport { pushToDito } from './dito';\r\n\r\nimport type { EventName, EventContext } from '../types'\r\n\r\nconst adapters = {\r\n DataLayer: pushToDataLayer,\r\n Dito: pushToDito,\r\n};\r\n\r\ntype AdapterKey = keyof typeof adapters;\r\n\r\n/**\r\n * Dispatches a tracking event to all destinations configured for the given event.\r\n *\r\n * Looks up destinations from the EVENTS configuration, calls each destination adapter\r\n * in parallel (providing the event name in lowercase and the supplied context), and\r\n * waits for all attempts to settle. Individual adapter failures are logged with the\r\n * \"[DT]\" prefix but do not prevent other destinations from running.\r\n *\r\n * @param eventName - The name of the event to dispatch\r\n * @param data - The event context/payload to send to adapters\r\n */\r\nexport async function dispatchTrackEvent(eventName: EventName, data: EventContext) {\r\n const eventConfig = EVENTS[eventName] as { destinations: string[] };\r\n\r\n if (!eventConfig) return;\r\n\r\n await Promise.allSettled(\r\n eventConfig.destinations.map(async (dest: string) => {\r\n try {\r\n // call the adapter function based on the destination mapped in the adapters object\r\n // eventName is converted to lowercase to match the expected format in all adapters\r\n await adapters[dest as AdapterKey](eventName.toLowerCase(), data);\r\n } catch (err) {\r\n console.error(`[DT] Failed to send ${eventName} to ${dest}:`, err);\r\n }\r\n })\r\n );\r\n}\r\n","/**\r\n * Fetches product data for the given product id from the catalog API.\r\n *\r\n * @param id - The product identifier used as the `productId` query filter\r\n * @returns The parsed JSON response containing product data, or `undefined` if the request fails\r\n */\r\nexport async function getProductDataById(id: any) {\r\n try {\r\n const response = await fetch(\r\n `/api/catalog_system/pub/products/search?fq=productId:${id}`\r\n );\r\n\r\n return await response.json();\r\n } catch (e) {\r\n console.log('[DT] Erro ao buscar dados do produto', e);\r\n }\r\n}\r\n\r\nexport function isPDP(url: string) {\r\n try {\r\n const { pathname } = new URL(url, window.location.origin);\r\n return /\\/p\\/?$/.test(pathname);\r\n } catch {\r\n return false;\r\n }\r\n}\r\n\r\nexport function extractRefIdFromUrl(url: string | null) {\r\n if (!url) return null;\r\n\r\n const path = (() => {\r\n try { return new URL(url, location.origin).pathname }\r\n catch { return url.split('?')[0] }\r\n })();\r\n\r\n const match = decodeURIComponent(path).match(/(\\d+-\\d+)(?=\\/p|$)/);\r\n return match ? match[1].replace('-', '_') : null;\r\n}\r\n\r\nexport async function getProductByRefId(url: string | null) {\r\n const refId = extractRefIdFromUrl(url);\r\n if (!refId) return console.error('Não foi possível extrair o RefId da URL'), null;\r\n\r\n try {\r\n const res = await fetch(`/api/catalog_system/pub/products/search?fq=alternateIds_RefId:${refId}`);\r\n if (!res.ok) throw new Error(`Erro na API: ${res.status}`);\r\n\r\n const products = await res.json();\r\n return products?.[0] || null;\r\n } catch (err) {\r\n console.error('Erro ao buscar dados do produto:', err);\r\n return null;\r\n }\r\n}\r\n\r\nexport function getItemShippingTier(orderForm: any, item: any) {\r\n const info = orderForm?.shippingData?.logisticsInfo?.find(\r\n (li: any) => li.itemId === item.id\r\n );\r\n\r\n const selectedSla = info?.slas?.find((sla: any) => sla.id === info.selectedSla);\r\n return selectedSla?.pickupStoreInfo?.friendlyName\r\n ? `retirada em loja: ${selectedSla.pickupStoreInfo.friendlyName}`\r\n : selectedSla?.name\r\n ? `Receba em casa: ${selectedSla.name}`\r\n : null;\r\n}\r\n\r\nexport async function getItemSku(item: any) {\r\n const product = await getProductDataById(item.productId || item.productID || item.item_group_id);\r\n\r\n if (!product.length) return null;\r\n\r\n return product[0].items.find((i: any) => i.name === item.skuName)?.itemId ?? null;\r\n}\r\n\r\nexport function getDiscount(item: any) {\r\n const strategies = [\r\n // 1. listPrice - sellingPrice\r\n () => {\r\n if (item?.listPrice != null && item?.sellingPrice != null) {\r\n const diff = Math.max(item.listPrice - item.sellingPrice, 0);\r\n return diff ? parseFloat((diff / 100).toFixed(2)) : 0;\r\n }\r\n return null;\r\n },\r\n\r\n // 2. listPrice - price\r\n () => {\r\n if (item?.listPrice != null && item?.price != null) {\r\n return Math.max(item.listPrice - item.price, 0);\r\n }\r\n return null;\r\n },\r\n\r\n // 3. desconto calculado.\r\n () => (item?.discount || item?.discount === 0 ? item.discount : null),\r\n ];\r\n\r\n for (const getValue of strategies) {\r\n const value = getValue();\r\n\r\n if (value !== null && value !== undefined) {\r\n return value;\r\n }\r\n }\r\n\r\n return 0;\r\n}\r\n\r\nexport function getItemCategory(item: any) {\r\n\r\n const strategies = [\r\n () => item?.productCategories?.['39'] === 'BAZAR' ? 'Sale' : 'Coleção',\r\n () => item?.item_category,\r\n () => item?.category,\r\n () => item?.categories[0],\r\n () => {\r\n /* \r\n Regra: percorre o array itemListElement buscando a categoria de nível raiz,\r\n identificada por URLs no formato \"/slug/\" (apenas um nível, ex: \"/bazar/\", \"/new-collection/\").\r\n Retorna o `name` correspondente a esse item.\r\n */\r\n const breadcrumb = item?.itemOffered?.breadcrumbList?.itemListElement;\r\n\r\n if (!Array.isArray(breadcrumb)) return null;\r\n\r\n const level1 = breadcrumb.find((el) => {\r\n const path = el?.item;\r\n if (!path) return false;\r\n\r\n // remove \"/\" do início/fim e divide\r\n const parts = path.replace(/^\\/|\\/$/g, '').split('/');\r\n\r\n return parts.length === 1;\r\n });\r\n\r\n return level1?.name || null;\r\n }\r\n ];\r\n\r\n for (const getValue of strategies) {\r\n const value = getValue();\r\n\r\n if (value !== null && value !== undefined) {\r\n return value;\r\n }\r\n }\r\n\r\n return null\r\n\r\n}\r\n\r\nexport function getItemCategory2(item: any) {\r\n const strategies = [\r\n () => Object.values(item?.productCategories || {}).pop(), // checkout select_item context\r\n () => (Object.values(item?.categories || {}).pop() as string | undefined)?.slice(1, -1).replace(/\\//g, ','), // \r\n () => item?.category?.split?.('>')?.[1]?.trim?.(), // deco select_item context\r\n () => item.item_category2, // deco add_to_cart context PDP\r\n () => item?.subGrup,\r\n ];\r\n\r\n for (const getValue of strategies) {\r\n const value = getValue();\r\n\r\n if (value !== null && value !== undefined) {\r\n return value;\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport function getItemCategory4(item: any) {\r\n const tags = item?.additionalInfo?.tags || item?.tags;\r\n return Array.isArray(tags) && tags.length ? tags.join(',') : null;\r\n}\r\n\r\nconst BRAND_CODES = {\r\n farm: 'farmrio',\r\n 'farm etc': 'farmetc',\r\n 'farm rio': 'farmrio',\r\n} as const;\r\n\r\ntype Standardized = keyof typeof BRAND_CODES\r\ninterface BrandItem {\r\n brand?: string;\r\n additionalInfo?: {\r\n brandName?: string;\r\n };\r\n}\r\n\r\n/**\r\n * Extrai o código padronizado (ex: 'farmrio') de uma única string de marca.\r\n * Retorna null se não houver mapeamento.\r\n */\r\nfunction getBrandCode(brand: string | undefined): string | null {\r\n if (!brand) return null;\r\n const standardized = brand.toLowerCase().trim();\r\n return BRAND_CODES[standardized as Standardized] || null;\r\n}\r\n\r\n/**\r\n * Função principal que padroniza a marca ou lista de marcas para o formato final:\r\n * 'farmrio', 'farmetc', ou 'farmrio_farmetc'.\r\n */\r\nexport function normalizeBrand(input: string | BrandItem[] | BrandItem | string[] | undefined | null) {\r\n let brandStrings = [];\r\n\r\n if (Array.isArray(input) && input.every(item => typeof item === 'string')) {\r\n brandStrings = input as string[];\r\n } else if (Array.isArray(input)) {\r\n // Se for um Array, coleta a string da marca de cada item.\r\n brandStrings = input.map(item => item.additionalInfo?.brandName || item.brand);\r\n } else if (typeof input === 'object' && input !== null && 'brand' in input) {\r\n // Se for um Objeto único, trata como um Array de um único item (para reuso de lógica).\r\n brandStrings = [(input as BrandItem).additionalInfo?.brandName || (input as BrandItem).brand];\r\n } else if (typeof input === 'string') {\r\n // Se for uma String (mal formatada ou não), trata diretamente.\r\n return getBrandCode(input);\r\n } else {\r\n // Se for undefined, null, ou outro tipo não esperado.\r\n return null;\r\n }\r\n\r\n const brandCodes = brandStrings\r\n .map(getBrandCode)\r\n .filter((code): code is string => code !== null); // ['farmrio', 'farmetc', 'farmrio']\r\n\r\n const uniqueSortedCodes = [...new Set(brandCodes)].sort(); // ['farmetc', 'farmrio']\r\n\r\n // Retorna a combinação ('farmrio', 'farmetc', ou 'farmrio_farmetc').\r\n return uniqueSortedCodes.length > 0 ? uniqueSortedCodes.join('_') : null;\r\n}\r\n","import { normalizeBrand } from '../../utils';\r\n\r\nexport function brandFromOrderForm(context: Record<string, any>) {\r\n if (!context.orderForm && !context.orderForm.items?.length) return null;\r\n\r\n const items = context.orderForm.items;\r\n\r\n return normalizeBrand(items);\r\n}\r\n","import { normalizeBrand } from '../../utils';\r\n\r\nexport function brandFromItem(context: Record<string, any>) {\r\n const { item } = context;\r\n\r\n return normalizeBrand(item?.additionalInfo?.brandName || item.brand || item.item_brand);\r\n}\r\n","import { brandFromOrderForm } from './resolvers/brand/fromOrderForm';\r\nimport { brandFromItem } from './resolvers/brand/fromItem';\r\nimport { normalizeBrand } from './utils';\r\nimport type { EventContext, EventName } from '../types';\r\n\r\n/**\r\n * Determines the brand for an event by using the context or extracting it based on the event type.\r\n *\r\n * Prefers `context.brand` when present; otherwise selects a resolver based on `eventName` to extract the brand.\r\n *\r\n * @param context - The event context which may already contain a `brand` or provide data for extraction\r\n * @param eventName - The event name used to choose the extraction strategy\r\n * @returns The resolved brand value, or `null` if no brand could be determined\r\n */\r\nexport function getBrand(context: EventContext, eventName: EventName) {\r\n if (context?.brand) return normalizeBrand(context.brand) || context.brand || null;\r\n\r\n switch (eventName) {\r\n case 'CUSTOM_VIEW_CART':\r\n case 'ADD_COUPON':\r\n case 'ADD_PERSONAL_INFO':\r\n case 'CUSTOM_ADD_SHIPPING_INFO':\r\n case 'CUSTOM_ADD_PAYMENT_INFO':\r\n case 'BEGIN_CHECKOUT':\r\n case 'CUSTOM_BEGIN_CHECKOUT':\r\n case 'SEARCH_ZIPCODE':\r\n case 'ORDER_REVIEWED':\r\n case 'PURCHASE':\r\n case 'CUSTOM_PURCHASE':\r\n return brandFromOrderForm(context);\r\n case 'ADD_TO_CART':\r\n case 'REMOVE_FROM_CART':\r\n return brandFromItem(context);\r\n default:\r\n return null;\r\n }\r\n}\r\n","import type { EventContext } from '../../../types';\r\n\r\nimport {\r\n getItemSku,\r\n getDiscount,\r\n getItemCategory,\r\n getItemCategory2,\r\n getItemCategory4,\r\n getItemShippingTier,\r\n normalizeBrand,\r\n} from '../../utils';\r\n\r\n/**\r\n * Builds an array of normalized item objects from the order form contained in the given context.\r\n *\r\n * @param context - EventContext containing an orderForm with items to convert\r\n * @returns An array of item-like objects derived from `context.orderForm.items`, each containing fields such as `item_id`, `price`, `quantity`, `item_sku`, `item_name`, category and variant attributes, and `discount`\r\n */\r\nexport async function itemsFromOrderForm(context: EventContext) {\r\n const items = context.orderForm?.items || [];\r\n\r\n if (!items.length) return [];\r\n\r\n return await Promise.all(\r\n items.map(async (item: EventContext) => ({\r\n item_id: item.productId,\r\n item_category2: getItemCategory2(item),\r\n item_category4: getItemCategory4(item),\r\n item_shipping_tier: getItemShippingTier(context.orderForm, item),\r\n price: parseFloat(((item.listPrice || item.price) / 100).toFixed(2)) || 0,\r\n quantity: item.quantity || 1,\r\n item_ref: item.refId || null,\r\n item_brand: normalizeBrand(item.additionalInfo?.brandName) || item.additionalInfo?.brandName || null,\r\n item_sku: (await getItemSku(item)) || item.id || null,\r\n item_name: item.name.split(' - ').shift() || item.id || null,\r\n item_category: getItemCategory(item) || null,\r\n item_variant: item.skuName.split(/[-/]/)[0].trim(),\r\n item_variant2: item.skuName.split(/[-/]/).pop()?.trim() || '',\r\n discount: getDiscount(item),\r\n }))\r\n );\r\n}\r\n","import {\r\n getItemSku,\r\n getDiscount,\r\n getItemCategory,\r\n getItemCategory2,\r\n getItemCategory4,\r\n getItemShippingTier,\r\n} from '../../utils';\r\n\r\nexport async function itemsFromItem(context: Record<string, any>, event: string) {\r\n const { item, orderForm, itemListName } = context;\r\n return [\r\n {\r\n index: typeof item?.index === 'number' ? item.index : null,\r\n quantity: 1,\r\n item_id: item?.productId|| item?.item_group_id || item?.sku || item?.id || null,\r\n item_category2: getItemCategory2(item),\r\n item_category4: getItemCategory4(item),\r\n item_shipping_tier: event === 'REMOVE_FROM_CART' ? getItemShippingTier(orderForm, item) : null,\r\n price: item?.listPrice || item?.price || 0,\r\n item_ref: item?.ref || item?.refId || item?.item_ref || item?.additionalProperty?.find((i: { name: string }) => i.name === \"RefId\").value || item?.itemOffered?.gtin.substring(0, item?.itemOffered?.gtin.lastIndexOf('_')) || null,\r\n item_brand: item?.additionalInfo?.brandName || item?.item_brand || item?.brand?.name || item?.itemOffered?.brand?.name || null,\r\n item_sku: item?.sku || item?.itemOffered?.sku || item?.item_id || item?.id || (await getItemSku(item)) || null,\r\n item_name: item?.name || item?.item_name || item?.itemOffered?.isVariantOf?.name || null,\r\n item_category: getItemCategory(item) || null,\r\n item_variant: (item?.skuName || item?.item_variant || item?.name || item?.itemOffered.name).split(/[-/]/)[0].trim() || null,\r\n item_variant2: item?.size || item?.itemAttributes?.size || (item?.skuName || item?.name || item?.itemOffered.name)?.split(/[-/]/).pop()?.trim() || null,\r\n discount: getDiscount(item),\r\n item_list_name: itemListName || null,\r\n\r\n item_url: item?.item_url || null, // add_to_cart dito\r\n },\r\n ];\r\n}\r\n ","import { getDiscount, getItemCategory, getItemCategory2, normalizeBrand } from '../../utils';\r\n\r\nexport async function itemsFromList(context: Record<string, any>) {\r\n return (context?.list || []).map((item: any) => {\r\n return {\r\n price: item?.price?.list || item?.price || item?.offers?.lowPrice || item?.priceRange?.listPrice?.highPrice || null,\r\n quantity: 1,\r\n item_ref: item?.ref || item?.item_ref || item?.referenceId?.[0].Value || item?.productReference || item?.additionalProperty.find((i: { name: string }) => i.name === \"RefId\").value || null,\r\n index: typeof context?.index === 'number' ? context.index : Number(item?.index),\r\n item_brand: item?.item_brand ? item.item_brand : item.isNotFarm ? item?.item_brand : normalizeBrand(item?.brand?.name) || normalizeBrand(context.brand) || normalizeBrand(item?.item_brand) || null,\r\n item_name: item?.productName?.split(' - ').shift() || item?.alternateName?.split(' - ').shift() || item?.item_name?.split(' - ').shift() || item?.seo?.title?.split(' - ').shift() || null,\r\n item_category: getItemCategory(item) || null,\r\n item_variant: item?.name?.split(\"-\")?.[0].trim() || item?.item_variant || item?.productName?.split(\"-\")?.[1].trim() || null,\r\n item_category2: getItemCategory2(item) || null,\r\n item_id: item?.productID || item?.productId || item?.item_id || item?.id || null,\r\n discount: getDiscount(item) || null,\r\n item_list_name: context?.itemListName || getItemCategory(item) || null,\r\n }\r\n })\r\n}\r\n","import {\r\n getDiscount,\r\n getItemCategory,\r\n getItemCategory2,\r\n normalizeBrand,\r\n} from '../../utils';\r\n\r\nexport async function itemsFromPDP(context: Record<string, any>) {\r\n const { item, value, brand } = context;\r\n\r\n return [\r\n {\r\n price: value || 0,\r\n quantity: 1,\r\n item_ref: item?.ref || item?.additionalProperty?.find((i: { name: string }) => i.name === \"RefId\").value || item?.productReference || null,\r\n item_brand: item.isNotFarm ? item?.item_brand : normalizeBrand(item?.brand.name) || normalizeBrand(brand) || null,\r\n item_name: item?.productName || item?.alternateName || null,\r\n item_category: getItemCategory(item) || null,\r\n item_variant: item?.name?.split(\"-\")[0].trim() || null,\r\n item_category2: getItemCategory2(item) || item?.category?.split(\">\")[1]?.trim() || null,\r\n item_id: item?.productID || item?.productId || item?.item_group_id || null,\r\n discount: getDiscount(item) || null,\r\n\r\n // dito params view_item\r\n item_sku: item?.sku || item?.productId || null,\r\n item_url: item?.url || item?.item_url || item?.link || null,\r\n seller_id: item?.seller || null\r\n },\r\n ];\r\n}\r\n","import {\r\n isPDP,\r\n normalizeBrand,\r\n getItemCategory,\r\n getItemCategory2,\r\n getProductByRefId,\r\n extractRefIdFromUrl,\r\n} from '../../utils';\r\n\r\nexport async function itemsFromBanner(context: Record<string, any>) {\r\n const isUrlFromPDP = isPDP(context?.bannerUrl);\r\n\r\n if (!isUrlFromPDP) return [];\r\n\r\n const product = await getProductByRefId(context?.bannerUrl);\r\n\r\n const item = product?.items[0];\r\n\r\n return {\r\n price: item?.sellers[0].commertialOffer.Price || 0,\r\n quantity: 1,\r\n item_ref: extractRefIdFromUrl(context?.bannerUrl),\r\n item_brand: normalizeBrand(product.brand) || null,\r\n item_name: product?.productName || product?.alternateName || product?.item_name || null,\r\n item_category: getItemCategory(product) || null,\r\n item_variant: item?.name?.split(\"-\").pop().trim() || null,\r\n item_category2: getItemCategory2(product) || null,\r\n item_id: product?.productId || null,\r\n discount: item?.sellers[0].commertialOffer.ListPrice - item?.sellers[0].commertialOffer.Price || null,\r\n }\r\n}\r\n","import { itemsFromOrderForm } from './resolvers/items/fromOrderForm';\r\nimport { itemsFromItem } from './resolvers/items/fromItem';\r\nimport { itemsFromList } from './resolvers/items/fromList';\r\nimport { itemsFromPDP } from './resolvers/items/fromPdp';\r\nimport { itemsFromBanner } from './resolvers/items/fromBanner';\r\n\r\n/**\r\n * Selects the appropriate item resolver based on the event name and returns its result.\r\n *\r\n * @param context - Runtime context passed to the selected resolver\r\n * @param eventName - Event identifier that determines which resolver to use\r\n * @returns The resolved items for the event, or `null` if the event is not recognized\r\n */\r\nexport function getItems(context: Record<string, any>, eventName: string) {\r\n if (context?.items) return context.items;\r\n\r\n switch (eventName) {\r\n case 'CUSTOM_VIEW_CART':\r\n case 'BEGIN_CHECKOUT':\r\n case 'CUSTOM_BEGIN_CHECKOUT':\r\n case 'CUSTOM_ADD_SHIPPING_INFO':\r\n case 'CUSTOM_ADD_PAYMENT_INFO':\r\n case 'PURCHASE':\r\n case 'CUSTOM_PURCHASE':\r\n return itemsFromOrderForm(context);\r\n case 'ADD_TO_CART':\r\n case 'ADD_TO_WISHLIST':\r\n case 'REMOVE_FROM_CART':\r\n return itemsFromItem(context, eventName);\r\n case 'SELECT_ITEM':\r\n case 'VIEW_ITEM_LIST':\r\n return itemsFromList(context)\r\n case 'VIEW_ITEM':\r\n case 'CUSTOM_VIEW_ITEM':\r\n return itemsFromPDP(context)\r\n case 'VIEW_PROMOTION':\r\n case 'SELECT_PROMOTION':\r\n return itemsFromBanner(context)\r\n default:\r\n return null;\r\n }\r\n}\r\n","import { paymentTypeMap } from \"../../../core/utils\";\r\n\r\nexport function paymentTypeFromOrderForm(context: Record<string, any>) {\r\n if (!context.orderForm) return null;\r\n\r\n const payments = context.orderForm.paymentData?.payments || [];\r\n const systems = context.orderForm.paymentData?.paymentSystems || [];\r\n if (!payments.length || !systems.length) return null;\r\n\r\n const selectedPayment = payments.find((p: { paymentSystem: string }) => p?.paymentSystem) || payments[0];\r\n const id = String(selectedPayment?.paymentSystem || '').trim();\r\n if (!id) return null;\r\n\r\n const system = systems.find((s: { id: string }) => String(s.id) === id);\r\n const name = system?.name?.toLowerCase() || '';\r\n const match = paymentTypeMap.find(([key]) => name.includes(key));\r\n\r\n return match ? match[1] : null;\r\n}\r\n","import { paymentTypeMap } from \"../../../core/utils\";\r\n\r\nexport function paymentTypeFromOrderGroup(context: Record<string, any>) {\r\n if (!context.orderForm) return null;\r\n\r\n const transactions = context.orderForm.paymentData?.transactions || [];\r\n if (!transactions.length) return null;\r\n\r\n const payments = transactions[0]?.payments || [];\r\n if (!payments.length) return null;\r\n\r\n const name = payments[0]?.paymentSystemName?.toLowerCase() || '';\r\n const match = paymentTypeMap.find(([key]) => name.includes(key));\r\n\r\n return match ? match[1] : null;\r\n}\r\n","import { paymentTypeFromOrderForm } from './resolvers/paymentType/fromOrderForm';\r\nimport { paymentTypeFromOrderGroup } from './resolvers/paymentType/fromOrderGroup';\r\n\r\n/**\r\n * Selects the appropriate payment_type resolver based on the event name and returns its result.\r\n *\r\n * @param context - Runtime context passed to the selected resolver\r\n * @param eventName - Event identifier that determines which resolver to use\r\n * @returns The resolved payment_type for the event, or `null` if the event is not recognized\r\n */\r\nexport function getPaymentType(context: Record<string, any>, eventName: string) {\r\n if (context?.paymentType) return context.paymentType;\r\n\r\n switch (eventName) {\r\n case 'ORDER_REVIEWED':\r\n case 'CUSTOM_ADD_PAYMENT_INFO':\r\n return paymentTypeFromOrderForm(context);\r\n case 'PURCHASE':\r\n case 'CUSTOM_PURCHASE':\r\n return paymentTypeFromOrderGroup(context)\r\n default:\r\n return null;\r\n }\r\n}\r\n","import type { EventContext, EventName, LogisticInfo } from '../types';\r\nimport { getBrand } from './brand';\r\nimport { getItems } from './items';\r\nimport { getPaymentType } from './paymentType';\r\nimport { toNum } from '../core/utils';\r\n\r\n\r\nexport const paramGetters = {\r\n brand: getBrand,\r\n\r\n items: getItems,\r\n\r\n payment_type: getPaymentType,\r\n\r\n user_info: async (context: EventContext, eventName: EventName) => {\r\n const PROD_DOMAINS: Record<string, Record<string, string>> = {\r\n \"animale\": {\r\n \"store\": \"https://www.animale.com.br\",\r\n \"checkout\": \"https://secure.animale.com.br\",\r\n },\r\n \"farm\": {\r\n \"store\": \"https://lojafarm.myvtex.com\"\r\n },\r\n \"mariafilo\": {\r\n \"store\": \"https://mariafilo.myvtex.com\",\r\n \"checkout\": \"https://secure.mariafilo.com.br\",\r\n },\r\n \"lojacrisbarros\": {\r\n \"store\": \"https://lojacrisbarros.myvtex.com\",\r\n \"checkout\": \"https://secure.crisbarros.com.br\",\r\n },\r\n \"lojaoffpremium\": {\r\n \"store\": \"https://lojaoffpremium.myvtex.com\",\r\n \"checkout\": \"https://secure.lojaoffpremium.com.br\",\r\n },\r\n };\r\n\r\n const domain = PROD_DOMAINS[context.account || 'https://www.animale.com.br']?.[context.platform || 'store'];\r\n\r\n if (!domain) return { customer: { email: context.userEmail, id: context?.userId }, address: null };\r\n\r\n try {\r\n const api = `${domain}/_v/user-info`;\r\n const response = await fetch(api, {\r\n method: 'POST',\r\n body: JSON.stringify({ email: context.userEmail })\r\n });\r\n\r\n if (response.status !== 200) {\r\n return { customer: { email: context.userEmail, id: context?.userId }, address: null };\r\n }\r\n\r\n return await response.json();\r\n } catch (_) {\r\n return { customer: { email: context.userEmail, id: context?.userId }, address: null };\r\n }\r\n },\r\n\r\n content_type: (context: EventContext, eventName: EventName) => {\r\n return `regiao`\r\n .concat(':' + context.category)\r\n .concat(context.subcategory ? ':' + context.subcategory : '')\r\n .concat(':' + context.componentName) || null\r\n },\r\n\r\n region: (context: EventContext, eventName: EventName) => {\r\n return context.region || null;\r\n },\r\n\r\n line_items: (context: EventContext, eventName: EventName) => {\r\n if (context?.lineItems) return context.lineItems;\r\n\r\n if (context?.item) {\r\n return [context.item.productId || context.item.productID || context.item.item_id];\r\n }\r\n\r\n if (context?.list) {\r\n return context.list.map((item: { productID: string, id: string, productId: string }) => item?.productID || item?.id || item?.productId)\r\n }\r\n\r\n return (context.orderForm.items || [])\r\n .map((item: EventContext) => item.productId)\r\n .join(',');\r\n },\r\n\r\n currency: (context: EventContext, eventName: EventName) => {\r\n if (context?.currency) return context.currency\r\n\r\n if (context?.bannerUrl) return 'BRL'\r\n\r\n if (context?.item) {\r\n return context.item?.offers?.priceCurrency || 'BRL'\r\n }\r\n\r\n return context.orderForm?.storePreferencesData?.currencyCode || null;\r\n },\r\n\r\n value: (context: EventContext, eventName: EventName) => {\r\n if (context?.value) return toNum(context.value)\r\n\r\n return context.item ? toNum(context.item?.price) : context.orderForm?.value != null\r\n ? context.orderForm.value / 100\r\n : null;\r\n },\r\n\r\n total_discount: (context: EventContext, eventName: EventName) => {\r\n if (context?.totalDiscount) return context.totalDiscount\r\n\r\n const totalsList = context.orderForm?.totalizers || context.orderForm?.totals || []; // totals for ordergroup and orderform have different names\r\n const items = context.orderForm.items;\r\n const totalDiscount = items.reduce((acc: number, item: { quantity: number, listPrice: number, sellingPrice: number }) => {\r\n const unitDiscount = Math.max(0, item.listPrice - item.sellingPrice);\r\n return acc + (unitDiscount * item.quantity);\r\n }, 0);\r\n\r\n const discounts = totalsList.find((t: { id: string }) => t.id === 'Discounts');\r\n return Math.abs((discounts?.value || 0) + totalDiscount) / 100 || null;\r\n },\r\n\r\n subtotal: (context: EventContext, eventName: EventName) => {\r\n const totalsList = context.orderForm?.totalizers || context.orderForm?.totals || []; // totals for ordergroup and orderform have different names\r\n\r\n const subtotal =\r\n totalsList\r\n .filter((t: EventContext) => t.id === 'Items')\r\n .reduce((acc: number, t: EventContext) => acc + (t.value || 0), 0) / 100 || 0;\r\n\r\n return subtotal\r\n },\r\n\r\n coupon_message: (context: EventContext, eventName: EventName) => {\r\n if (context.couponMessage) return context.couponMessage;\r\n\r\n const messages = context.orderForm?.messages || [];\r\n\r\n if (messages.length === 0) return null;\r\n\r\n const couponMessages = messages.filter((msg: EventContext) =>\r\n msg.text.toLowerCase().includes('cupom')\r\n );\r\n\r\n if (couponMessages.length === 0) return null;\r\n\r\n return couponMessages.map((msg: EventContext) => msg.text).join(' | ');\r\n },\r\n\r\n seller_cod_name: (context: EventContext, eventName: EventName) => {\r\n return context.appliedSellerCodName || context?.orderForm.marketingData.utmiCampaign || null;\r\n },\r\n\r\n coupon: (context: EventContext, eventName: EventName) => {\r\n return context.appliedCoupon || context?.orderForm?.marketingData?.coupon || null;\r\n },\r\n\r\n pre_filled: (context: EventContext, eventName: EventName) => {\r\n return !!context.preFilled;\r\n },\r\n\r\n search_term: (context: EventContext, eventName: EventName) => {\r\n return context.searchTerm || null;\r\n },\r\n\r\n search_found: (context: EventContext, eventName: EventName) => {\r\n return !!context.searchFound;\r\n },\r\n\r\n search_quantity: (context: EventContext, eventName: EventName) => {\r\n return context.searchQuantity || 0;\r\n },\r\n\r\n promotion_name: (context: EventContext, eventName: EventName) => {\r\n return context.promotionName || null;\r\n },\r\n\r\n creative_name: (context: EventContext, eventName: EventName) => {\r\n return context.creativeName || null;\r\n },\r\n\r\n creative_slot: (context: EventContext, eventName: EventName) => {\r\n return context.creativeSlot || null;\r\n },\r\n\r\n zipcode: (context: EventContext, eventName: EventName) => {\r\n return context.zipCode || null;\r\n },\r\n\r\n size: (context: EventContext, eventName: EventName) => {\r\n return context.size || null;\r\n },\r\n\r\n item_ref: (context: EventContext, eventName: EventName) => {\r\n return context.itemRef || null;\r\n },\r\n\r\n flag_pickup: (context: EventContext, eventName: EventName) => {\r\n const orderForm = context.orderForm;\r\n if (!orderForm) return null;\r\n\r\n const logisticsInfo = orderForm.shippingData?.logisticsInfo || [];\r\n const hasPickup = logisticsInfo.some((info: LogisticInfo) =>\r\n info.slas?.some((sla) => sla.deliveryChannel === 'pickup-in-point')\r\n );\r\n\r\n return hasPickup\r\n },\r\n\r\n shippings: (context: EventContext, eventName: EventName) => {\r\n const orderForm = context.orderForm;\r\n if (!orderForm) return null;\r\n\r\n const groupShipping: Record<string, any> = {};\r\n\r\n for (const info of orderForm.shippingData.logisticsInfo) {\r\n const item = orderForm.items[info.itemIndex]\r\n if (!item) continue\r\n\r\n for (const sla of info.slas) {\r\n const key = sla.name\r\n\r\n if (!groupShipping[key]) {\r\n groupShipping[key] = {\r\n shipping_tier: sla.name,\r\n delivery_time: parseInt(sla.shippingEstimate),\r\n shipping: parseFloat((sla.price / 100).toFixed(1)),\r\n line_items: []\r\n }\r\n }\r\n\r\n groupShipping[key].line_items.push(item.id)\r\n }\r\n }\r\n\r\n const shippings = Object.values(groupShipping).map((s) => ({\r\n shipping: s.shipping,\r\n shipping_tier: s.shipping_tier,\r\n delivery_time: s.delivery_time,\r\n line_items: s.line_items.join(',')\r\n }))\r\n\r\n return shippings || null\r\n },\r\n\r\n shipping: (context: EventContext, eventName: EventName) => {\r\n const logistics = context?.orderForm?.shippingData?.logisticsInfo ?? []\r\n return logistics.reduce((total: number, item: any) => {\r\n const selected = item.slas?.find((sla: any) => sla.id === item.selectedSla)\r\n return total + (selected?.price ?? 0)\r\n }, 0)\r\n },\r\n\r\n shipping_tier: (context: EventContext, eventName: EventName) => {\r\n const logistics = context?.orderForm?.shippingData?.logisticsInfo ?? []\r\n const selectedSlas = logistics\r\n .map((item: {\r\n selectedSla?: string,\r\n slas?: Array<{\r\n id: string,\r\n deliveryChannel: string,\r\n name?: string,\r\n pickupStoreInfo?: { friendlyName?: string }\r\n }>\r\n }) => {\r\n if (!item.selectedSla) return null;\r\n return item.slas?.find((sla) => sla.id === item.selectedSla) || null;\r\n })\r\n .filter(Boolean) as Array<{\r\n deliveryChannel: string,\r\n name?: string,\r\n pickupStoreInfo?: { friendlyName?: string }\r\n }>;\r\n\r\n if (selectedSlas.length === 0) return null;\r\n\r\n const uniqueTiers = Array.from(\r\n new Map(\r\n selectedSlas.map((sla) => {\r\n const key = sla.deliveryChannel === 'pickup-in-point'\r\n ? `pickup:${sla.pickupStoreInfo?.friendlyName || sla.name || ''}`\r\n : `delivery:${sla.name || ''}`;\r\n return [key, sla];\r\n })\r\n ).values()\r\n );\r\n\r\n const sortedTiers = uniqueTiers.sort((a, b) => {\r\n const aOrder = a.deliveryChannel === 'pickup-in-point' ? 0 : 1;\r\n const bOrder = b.deliveryChannel === 'pickup-in-point' ? 0 : 1;\r\n if (aOrder !== bOrder) return aOrder - bOrder;\r\n\r\n const aLabel = a.deliveryChannel === 'pickup-in-point'\r\n ? (a.pickupStoreInfo?.friendlyName || a.name || '')\r\n : (a.name || '');\r\n const bLabel = b.deliveryChannel === 'pickup-in-point'\r\n ? (b.pickupStoreInfo?.friendlyName || b.name || '')\r\n : (b.name || '');\r\n\r\n return aLabel.localeCompare(bLabel, 'pt-BR');\r\n });\r\n\r\n const shippingTier = sortedTiers\r\n .map((sla) => (\r\n sla.deliveryChannel === 'pickup-in-point'\r\n ? `retirada em loja${sla.pickupStoreInfo?.friendlyName ? `: ${sla.pickupStoreInfo.friendlyName}` : ''}`\r\n : sla.deliveryChannel === 'delivery'\r\n ? `receba em casa${sla.name ? `: ${sla.name}` : ''}`\r\n : null\r\n ))\r\n .filter(Boolean)\r\n .join(', ');\r\n\r\n return shippingTier || null;\r\n },\r\n\r\n transaction_id: (context: EventContext, eventName: EventName) => {\r\n return context.orderForm?.orderGroup?.toString() || null;\r\n },\r\n\r\n available_grid: (context: EventContext, eventName: EventName) => {\r\n return context.availableGrid || null;\r\n },\r\n}","import { EVENTS } from '../core/constants';\r\nimport { paramGetters } from '../params';\r\nimport type { EventName, EventContext } from '../types'\r\n\r\ntype ParamName = keyof typeof paramGetters;\r\n\r\n/**\r\n * Resolve and return the required parameters for a given event.\r\n *\r\n * @param context - Context passed to each parameter getter (defaults to an empty object)\r\n * @param eventName - The event whose required parameters should be resolved\r\n * @returns An object mapping each required parameter name to its resolved value (`null` when a param getter is missing), or `undefined` if the event has no configuration\r\n */\r\nexport async function getParameters(context: EventContext = {}, eventName: EventName) {\r\n const eventConfig = EVENTS[eventName] as { requiredParams: string[] };\r\n\r\n if (!eventConfig) return;\r\n\r\n const params = Object.fromEntries(\r\n await Promise.all(\r\n eventConfig.requiredParams.map(async (param) => {\r\n const getter = paramGetters[param as ParamName];\r\n\r\n if (typeof getter !== 'function') {\r\n console.error(`[DT] Missing paramGetter for param: ${param}`);\r\n return [param, null]; // ou undefined\r\n }\r\n \r\n return [param, await getter(context, eventName)];\r\n })\r\n )\r\n );\r\n\r\n return params;\r\n}\r\n","import { dispatchTrackEvent } from './adapters';\r\nimport { getParameters } from './formatter';\r\nimport { EVENTS } from './core/constants';\r\nimport type { EventContext, EventName } from './types';\r\n\r\n/**\r\n * Assembles tracking parameters and sends a web tracking event.\r\n *\r\n * @param event - The name of the event to track.\r\n * @param context - Optional context used to build event parameters; may include a `window` property that will be attached to the dispatched payload.\r\n * @returns The result returned by `dispatchTrackEvent` when the event is sent successfully, or the value returned by `console.error` (`undefined`) if an error occurs.\r\n */\r\nasync function trackWebEvent(event: EventName, context: EventContext = {}) {\r\n try {\r\n // object data to be sent\r\n const parameters = await getParameters(context, event);\r\n\r\n // function to send event\r\n return await dispatchTrackEvent(\r\n event,\r\n Object.assign({}, parameters, { window: context.window })\r\n );\r\n } catch (err) {\r\n return console.error(`[DT] Error tracking event ${event}:`, err);\r\n }\r\n}\r\n\r\nexport { trackWebEvent, EVENTS };\r\n\r\nexport default {\r\n trackWebEvent,\r\n EVENTS,\r\n}\r\n"],"mappings":";AAAO,IAAM,SAAS;AAAA,EACpB,kBAAkB;AAAA,IAChB,MAAM;AAAA,IACN,cAAc;AAAA,IACd,cAAc,CAAC,WAAW;AAAA,IAC1B,gBAAgB;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,iBAAiB;AAAA,IACf,MAAM;AAAA,IACN,cAAc;AAAA,IACd,cAAc,CAAC,WAAW;AAAA,IAC1B,gBAAgB;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,aAAa;AAAA,IACX,MAAM;AAAA,IACN,cAAc;AAAA,IACd,cAAc,CAAC,WAAW;AAAA,IAC1B,gBAAgB;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,kBAAkB;AAAA,IAChB,MAAM;A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KAAK,GAAG;AAAA,EACjE;AACF;AAIA,IAAO,cAAQ;AAAA,EACb;AAAA,EACA;AACF;","names":["_a","_a","_a","_b"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/constants.ts","../src/adapters/datalayer.ts","../src/core/utils.ts","../src/adapters/dito.ts","../src/adapters/index.ts","../src/params/utils/index.ts","../src/params/resolvers/brand/fromOrderForm.ts","../src/params/resolvers/brand/fromItem.ts","../src/params/brand.ts","../src/params/resolvers/items/fromOrderForm.ts","../src/params/resolvers/items/fromItem.ts","../src/params/resolvers/items/fromList.ts","../src/params/resolvers/items/fromPdp.ts","../src/params/resolvers/items/fromBanner.ts","../src/params/items.ts","../src/params/resolvers/paymentType/fromOrderForm.ts","../src/params/resolvers/paymentType/fromOrderGroup.ts","../src/params/paymentType.ts","../src/params/index.ts","../src/formatter/index.ts","../src/index.ts"],"sourcesContent":["export const EVENTS = {\n CUSTOM_VIEW_CART: {\n name: \"custom_view_cart\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\n \"brand\",\n \"region\",\n \"line_items\",\n \"currency\",\n \"value\",\n \"total_discount\",\n \"subtotal\",\n \"items\",\n ],\n },\n\n ADD_TO_WISHLIST: {\n name: \"add_to_wishlist\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\n \"brand\",\n \"region\",\n \"line_items\",\n \"currency\",\n \"value\",\n \"items\",\n ],\n },\n\n ADD_TO_CART: {\n name: \"add_to_cart\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\n \"brand\",\n \"region\",\n \"line_items\",\n \"currency\",\n \"value\",\n \"items\",\n ],\n },\n\n REMOVE_FROM_CART: {\n name: \"remove_from_cart\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\n \"brand\",\n \"region\",\n \"line_items\",\n \"currency\",\n \"value\",\n \"items\",\n ],\n },\n\n ADD_COUPON: {\n name: \"add_coupon\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\n \"brand\",\n \"region\",\n \"coupon\",\n \"coupon_message\",\n \"seller_cod_name\",\n ],\n },\n\n SEARCH: {\n name: \"search\",\n hasEcommerce: false,\n destinations: [\"DataLayer\"],\n requiredParams: [\"brand\", \"search_term\", \"search_found\", \"search_quantity\"],\n },\n\n SEARCH_ZIPCODE: {\n name: 'search_zipcode',\n hasEcommerce: false,\n destinations: ['DataLayer'],\n requiredParams: ['brand', 'region', 'shippings', 'zipcode', 'flag_pickup'],\n },\n\n VIEW_PROMOTION: {\n name: \"view_promotion\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\n \"brand\",\n \"region\",\n \"currency\",\n \"promotion_name\",\n \"creative_slot\",\n \"creative_name\",\n \"items\",\n ],\n },\n\n SELECT_PROMOTION: {\n name: \"select_promotion\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\n \"brand\",\n \"region\",\n \"currency\",\n \"promotion_name\",\n \"creative_slot\",\n \"creative_name\",\n \"items\",\n ],\n },\n\n SELECT_CONTENT: {\n name: \"select_content\",\n hasEcommerce: false,\n destinations: [\"DataLayer\"],\n requiredParams: [\"brand\", 'content_type'],\n },\n\n SELECT_ITEM: {\n name: \"select_item\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\"brand\", \"region\", \"items\", \"line_items\"],\n },\n\n VIEW_ITEM: {\n name: \"view_item\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\n \"brand\",\n \"line_items\",\n \"currency\",\n \"value\",\n \"available_grid\",\n \"items\",\n ],\n },\n\n CUSTOM_VIEW_ITEM: { // IO STORES\n name: \"custom_view_item\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\n \"brand\",\n \"line_items\",\n \"currency\",\n \"value\",\n \"available_grid\",\n \"items\",\n ],\n },\n\n VIEW_ITEM_LIST: {\n name: \"view_item_list\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\"region\", \"brand\", \"line_items\", \"items\"],\n },\n\n BEGIN_CHECKOUT: {\n name: \"begin_checkout\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\"brand\", \"line_items\", \"currency\", \"value\", \"total_discount\", \"subtotal\", \"items\"],\n },\n\n CUSTOM_BEGIN_CHECKOUT: {\n name: \"custom_begin_checkout\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\"brand\", \"line_items\", \"currency\", \"value\", \"total_discount\", \"subtotal\", \"items\"],\n },\n\n AUTH_ACTION: {\n name: \"auth_action\",\n hasEcommerce: false,\n requiredParams: [\"region\"],\n },\n\n ADD_PERSONAL_INFO: {\n name: \"add_personal_info\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\"brand\", \"pre_filled\", \"line_items\", \"currency\", \"value\", \"total_discount\", \"subtotal\"],\n },\n\n CUSTOM_ADD_SHIPPING_INFO: {\n name: \"add_shipping_info\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\n \"brand\",\n \"pre_filled\",\n \"shipping\",\n \"shipping_tier\",\n \"line_items\",\n \"currency\",\n \"value\",\n \"total_discount\",\n \"subtotal\",\n \"items\"\n ],\n },\n\n CUSTOM_ADD_PAYMENT_INFO: {\n name: \"add_payment_info\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\n \"brand\",\n \"pre_filled\",\n \"line_items\",\n \"currency\",\n \"value\",\n \"total_discount\",\n \"payment_type\",\n \"subtotal\",\n \"items\"\n ],\n },\n\n ORDER_REVIEWED: {\n name: \"order_reviewed\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\"brand\", \"line_items\", \"currency\", \"value\", \"total_discount\", \"subtotal\", \"payment_type\"],\n },\n\n PURCHASE: {\n name: \"purchase\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\n 'brand',\n 'shipping_tier',\n 'line_items',\n 'currency',\n 'value',\n 'shipping',\n 'transaction_id',\n 'total_discount',\n 'payment_type',\n 'seller_cod_name',\n 'subtotal',\n 'coupon',\n 'items'\n ],\n },\n\n CUSTOM_PURCHASE: {\n name: \"custom_purchase\",\n hasEcommerce: true,\n destinations: [\"DataLayer\"],\n requiredParams: [\n 'brand',\n 'shipping_tier',\n 'line_items',\n 'currency',\n 'value',\n 'shipping',\n 'transaction_id',\n 'total_discount',\n 'payment_type',\n 'seller_cod_name',\n 'subtotal',\n 'coupon',\n 'items'\n ],\n },\n\n CUSTOM_USER_INFO: {\n name: 'custom_user_info',\n hasEcommerce: false,\n destinations: [\"DataLayer\"],\n requiredParams: ['user_info']\n },\n\n NOTIFY_ME: {\n name: 'notify_me',\n hasEcommerce: false,\n destinations: [\"DataLayer\"],\n requiredParams: ['brand', 'line_items', 'size', 'item_ref']\n }\n};\n","import type { EventContext, EventName } from \"../types\";\nimport { EVENTS } from \"../core/constants\";\n\n/**\n * Pushes an ecommerce tracking event to the appropriate dataLayer and logs the payload.\n *\n * Ensures a dataLayer array exists on the target (prefer `ecomm.window` if present, otherwise the global `window`)\n * and pushes an object containing `event` and the `ecomm` payload. Also logs the pushed payload for debugging.\n *\n * @param event - The tracking event name to push\n * @param context - The event context payload; if it contains a `window` property that object's `dataLayer` will be used as the target\n */\nexport function pushToDataLayer(event: string, context: EventContext) {\n const targetWindow = context.window || (typeof window !== 'undefined' ? window : null);\n if (!targetWindow) return;\n\n const payload = Object.assign({}, context);\n delete payload.window; // delete window prop and avoid to push as payload to dayalayer\n\n const eventName = event.toUpperCase() as EventName;\n const eventConfig = EVENTS[eventName] as { hasEcommerce: boolean };\n\n targetWindow.dataLayer = targetWindow.dataLayer || [];\n\n if (eventConfig?.hasEcommerce) {\n targetWindow.dataLayer.push({ ecommerce: null });\n targetWindow.dataLayer.push({ event: event, ecommerce: payload });\n } else {\n targetWindow.dataLayer.push({ event: event, ...payload });\n }\n}","import { EventContext } from \"../types\";\n\nexport function dataTrackingLog(data: EventContext, color: string) {\n console.log(\n `%c[DT] EVENTO DISPARADO:%c `,\n `background: ${color}; color: white; font-weight: bold; padding: 2px 4px; border-radius: 3px;`,\n 'color: #fff;',\n data || ''\n );\n}\n\nexport function setCookie(name: string, value: string, days = 7) {\n const encodedValue = encodeURIComponent(value);\n\n let expires = \"\";\n if (days) {\n const date = new Date();\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = \"; expires=\" + date.toUTCString();\n }\n\n document.cookie = `${name}=${encodedValue}${expires}; path=/;`;\n}\n\nexport const paymentTypeMap = [\n ['vale', 'vale crédito'],\n ['pagaleve', 'pix'],\n ['pix parcel', 'pix parcelado'],\n ['pix', 'pix'],\n ['apple', 'apple pay'],\n ['google', 'google pay'],\n ['boleto', 'boleto'],\n ['paypal', 'paypal'],\n ['cred', 'cartão'],\n ['visa', 'cartão'],\n ['master', 'cartão'],\n ['amex', 'cartão'],\n ['elo', 'cartão'],\n ['hiper', 'cartão'],\n ['diner', 'cartão'],\n ['deb', 'cartão'],\n];\n\n\nexport const toNum = (val: unknown) => typeof val === 'string' ? Number(val.replace(/[^\\d,]/g, '').replace(',', '.')) : val","import { dataTrackingLog } from \"../core/utils\";\nimport type { EventContext } from \"../types\";\n\nexport function pushToDito(event: string, ecomm: EventContext) {\n dataTrackingLog({ id: event, custom_data: ecomm }, '#00c851');\n}","import { EVENTS } from '../core/constants';\nimport { pushToDataLayer } from './datalayer';\nimport { pushToDito } from './dito';\n\nimport type { EventName, EventContext } from '../types'\n\nconst adapters = {\n DataLayer: pushToDataLayer,\n Dito: pushToDito,\n};\n\ntype AdapterKey = keyof typeof adapters;\n\n/**\n * Dispatches a tracking event to all destinations configured for the given event.\n *\n * Looks up destinations from the EVENTS configuration, calls each destination adapter\n * in parallel (providing the event name in lowercase and the supplied context), and\n * waits for all attempts to settle. Individual adapter failures are logged with the\n * \"[DT]\" prefix but do not prevent other destinations from running.\n *\n * @param eventName - The name of the event to dispatch\n * @param data - The event context/payload to send to adapters\n */\nexport async function dispatchTrackEvent(eventName: EventName, data: EventContext) {\n const eventConfig = EVENTS[eventName] as { destinations: string[] };\n\n if (!eventConfig) return;\n\n await Promise.allSettled(\n eventConfig.destinations.map(async (dest: string) => {\n try {\n // call the adapter function based on the destination mapped in the adapters object\n // eventName is converted to lowercase to match the expected format in all adapters\n await adapters[dest as AdapterKey](eventName.toLowerCase(), data);\n } catch (err) {\n console.error(`[DT] Failed to send ${eventName} to ${dest}:`, err);\n }\n })\n );\n}\n","/**\n * Fetches product data for the given product id from the catalog API.\n *\n * @param id - The product identifier used as the `productId` query filter\n * @returns The parsed JSON response containing product data, or `undefined` if the request fails\n */\nexport async function getProductDataById(id: any) {\n try {\n const response = await fetch(\n `/api/catalog_system/pub/products/search?fq=productId:${id}`\n );\n\n return await response.json();\n } catch (e) {\n console.log('[DT] Erro ao buscar dados do produto', e);\n }\n}\n\nexport function isPDP(url: string) {\n try {\n const { pathname } = new URL(url, window.location.origin);\n return /\\/p\\/?$/.test(pathname);\n } catch {\n return false;\n }\n}\n\nexport function extractRefIdFromUrl(url: string | null) {\n if (!url) return null;\n\n const path = (() => {\n try { return new URL(url, location.origin).pathname }\n catch { return url.split('?')[0] }\n })();\n\n const match = decodeURIComponent(path).match(/(\\d+-\\d+)(?=\\/p|$)/);\n return match ? match[1].replace('-', '_') : null;\n}\n\nexport async function getProductByRefId(url: string | null) {\n const refId = extractRefIdFromUrl(url);\n if (!refId) return console.error('Não foi possível extrair o RefId da URL'), null;\n\n try {\n const res = await fetch(`/api/catalog_system/pub/products/search?fq=alternateIds_RefId:${refId}`);\n if (!res.ok) throw new Error(`Erro na API: ${res.status}`);\n\n const products = await res.json();\n return products?.[0] || null;\n } catch (err) {\n console.error('Erro ao buscar dados do produto:', err);\n return null;\n }\n}\n\nexport function getItemShippingTier(orderForm: any, item: any) {\n const info = orderForm?.shippingData?.logisticsInfo?.find(\n (li: any) => li.itemId === item.id\n );\n\n const selectedSla = info?.slas?.find((sla: any) => sla.id === info.selectedSla);\n return selectedSla?.pickupStoreInfo?.friendlyName\n ? `retirada em loja: ${selectedSla.pickupStoreInfo.friendlyName}`\n : selectedSla?.name\n ? `Receba em casa: ${selectedSla.name}`\n : null;\n}\n\nexport async function getItemSku(item: any) {\n const product = await getProductDataById(item.productId || item.productID || item.item_group_id);\n\n if (!product.length) return null;\n\n return product[0].items.find((i: any) => i.name === item.skuName)?.itemId ?? null;\n}\n\nexport function getDiscount(item: any) {\n const strategies = [\n // 1. listPrice - sellingPrice\n () => {\n if (item?.listPrice != null && item?.sellingPrice != null) {\n const diff = Math.max(item.listPrice - item.sellingPrice, 0);\n return diff ? parseFloat((diff / 100).toFixed(2)) : 0;\n }\n return null;\n },\n\n // 2. listPrice - price\n () => {\n if (item?.listPrice != null && item?.price != null) {\n return Math.max(item.listPrice - item.price, 0);\n }\n return null;\n },\n\n // 3. desconto calculado.\n () => (item?.discount || item?.discount === 0 ? item.discount : null),\n ];\n\n for (const getValue of strategies) {\n const value = getValue();\n\n if (value !== null && value !== undefined) {\n return value;\n }\n }\n\n return 0;\n}\n\nexport function getItemCategory(item: any) {\n const strategies = [\n () => {\n const stringCategories = (item?.categories || item?.productCategories).toString().toLowerCase();\n const hasOutletSaleOrBazar = stringCategories.includes('outlet') || stringCategories.includes('sale') || stringCategories.includes('bazar') \n return hasOutletSaleOrBazar ? item?.brand === \"By NV\" ? 'Outlet' : 'Sale' : 'Coleção'\n },\n () => item?.item_category,\n () => item?.category,\n () => item?.categories[0],\n () => {\n /* \n Regra: percorre o array itemListElement buscando a categoria de nível raiz,\n identificada por URLs no formato \"/slug/\" (apenas um nível, ex: \"/bazar/\", \"/new-collection/\").\n Retorna o `name` correspondente a esse item.\n */\n const breadcrumb = item?.itemOffered?.breadcrumbList?.itemListElement;\n\n if (!Array.isArray(breadcrumb)) return null;\n\n const level1 = breadcrumb.find((el) => {\n const path = el?.item;\n if (!path) return false;\n\n // remove \"/\" do início/fim e divide\n const parts = path.replace(/^\\/|\\/$/g, '').split('/');\n\n return parts.length === 1;\n });\n\n return level1?.name || null;\n }\n ];\n\n for (const getValue of strategies) {\n const value = getValue();\n\n if (value !== null && value !== undefined) {\n return value;\n }\n }\n\n return null\n\n}\n\nexport function getItemCategory2(item: any) {\n const strategies = [\n () => Object.values(item?.productCategories || {}).pop(), // checkout select_item context\n () => Object.values(item?.categories || {}).pop(),\n () => item?.category?.split?.('>')?.[1]?.trim?.(), // deco select_item context\n () => item.item_category2, // deco add_to_cart context PDP\n () => item?.subGrup,\n ];\n\n for (const getValue of strategies) {\n const value = getValue();\n\n if (value !== null && value !== undefined) {\n return value;\n }\n }\n\n return null;\n}\n\nexport function getItemCategory4(item: any) {\n const tags = item?.additionalInfo?.tags || item?.tags;\n return Array.isArray(tags) && tags.length ? tags.join(',') : null;\n}\n\nconst BRAND_CODES = {\n farm: 'farmrio',\n 'farm etc': 'farmetc',\n 'farm rio': 'farmrio',\n} as const;\n\ntype Standardized = keyof typeof BRAND_CODES\ninterface BrandItem {\n brand?: string;\n additionalInfo?: {\n brandName?: string;\n };\n}\n\n/**\n * Extrai o código padronizado (ex: 'farmrio') de uma única string de marca.\n * Retorna null se não houver mapeamento.\n */\nfunction getBrandCode(brand: string | undefined): string | null {\n if (!brand) return null;\n const standardized = brand.toLowerCase().trim();\n return BRAND_CODES[standardized as Standardized] || null;\n}\n\n/**\n * Função principal que padroniza a marca ou lista de marcas para o formato final:\n * 'farmrio', 'farmetc', ou 'farmrio_farmetc'.\n */\nexport function normalizeBrand(input: string | BrandItem[] | BrandItem | string[] | undefined | null) {\n let brandStrings = [];\n\n if (Array.isArray(input) && input.every(item => typeof item === 'string')) {\n brandStrings = input as string[];\n } else if (Array.isArray(input)) {\n // Se for um Array, coleta a string da marca de cada item.\n brandStrings = input.map(item => item.additionalInfo?.brandName || item.brand);\n } else if (typeof input === 'object' && input !== null && 'brand' in input) {\n // Se for um Objeto único, trata como um Array de um único item (para reuso de lógica).\n brandStrings = [(input as BrandItem).additionalInfo?.brandName || (input as BrandItem).brand];\n } else if (typeof input === 'string') {\n // Se for uma String (mal formatada ou não), trata diretamente.\n return getBrandCode(input);\n } else {\n // Se for undefined, null, ou outro tipo não esperado.\n return null;\n }\n\n const brandCodes = brandStrings\n .map(getBrandCode)\n .filter((code): code is string => code !== null); // ['farmrio', 'farmetc', 'farmrio']\n\n const uniqueSortedCodes = [...new Set(brandCodes)].sort(); // ['farmetc', 'farmrio']\n\n // Retorna a combinação ('farmrio', 'farmetc', ou 'farmrio_farmetc').\n return uniqueSortedCodes.length > 0 ? uniqueSortedCodes.join('_') : null;\n}\n","import { normalizeBrand } from '../../utils';\n\nexport function brandFromOrderForm(context: Record<string, any>) {\n if (!context.orderForm && !context.orderForm.items?.length) return null;\n\n const items = context.orderForm.items;\n\n return normalizeBrand(items);\n}\n","import { normalizeBrand } from '../../utils';\n\nexport function brandFromItem(context: Record<string, any>) {\n const { item } = context;\n\n return normalizeBrand(item?.additionalInfo?.brandName || item.brand || item.item_brand);\n}\n","import { brandFromOrderForm } from './resolvers/brand/fromOrderForm';\nimport { brandFromItem } from './resolvers/brand/fromItem';\nimport { normalizeBrand } from './utils';\nimport type { EventContext, EventName } from '../types';\n\n/**\n * Determines the brand for an event by using the context or extracting it based on the event type.\n *\n * Prefers `context.brand` when present; otherwise selects a resolver based on `eventName` to extract the brand.\n *\n * @param context - The event context which may already contain a `brand` or provide data for extraction\n * @param eventName - The event name used to choose the extraction strategy\n * @returns The resolved brand value, or `null` if no brand could be determined\n */\nexport function getBrand(context: EventContext, eventName: EventName) {\n if (context?.brand) return normalizeBrand(context.brand) || context.brand || null;\n\n switch (eventName) {\n case 'CUSTOM_VIEW_CART':\n case 'ADD_COUPON':\n case 'ADD_PERSONAL_INFO':\n case 'CUSTOM_ADD_SHIPPING_INFO':\n case 'CUSTOM_ADD_PAYMENT_INFO':\n case 'BEGIN_CHECKOUT':\n case 'CUSTOM_BEGIN_CHECKOUT':\n case 'SEARCH_ZIPCODE':\n case 'ORDER_REVIEWED':\n case 'PURCHASE':\n case 'CUSTOM_PURCHASE':\n return brandFromOrderForm(context);\n case 'ADD_TO_CART':\n case 'REMOVE_FROM_CART':\n return brandFromItem(context);\n default:\n return null;\n }\n}\n","import type { EventContext } from '../../../types';\n\nimport {\n getItemSku,\n getDiscount,\n getItemCategory,\n getItemCategory2,\n getItemCategory4,\n getItemShippingTier,\n normalizeBrand,\n} from '../../utils';\n\n/**\n * Builds an array of normalized item objects from the order form contained in the given context.\n *\n * @param context - EventContext containing an orderForm with items to convert\n * @returns An array of item-like objects derived from `context.orderForm.items`, each containing fields such as `item_id`, `price`, `quantity`, `item_sku`, `item_name`, category and variant attributes, and `discount`\n */\nexport async function itemsFromOrderForm(context: EventContext) {\n const items = context.orderForm?.items || [];\n\n if (!items.length) return [];\n\n return await Promise.all(\n items.map(async (item: EventContext) => ({\n item_id: item.productId,\n item_category2: getItemCategory2(item),\n item_category4: getItemCategory4(item),\n item_shipping_tier: getItemShippingTier(context.orderForm, item),\n price: parseFloat(((item.listPrice || item.price) / 100).toFixed(2)) || 0,\n quantity: item.quantity || 1,\n item_ref: item.refId || null,\n item_brand: normalizeBrand(item.additionalInfo?.brandName) || item.additionalInfo?.brandName || null,\n item_sku: (await getItemSku(item)) || item.id || null,\n item_name: item.name.split(' - ').shift() || item.id || null,\n item_category: getItemCategory(item) || null,\n item_variant: item.skuName.split(/[-/]/)[0].trim(),\n item_variant2: item.skuName.split(/[-/]/).pop()?.trim() || '',\n discount: getDiscount(item),\n }))\n );\n}\n","import {\n getItemSku,\n getDiscount,\n getItemCategory,\n getItemCategory2,\n getItemCategory4,\n getItemShippingTier,\n} from '../../utils';\n\nexport async function itemsFromItem(context: Record<string, any>, event: string) {\n const { item, orderForm, itemListName } = context;\n return [\n {\n index: typeof item?.index === 'number' ? item.index : null,\n quantity: 1,\n item_id: item?.productId|| item?.item_group_id || item?.sku || item?.id || null,\n item_category2: getItemCategory2(item),\n item_category4: getItemCategory4(item),\n item_shipping_tier: event === 'REMOVE_FROM_CART' ? getItemShippingTier(orderForm, item) : null,\n price: item?.listPrice || item?.price || 0,\n item_ref: item?.ref || item?.refId || item?.item_ref || item?.additionalProperty?.find((i: { name: string }) => i.name === \"RefId\").value || item?.itemOffered?.gtin.substring(0, item?.itemOffered?.gtin.lastIndexOf('_')) || null,\n item_brand: item?.additionalInfo?.brandName || item?.item_brand || item?.brand?.name || item?.itemOffered?.brand?.name || null,\n item_sku: item?.sku || item?.itemOffered?.sku || item?.item_id || item?.id || (await getItemSku(item)) || null,\n item_name: item?.name || item?.item_name || item?.itemOffered?.isVariantOf?.name || null,\n item_category: getItemCategory(item) || null,\n item_variant: (item?.skuName || item?.item_variant || item?.name || item?.itemOffered.name).split(/[-/]/)[0].trim() || null,\n item_variant2: item?.size || item?.itemAttributes?.size || (item?.skuName || item?.name || item?.itemOffered.name)?.split(/[-/]/).pop()?.trim() || null,\n discount: getDiscount(item),\n item_list_name: itemListName || null,\n\n item_url: item?.item_url || null, // add_to_cart dito\n },\n ];\n}\n ","import { getDiscount, getItemCategory, getItemCategory2, normalizeBrand } from '../../utils';\n\nexport async function itemsFromList(context: Record<string, any>) {\n return (context?.list || []).map((item: any) => {\n return {\n price: item?.price?.list || item?.price || item?.offers?.lowPrice || item?.priceRange?.listPrice?.highPrice || null,\n quantity: 1,\n item_ref: item?.ref || item?.item_ref || item?.referenceId?.[0].Value || item?.productReference || item?.additionalProperty.find((i: { name: string }) => i.name === \"RefId\").value || null,\n index: typeof context?.index === 'number' ? context.index : Number(item?.index),\n item_brand: item?.item_brand ? item.item_brand : item.isNotFarm ? item?.item_brand : normalizeBrand(item?.brand?.name) || normalizeBrand(context.brand) || normalizeBrand(item?.item_brand) || null,\n item_name: item?.productName?.split(' - ').shift() || item?.alternateName?.split(' - ').shift() || item?.item_name?.split(' - ').shift() || item?.seo?.title?.split(' - ').shift() || null,\n item_category: getItemCategory(item) || null,\n item_variant: item?.name?.split(\"-\")?.[0].trim() || item?.item_variant || item?.productName?.split(\"-\")?.[1].trim() || null,\n item_category2: getItemCategory2(item) || null,\n item_id: item?.productID || item?.productId || item?.item_id || item?.id || null,\n discount: getDiscount(item) || null,\n item_list_name: context?.itemListName || getItemCategory(item) || null,\n }\n })\n}\n","import {\n getDiscount,\n getItemCategory,\n getItemCategory2,\n normalizeBrand,\n} from '../../utils';\n\nexport async function itemsFromPDP(context: Record<string, any>) {\n const { item, value, brand } = context;\n\n return [\n {\n price: value || 0,\n quantity: 1,\n item_ref: item?.ref || item?.additionalProperty?.find((i: { name: string }) => i.name === \"RefId\").value || item?.productReference || null,\n item_brand: item.isNotFarm ? item?.item_brand : normalizeBrand(item?.brand.name) || normalizeBrand(brand) || null,\n item_name: item?.productName || item?.alternateName || null,\n item_category: getItemCategory(item) || null,\n item_variant: item?.name?.split(\"-\")[0].trim() || null,\n item_category2: getItemCategory2(item) || item?.category?.split(\">\")[1]?.trim() || null,\n item_id: item?.productID || item?.productId || item?.item_group_id || null,\n discount: getDiscount(item) || null,\n\n // dito params view_item\n item_sku: item?.sku || item?.productId || null,\n item_url: item?.url || item?.item_url || item?.link || null,\n seller_id: item?.seller || null\n },\n ];\n}\n","import {\n isPDP,\n normalizeBrand,\n getItemCategory,\n getItemCategory2,\n getProductByRefId,\n extractRefIdFromUrl,\n} from '../../utils';\n\nexport async function itemsFromBanner(context: Record<string, any>) {\n const isUrlFromPDP = isPDP(context?.bannerUrl);\n\n if (!isUrlFromPDP) return [];\n\n const product = await getProductByRefId(context?.bannerUrl);\n\n const item = product?.items[0];\n\n return {\n price: item?.sellers[0].commertialOffer.Price || 0,\n quantity: 1,\n item_ref: extractRefIdFromUrl(context?.bannerUrl),\n item_brand: normalizeBrand(product.brand) || null,\n item_name: product?.productName || product?.alternateName || product?.item_name || null,\n item_category: getItemCategory(product) || null,\n item_variant: item?.name?.split(\"-\").pop().trim() || null,\n item_category2: getItemCategory2(product) || null,\n item_id: product?.productId || null,\n discount: item?.sellers[0].commertialOffer.ListPrice - item?.sellers[0].commertialOffer.Price || null,\n }\n}\n","import { itemsFromOrderForm } from './resolvers/items/fromOrderForm';\nimport { itemsFromItem } from './resolvers/items/fromItem';\nimport { itemsFromList } from './resolvers/items/fromList';\nimport { itemsFromPDP } from './resolvers/items/fromPdp';\nimport { itemsFromBanner } from './resolvers/items/fromBanner';\n\n/**\n * Selects the appropriate item resolver based on the event name and returns its result.\n *\n * @param context - Runtime context passed to the selected resolver\n * @param eventName - Event identifier that determines which resolver to use\n * @returns The resolved items for the event, or `null` if the event is not recognized\n */\nexport function getItems(context: Record<string, any>, eventName: string) {\n if (context?.items) return context.items;\n\n switch (eventName) {\n case 'CUSTOM_VIEW_CART':\n case 'BEGIN_CHECKOUT':\n case 'CUSTOM_BEGIN_CHECKOUT':\n case 'CUSTOM_ADD_SHIPPING_INFO':\n case 'CUSTOM_ADD_PAYMENT_INFO':\n case 'PURCHASE':\n case 'CUSTOM_PURCHASE':\n return itemsFromOrderForm(context);\n case 'ADD_TO_CART':\n case 'ADD_TO_WISHLIST':\n case 'REMOVE_FROM_CART':\n return itemsFromItem(context, eventName);\n case 'SELECT_ITEM':\n case 'VIEW_ITEM_LIST':\n return itemsFromList(context)\n case 'VIEW_ITEM':\n case 'CUSTOM_VIEW_ITEM':\n return itemsFromPDP(context)\n case 'VIEW_PROMOTION':\n case 'SELECT_PROMOTION':\n return itemsFromBanner(context)\n default:\n return null;\n }\n}\n","import { paymentTypeMap } from \"../../../core/utils\";\n\nexport function paymentTypeFromOrderForm(context: Record<string, any>) {\n if (!context.orderForm) return null;\n\n const payments = context.orderForm.paymentData?.payments || [];\n const systems = context.orderForm.paymentData?.paymentSystems || [];\n if (!payments.length || !systems.length) return null;\n\n const selectedPayment = payments.find((p: { paymentSystem: string }) => p?.paymentSystem) || payments[0];\n const id = String(selectedPayment?.paymentSystem || '').trim();\n if (!id) return null;\n\n const system = systems.find((s: { id: string }) => String(s.id) === id);\n const name = system?.name?.toLowerCase() || '';\n const match = paymentTypeMap.find(([key]) => name.includes(key));\n\n return match ? match[1] : null;\n}\n","import { paymentTypeMap } from \"../../../core/utils\";\n\nexport function paymentTypeFromOrderGroup(context: Record<string, any>) {\n if (!context.orderForm) return null;\n\n const transactions = context.orderForm.paymentData?.transactions || [];\n if (!transactions.length) return null;\n\n const payments = transactions[0]?.payments || [];\n if (!payments.length) return null;\n\n const name = payments[0]?.paymentSystemName?.toLowerCase() || '';\n const match = paymentTypeMap.find(([key]) => name.includes(key));\n\n return match ? match[1] : null;\n}\n","import { paymentTypeFromOrderForm } from './resolvers/paymentType/fromOrderForm';\nimport { paymentTypeFromOrderGroup } from './resolvers/paymentType/fromOrderGroup';\n\n/**\n * Selects the appropriate payment_type resolver based on the event name and returns its result.\n *\n * @param context - Runtime context passed to the selected resolver\n * @param eventName - Event identifier that determines which resolver to use\n * @returns The resolved payment_type for the event, or `null` if the event is not recognized\n */\nexport function getPaymentType(context: Record<string, any>, eventName: string) {\n if (context?.paymentType) return context.paymentType;\n\n switch (eventName) {\n case 'ORDER_REVIEWED':\n case 'CUSTOM_ADD_PAYMENT_INFO':\n return paymentTypeFromOrderForm(context);\n case 'PURCHASE':\n case 'CUSTOM_PURCHASE':\n return paymentTypeFromOrderGroup(context)\n default:\n return null;\n }\n}\n","import type { EventContext, EventName, LogisticInfo } from '../types';\nimport { getBrand } from './brand';\nimport { getItems } from './items';\nimport { getPaymentType } from './paymentType';\nimport { toNum } from '../core/utils';\n\n\nexport const paramGetters = {\n brand: getBrand,\n\n items: getItems,\n\n payment_type: getPaymentType,\n\n user_info: async (context: EventContext, eventName: EventName) => {\n const PROD_DOMAINS: Record<string, Record<string, string>> = {\n \"animale\": {\n \"store\": \"https://www.animale.com.br\",\n \"checkout\": \"https://secure.animale.com.br\",\n },\n \"farm\": {\n \"store\": \"https://lojafarm.myvtex.com\"\n },\n \"mariafilo\": {\n \"store\": \"https://mariafilo.myvtex.com\",\n \"checkout\": \"https://secure.mariafilo.com.br\",\n },\n \"lojacrisbarros\": {\n \"store\": \"https://lojacrisbarros.myvtex.com\",\n \"checkout\": \"https://secure.crisbarros.com.br\",\n },\n \"lojaoffpremium\": {\n \"store\": \"https://lojaoffpremium.myvtex.com\",\n \"checkout\": \"https://secure.lojaoffpremium.com.br\",\n },\n };\n\n const domain = PROD_DOMAINS[context.account || 'https://www.animale.com.br']?.[context.platform || 'store'];\n\n if (!domain) return { customer: { email: context.userEmail, id: context?.userId }, address: null };\n\n try {\n const api = `${domain}/_v/user-info`;\n const response = await fetch(api, {\n method: 'POST',\n body: JSON.stringify({ email: context.userEmail })\n });\n\n if (response.status !== 200) {\n return { customer: { email: context.userEmail, id: context?.userId }, address: null };\n }\n\n return await response.json();\n } catch (_) {\n return { customer: { email: context.userEmail, id: context?.userId }, address: null };\n }\n },\n\n content_type: (context: EventContext, eventName: EventName) => {\n return `regiao`\n .concat(':' + context.category)\n .concat(context.subcategory ? ':' + context.subcategory : '')\n .concat(':' + context.componentName) || null\n },\n\n region: (context: EventContext, eventName: EventName) => {\n return context.region || null;\n },\n\n line_items: (context: EventContext, eventName: EventName) => {\n if (context?.lineItems) return context.lineItems;\n\n if (context?.item) {\n return [context.item.productId || context.item.productID || context.item.item_id];\n }\n\n if (context?.list) {\n return context.list.map((item: { productID: string, id: string, productId: string }) => item?.productID || item?.id || item?.productId)\n }\n\n return (context.orderForm.items || [])\n .map((item: EventContext) => item.productId)\n .join(',');\n },\n\n currency: (context: EventContext, eventName: EventName) => {\n if (context?.currency) return context.currency\n\n if (context?.bannerUrl) return 'BRL'\n\n if (context?.item) {\n return context.item?.offers?.priceCurrency || 'BRL'\n }\n\n return context.orderForm?.storePreferencesData?.currencyCode || null;\n },\n\n value: (context: EventContext, eventName: EventName) => {\n if (context?.value) return toNum(context.value)\n\n return context.item ? toNum(context.item?.price) : context.orderForm?.value != null\n ? context.orderForm.value / 100\n : null;\n },\n\n total_discount: (context: EventContext, eventName: EventName) => {\n if (context?.totalDiscount) return context.totalDiscount\n\n const totalsList = context.orderForm?.totalizers || context.orderForm?.totals || []; // totals for ordergroup and orderform have different names\n const items = context.orderForm.items;\n const totalDiscount = items.reduce((acc: number, item: { quantity: number, listPrice: number, sellingPrice: number }) => {\n const unitDiscount = Math.max(0, item.listPrice - item.sellingPrice);\n return acc + (unitDiscount * item.quantity);\n }, 0);\n\n const discounts = totalsList.find((t: { id: string }) => t.id === 'Discounts');\n return Math.abs((discounts?.value || 0) + totalDiscount) / 100 || null;\n },\n\n subtotal: (context: EventContext, eventName: EventName) => {\n const totalsList = context.orderForm?.totalizers || context.orderForm?.totals || []; // totals for ordergroup and orderform have different names\n\n const subtotal =\n totalsList\n .filter((t: EventContext) => t.id === 'Items')\n .reduce((acc: number, t: EventContext) => acc + (t.value || 0), 0) / 100 || 0;\n\n return subtotal\n },\n\n coupon_message: (context: EventContext, eventName: EventName) => {\n if (context.couponMessage) return context.couponMessage;\n\n const messages = context.orderForm?.messages || [];\n\n if (messages.length === 0) return null;\n\n const couponMessages = messages.filter((msg: EventContext) =>\n msg.text.toLowerCase().includes('cupom')\n );\n\n if (couponMessages.length === 0) return null;\n\n return couponMessages.map((msg: EventContext) => msg.text).join(' | ');\n },\n\n seller_cod_name: (context: EventContext, eventName: EventName) => {\n return context.appliedSellerCodName || context?.orderForm.marketingData.utmiCampaign || null;\n },\n\n coupon: (context: EventContext, eventName: EventName) => {\n return context.appliedCoupon || context?.orderForm?.marketingData?.coupon || null;\n },\n\n pre_filled: (context: EventContext, eventName: EventName) => {\n return !!context.preFilled;\n },\n\n search_term: (context: EventContext, eventName: EventName) => {\n return context.searchTerm || null;\n },\n\n search_found: (context: EventContext, eventName: EventName) => {\n return !!context.searchFound;\n },\n\n search_quantity: (context: EventContext, eventName: EventName) => {\n return context.searchQuantity || 0;\n },\n\n promotion_name: (context: EventContext, eventName: EventName) => {\n return context.promotionName || null;\n },\n\n creative_name: (context: EventContext, eventName: EventName) => {\n return context.creativeName || null;\n },\n\n creative_slot: (context: EventContext, eventName: EventName) => {\n return context.creativeSlot || null;\n },\n\n zipcode: (context: EventContext, eventName: EventName) => {\n return context.zipCode || null;\n },\n\n size: (context: EventContext, eventName: EventName) => {\n return context.size || null;\n },\n\n item_ref: (context: EventContext, eventName: EventName) => {\n return context.itemRef || null;\n },\n\n flag_pickup: (context: EventContext, eventName: EventName) => {\n const orderForm = context.orderForm;\n if (!orderForm) return null;\n\n const logisticsInfo = orderForm.shippingData?.logisticsInfo || [];\n const hasPickup = logisticsInfo.some((info: LogisticInfo) =>\n info.slas?.some((sla) => sla.deliveryChannel === 'pickup-in-point')\n );\n\n return hasPickup\n },\n\n shippings: (context: EventContext, eventName: EventName) => {\n const orderForm = context.orderForm;\n if (!orderForm) return null;\n\n const groupShipping: Record<string, any> = {};\n\n for (const info of orderForm.shippingData.logisticsInfo) {\n const item = orderForm.items[info.itemIndex]\n if (!item) continue\n\n for (const sla of info.slas) {\n const key = sla.name\n\n if (!groupShipping[key]) {\n groupShipping[key] = {\n shipping_tier: sla.name,\n delivery_time: parseInt(sla.shippingEstimate),\n shipping: parseFloat((sla.price / 100).toFixed(1)),\n line_items: []\n }\n }\n\n groupShipping[key].line_items.push(item.id)\n }\n }\n\n const shippings = Object.values(groupShipping).map((s) => ({\n shipping: s.shipping,\n shipping_tier: s.shipping_tier,\n delivery_time: s.delivery_time,\n line_items: s.line_items.join(',')\n }))\n\n return shippings || null\n },\n\n shipping: (context: EventContext, eventName: EventName) => {\n const logistics = context?.orderForm?.shippingData?.logisticsInfo ?? []\n return logistics.reduce((total: number, item: any) => {\n const selected = item.slas?.find((sla: any) => sla.id === item.selectedSla)\n return total + (selected?.price ?? 0)\n }, 0)\n },\n\n shipping_tier: (context: EventContext, eventName: EventName) => {\n const logistics = context?.orderForm?.shippingData?.logisticsInfo ?? []\n const selectedSlas = logistics\n .map((item: {\n selectedSla?: string,\n slas?: Array<{\n id: string,\n deliveryChannel: string,\n name?: string,\n pickupStoreInfo?: { friendlyName?: string }\n }>\n }) => {\n if (!item.selectedSla) return null;\n return item.slas?.find((sla) => sla.id === item.selectedSla) || null;\n })\n .filter(Boolean) as Array<{\n deliveryChannel: string,\n name?: string,\n pickupStoreInfo?: { friendlyName?: string }\n }>;\n\n if (selectedSlas.length === 0) return null;\n\n const uniqueTiers = Array.from(\n new Map(\n selectedSlas.map((sla) => {\n const key = sla.deliveryChannel === 'pickup-in-point'\n ? `pickup:${sla.pickupStoreInfo?.friendlyName || sla.name || ''}`\n : `delivery:${sla.name || ''}`;\n return [key, sla];\n })\n ).values()\n );\n\n const sortedTiers = uniqueTiers.sort((a, b) => {\n const aOrder = a.deliveryChannel === 'pickup-in-point' ? 0 : 1;\n const bOrder = b.deliveryChannel === 'pickup-in-point' ? 0 : 1;\n if (aOrder !== bOrder) return aOrder - bOrder;\n\n const aLabel = a.deliveryChannel === 'pickup-in-point'\n ? (a.pickupStoreInfo?.friendlyName || a.name || '')\n : (a.name || '');\n const bLabel = b.deliveryChannel === 'pickup-in-point'\n ? (b.pickupStoreInfo?.friendlyName || b.name || '')\n : (b.name || '');\n\n return aLabel.localeCompare(bLabel, 'pt-BR');\n });\n\n const shippingTier = sortedTiers\n .map((sla) => (\n sla.deliveryChannel === 'pickup-in-point'\n ? `retirada em loja${sla.pickupStoreInfo?.friendlyName ? `: ${sla.pickupStoreInfo.friendlyName}` : ''}`\n : sla.deliveryChannel === 'delivery'\n ? `receba em casa${sla.name ? `: ${sla.name}` : ''}`\n : null\n ))\n .filter(Boolean)\n .join(', ');\n\n return shippingTier || null;\n },\n\n transaction_id: (context: EventContext, eventName: EventName) => {\n return context.orderForm?.orderGroup?.toString() || null;\n },\n\n available_grid: (context: EventContext, eventName: EventName) => {\n return context.availableGrid || null;\n },\n}","import { EVENTS } from '../core/constants';\nimport { paramGetters } from '../params';\nimport type { EventName, EventContext } from '../types'\n\ntype ParamName = keyof typeof paramGetters;\n\n/**\n * Resolve and return the required parameters for a given event.\n *\n * @param context - Context passed to each parameter getter (defaults to an empty object)\n * @param eventName - The event whose required parameters should be resolved\n * @returns An object mapping each required parameter name to its resolved value (`null` when a param getter is missing), or `undefined` if the event has no configuration\n */\nexport async function getParameters(context: EventContext = {}, eventName: EventName) {\n const eventConfig = EVENTS[eventName] as { requiredParams: string[] };\n\n if (!eventConfig) return;\n\n const params = Object.fromEntries(\n await Promise.all(\n eventConfig.requiredParams.map(async (param) => {\n const getter = paramGetters[param as ParamName];\n\n if (typeof getter !== 'function') {\n console.error(`[DT] Missing paramGetter for param: ${param}`);\n return [param, null]; // ou undefined\n }\n \n return [param, await getter(context, eventName)];\n })\n )\n );\n\n return params;\n}\n","import { dispatchTrackEvent } from './adapters';\nimport { getParameters } from './formatter';\nimport { EVENTS } from './core/constants';\nimport type { EventContext, EventName } from './types';\n\n/**\n * Assembles tracking parameters and sends a web tracking event.\n *\n * @param event - The name of the event to track.\n * @param context - Optional context used to build event parameters; may include a `window` property that will be attached to the dispatched payload.\n * @returns The result returned by `dispatchTrackEvent` when the event is sent successfully, or the value returned by `console.error` (`undefined`) if an error occurs.\n */\nasync function trackWebEvent(event: EventName, context: EventContext = {}) {\n try {\n // object data to be sent\n const parameters = await getParameters(context, event);\n\n // function to send event\n return await dispatchTrackEvent(\n event,\n Object.assign({}, parameters, { window: context.window })\n );\n } catch (err) {\n return console.error(`[DT] Error tracking event ${event}:`, err);\n }\n}\n\nexport { trackWebEvent, EVENTS };\n\nexport default {\n trackWebEvent,\n EVENTS,\n}\n"],"mappings":";AAAO,IAAM,SAAS;AAAA,EACpB,kBAAkB;AAAA,IAChB,MAAM;AAAA,IACN,cAAc;AAAA,IACd,cAAc,CAAC,WAAW;AAAA,IAC1B,gBAAgB;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,iBAAiB;AAAA,IACf,MAAM;AAAA,IACN,cAAc;AAAA,IACd,cAAc,CAAC,WAAW;AAAA,IAC1B,gBAAgB;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,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AO,SAAS,SAAS,CAAC;AAAA,MACjD,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;;;ACtBA,eAAe,cAAc,OAAkB,UAAwB,CAAC,GAAG;AACzE,MAAI;AAEF,UAAM,aAAa,MAAM,cAAc,SAAS,KAAK;AAGrD,WAAO,MAAM;AAAA,MACX;AAAA,MACA,OAAO,OAAO,CAAC,GAAG,YAAY,EAAE,QAAQ,QAAQ,OAAO,CAAC;AAAA,IAC1D;AAAA,EACF,SAAS,KAAK;AACZ,WAAO,QAAQ,MAAM,6BAA6B,KAAK,KAAK,GAAG;AAAA,EACjE;AACF;AAIA,IAAO,cAAQ;AAAA,EACb;AAAA,EACA;AACF;","names":["_a","_a","_a","_b"]}
|
package/dist/mod.vtex.global.js
CHANGED
|
@@ -511,8 +511,9 @@ var AzzasTracker = function() {
|
|
|
511
511
|
var getItemCategory = function getItemCategory(item) {
|
|
512
512
|
var strategies = [
|
|
513
513
|
function() {
|
|
514
|
-
var
|
|
515
|
-
|
|
514
|
+
var stringCategories = ((item === null || item === void 0 ? void 0 : item.categories) || (item === null || item === void 0 ? void 0 : item.productCategories)).toString().toLowerCase();
|
|
515
|
+
var hasOutletSaleOrBazar = stringCategories.includes("outlet") || stringCategories.includes("sale") || stringCategories.includes("bazar");
|
|
516
|
+
return hasOutletSaleOrBazar ? (item === null || item === void 0 ? void 0 : item.brand) === "By NV" ? "Outlet" : "Sale" : "Cole\xE7\xE3o";
|
|
516
517
|
},
|
|
517
518
|
function() {
|
|
518
519
|
return item === null || item === void 0 ? void 0 : item.item_category;
|
|
@@ -568,10 +569,8 @@ var AzzasTracker = function() {
|
|
|
568
569
|
},
|
|
569
570
|
// checkout select_item context
|
|
570
571
|
function() {
|
|
571
|
-
|
|
572
|
-
return (_Object_values_pop = Object.values((item === null || item === void 0 ? void 0 : item.categories) || {}).pop()) === null || _Object_values_pop === void 0 ? void 0 : _Object_values_pop.slice(1, -1).replace(/\//g, ",");
|
|
572
|
+
return Object.values((item === null || item === void 0 ? void 0 : item.categories) || {}).pop();
|
|
573
573
|
},
|
|
574
|
-
//
|
|
575
574
|
function() {
|
|
576
575
|
var _item_category_split__trim, _item_category_split_, _item_category_split, _item_category_split1, _item_category;
|
|
577
576
|
return item === null || item === void 0 ? void 0 : (_item_category = item.category) === null || _item_category === void 0 ? void 0 : (_item_category_split1 = _item_category.split) === null || _item_category_split1 === void 0 ? void 0 : (_item_category_split = _item_category_split1.call(_item_category, ">")) === null || _item_category_split === void 0 ? void 0 : (_item_category_split_ = _item_category_split[1]) === null || _item_category_split_ === void 0 ? void 0 : (_item_category_split__trim = _item_category_split_.trim) === null || _item_category_split__trim === void 0 ? void 0 : _item_category_split__trim.call(_item_category_split_);
|
|
@@ -1075,20 +1074,20 @@ var AzzasTracker = function() {
|
|
|
1075
1074
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1076
1075
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1077
1076
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1078
|
-
var __export = function
|
|
1077
|
+
var __export = function(target, all) {
|
|
1079
1078
|
for(var name in all)__defProp(target, name, {
|
|
1080
1079
|
get: all[name],
|
|
1081
1080
|
enumerable: true
|
|
1082
1081
|
});
|
|
1083
1082
|
};
|
|
1084
|
-
var __copyProps = function
|
|
1083
|
+
var __copyProps = function(to, from, except, desc) {
|
|
1085
1084
|
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
1086
1085
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1087
1086
|
try {
|
|
1088
1087
|
var _loop = function() {
|
|
1089
1088
|
var key = _step.value;
|
|
1090
1089
|
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
1091
|
-
get: function
|
|
1090
|
+
get: function() {
|
|
1092
1091
|
return from[key];
|
|
1093
1092
|
},
|
|
1094
1093
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
@@ -1112,7 +1111,7 @@ var AzzasTracker = function() {
|
|
|
1112
1111
|
}
|
|
1113
1112
|
return to;
|
|
1114
1113
|
};
|
|
1115
|
-
var __toCommonJS = function
|
|
1114
|
+
var __toCommonJS = function(mod) {
|
|
1116
1115
|
return __copyProps(__defProp({}, "__esModule", {
|
|
1117
1116
|
value: true
|
|
1118
1117
|
}), mod);
|
|
@@ -1120,13 +1119,13 @@ var AzzasTracker = function() {
|
|
|
1120
1119
|
// src/index.ts
|
|
1121
1120
|
var src_exports = {};
|
|
1122
1121
|
__export(src_exports, {
|
|
1123
|
-
EVENTS: function
|
|
1122
|
+
EVENTS: function() {
|
|
1124
1123
|
return EVENTS;
|
|
1125
1124
|
},
|
|
1126
|
-
default: function
|
|
1125
|
+
default: function() {
|
|
1127
1126
|
return src_default;
|
|
1128
1127
|
},
|
|
1129
|
-
trackWebEvent: function
|
|
1128
|
+
trackWebEvent: function() {
|
|
1130
1129
|
return trackWebEvent;
|
|
1131
1130
|
}
|
|
1132
1131
|
});
|
|
@@ -1577,7 +1576,7 @@ var AzzasTracker = function() {
|
|
|
1577
1576
|
"cart\xE3o"
|
|
1578
1577
|
]
|
|
1579
1578
|
];
|
|
1580
|
-
var toNum = function
|
|
1579
|
+
var toNum = function(val) {
|
|
1581
1580
|
return typeof val === "string" ? Number(val.replace(/[^\d,]/g, "").replace(",", ".")) : val;
|
|
1582
1581
|
};
|
|
1583
1582
|
// src/adapters/index.ts
|
|
@@ -1595,7 +1594,7 @@ var AzzasTracker = function() {
|
|
|
1595
1594
|
brand: getBrand,
|
|
1596
1595
|
items: getItems,
|
|
1597
1596
|
payment_type: getPaymentType,
|
|
1598
|
-
user_info: function
|
|
1597
|
+
user_info: function(context, eventName) {
|
|
1599
1598
|
return _async_to_generator(function() {
|
|
1600
1599
|
var _PROD_DOMAINS_, PROD_DOMAINS, domain, api, response, _;
|
|
1601
1600
|
return _ts_generator(this, function(_state) {
|
|
@@ -1694,13 +1693,13 @@ var AzzasTracker = function() {
|
|
|
1694
1693
|
});
|
|
1695
1694
|
})();
|
|
1696
1695
|
},
|
|
1697
|
-
content_type: function
|
|
1696
|
+
content_type: function(context, eventName) {
|
|
1698
1697
|
return "regiao".concat(":" + context.category).concat(context.subcategory ? ":" + context.subcategory : "").concat(":" + context.componentName) || null;
|
|
1699
1698
|
},
|
|
1700
|
-
region: function
|
|
1699
|
+
region: function(context, eventName) {
|
|
1701
1700
|
return context.region || null;
|
|
1702
1701
|
},
|
|
1703
|
-
line_items: function
|
|
1702
|
+
line_items: function(context, eventName) {
|
|
1704
1703
|
if (context === null || context === void 0 ? void 0 : context.lineItems) return context.lineItems;
|
|
1705
1704
|
if (context === null || context === void 0 ? void 0 : context.item) {
|
|
1706
1705
|
return [
|
|
@@ -1716,7 +1715,7 @@ var AzzasTracker = function() {
|
|
|
1716
1715
|
return item.productId;
|
|
1717
1716
|
}).join(",");
|
|
1718
1717
|
},
|
|
1719
|
-
currency: function
|
|
1718
|
+
currency: function(context, eventName) {
|
|
1720
1719
|
var _context_orderForm_storePreferencesData, _context_orderForm;
|
|
1721
1720
|
if (context === null || context === void 0 ? void 0 : context.currency) return context.currency;
|
|
1722
1721
|
if (context === null || context === void 0 ? void 0 : context.bannerUrl) return "BRL";
|
|
@@ -1726,12 +1725,12 @@ var AzzasTracker = function() {
|
|
|
1726
1725
|
}
|
|
1727
1726
|
return ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_storePreferencesData = _context_orderForm.storePreferencesData) === null || _context_orderForm_storePreferencesData === void 0 ? void 0 : _context_orderForm_storePreferencesData.currencyCode) || null;
|
|
1728
1727
|
},
|
|
1729
|
-
value: function
|
|
1728
|
+
value: function(context, eventName) {
|
|
1730
1729
|
var _context_item, _context_orderForm;
|
|
1731
1730
|
if (context === null || context === void 0 ? void 0 : context.value) return toNum(context.value);
|
|
1732
1731
|
return context.item ? toNum((_context_item = context.item) === null || _context_item === void 0 ? void 0 : _context_item.price) : ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.value) != null ? context.orderForm.value / 100 : null;
|
|
1733
1732
|
},
|
|
1734
|
-
total_discount: function
|
|
1733
|
+
total_discount: function(context, eventName) {
|
|
1735
1734
|
var _context_orderForm, _context_orderForm1;
|
|
1736
1735
|
if (context === null || context === void 0 ? void 0 : context.totalDiscount) return context.totalDiscount;
|
|
1737
1736
|
var totalsList = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.totalizers) || ((_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.totals) || [];
|
|
@@ -1745,7 +1744,7 @@ var AzzasTracker = function() {
|
|
|
1745
1744
|
});
|
|
1746
1745
|
return Math.abs(((discounts === null || discounts === void 0 ? void 0 : discounts.value) || 0) + totalDiscount) / 100 || null;
|
|
1747
1746
|
},
|
|
1748
|
-
subtotal: function
|
|
1747
|
+
subtotal: function(context, eventName) {
|
|
1749
1748
|
var _context_orderForm, _context_orderForm1;
|
|
1750
1749
|
var totalsList = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.totalizers) || ((_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.totals) || [];
|
|
1751
1750
|
var subtotal = totalsList.filter(function(t) {
|
|
@@ -1755,7 +1754,7 @@ var AzzasTracker = function() {
|
|
|
1755
1754
|
}, 0) / 100 || 0;
|
|
1756
1755
|
return subtotal;
|
|
1757
1756
|
},
|
|
1758
|
-
coupon_message: function
|
|
1757
|
+
coupon_message: function(context, eventName) {
|
|
1759
1758
|
var _context_orderForm;
|
|
1760
1759
|
if (context.couponMessage) return context.couponMessage;
|
|
1761
1760
|
var messages = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.messages) || [];
|
|
@@ -1768,44 +1767,44 @@ var AzzasTracker = function() {
|
|
|
1768
1767
|
return msg.text;
|
|
1769
1768
|
}).join(" | ");
|
|
1770
1769
|
},
|
|
1771
|
-
seller_cod_name: function
|
|
1770
|
+
seller_cod_name: function(context, eventName) {
|
|
1772
1771
|
return context.appliedSellerCodName || (context === null || context === void 0 ? void 0 : context.orderForm.marketingData.utmiCampaign) || null;
|
|
1773
1772
|
},
|
|
1774
|
-
coupon: function
|
|
1773
|
+
coupon: function(context, eventName) {
|
|
1775
1774
|
var _context_orderForm_marketingData, _context_orderForm;
|
|
1776
1775
|
return context.appliedCoupon || (context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_marketingData = _context_orderForm.marketingData) === null || _context_orderForm_marketingData === void 0 ? void 0 : _context_orderForm_marketingData.coupon) || null;
|
|
1777
1776
|
},
|
|
1778
|
-
pre_filled: function
|
|
1777
|
+
pre_filled: function(context, eventName) {
|
|
1779
1778
|
return !!context.preFilled;
|
|
1780
1779
|
},
|
|
1781
|
-
search_term: function
|
|
1780
|
+
search_term: function(context, eventName) {
|
|
1782
1781
|
return context.searchTerm || null;
|
|
1783
1782
|
},
|
|
1784
|
-
search_found: function
|
|
1783
|
+
search_found: function(context, eventName) {
|
|
1785
1784
|
return !!context.searchFound;
|
|
1786
1785
|
},
|
|
1787
|
-
search_quantity: function
|
|
1786
|
+
search_quantity: function(context, eventName) {
|
|
1788
1787
|
return context.searchQuantity || 0;
|
|
1789
1788
|
},
|
|
1790
|
-
promotion_name: function
|
|
1789
|
+
promotion_name: function(context, eventName) {
|
|
1791
1790
|
return context.promotionName || null;
|
|
1792
1791
|
},
|
|
1793
|
-
creative_name: function
|
|
1792
|
+
creative_name: function(context, eventName) {
|
|
1794
1793
|
return context.creativeName || null;
|
|
1795
1794
|
},
|
|
1796
|
-
creative_slot: function
|
|
1795
|
+
creative_slot: function(context, eventName) {
|
|
1797
1796
|
return context.creativeSlot || null;
|
|
1798
1797
|
},
|
|
1799
|
-
zipcode: function
|
|
1798
|
+
zipcode: function(context, eventName) {
|
|
1800
1799
|
return context.zipCode || null;
|
|
1801
1800
|
},
|
|
1802
|
-
size: function
|
|
1801
|
+
size: function(context, eventName) {
|
|
1803
1802
|
return context.size || null;
|
|
1804
1803
|
},
|
|
1805
|
-
item_ref: function
|
|
1804
|
+
item_ref: function(context, eventName) {
|
|
1806
1805
|
return context.itemRef || null;
|
|
1807
1806
|
},
|
|
1808
|
-
flag_pickup: function
|
|
1807
|
+
flag_pickup: function(context, eventName) {
|
|
1809
1808
|
var _orderForm_shippingData;
|
|
1810
1809
|
var orderForm = context.orderForm;
|
|
1811
1810
|
if (!orderForm) return null;
|
|
@@ -1818,7 +1817,7 @@ var AzzasTracker = function() {
|
|
|
1818
1817
|
});
|
|
1819
1818
|
return hasPickup;
|
|
1820
1819
|
},
|
|
1821
|
-
shippings: function
|
|
1820
|
+
shippings: function(context, eventName) {
|
|
1822
1821
|
var orderForm = context.orderForm;
|
|
1823
1822
|
if (!orderForm) return null;
|
|
1824
1823
|
var groupShipping = {};
|
|
@@ -1882,7 +1881,7 @@ var AzzasTracker = function() {
|
|
|
1882
1881
|
});
|
|
1883
1882
|
return shippings || null;
|
|
1884
1883
|
},
|
|
1885
|
-
shipping: function
|
|
1884
|
+
shipping: function(context, eventName) {
|
|
1886
1885
|
var _ref;
|
|
1887
1886
|
var _context_orderForm_shippingData, _context_orderForm;
|
|
1888
1887
|
var logistics = (_ref = context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_shippingData = _context_orderForm.shippingData) === null || _context_orderForm_shippingData === void 0 ? void 0 : _context_orderForm_shippingData.logisticsInfo) !== null && _ref !== void 0 ? _ref : [];
|
|
@@ -1895,7 +1894,7 @@ var AzzasTracker = function() {
|
|
|
1895
1894
|
return total + ((_ref = selected === null || selected === void 0 ? void 0 : selected.price) !== null && _ref !== void 0 ? _ref : 0);
|
|
1896
1895
|
}, 0);
|
|
1897
1896
|
},
|
|
1898
|
-
shipping_tier: function
|
|
1897
|
+
shipping_tier: function(context, eventName) {
|
|
1899
1898
|
var _ref;
|
|
1900
1899
|
var _context_orderForm_shippingData, _context_orderForm;
|
|
1901
1900
|
var logistics = (_ref = context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_shippingData = _context_orderForm.shippingData) === null || _context_orderForm_shippingData === void 0 ? void 0 : _context_orderForm_shippingData.logisticsInfo) !== null && _ref !== void 0 ? _ref : [];
|
|
@@ -1930,11 +1929,11 @@ var AzzasTracker = function() {
|
|
|
1930
1929
|
}).filter(Boolean).join(", ");
|
|
1931
1930
|
return shippingTier || null;
|
|
1932
1931
|
},
|
|
1933
|
-
transaction_id: function
|
|
1932
|
+
transaction_id: function(context, eventName) {
|
|
1934
1933
|
var _context_orderForm_orderGroup, _context_orderForm;
|
|
1935
1934
|
return ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_orderGroup = _context_orderForm.orderGroup) === null || _context_orderForm_orderGroup === void 0 ? void 0 : _context_orderForm_orderGroup.toString()) || null;
|
|
1936
1935
|
},
|
|
1937
|
-
available_grid: function
|
|
1936
|
+
available_grid: function(context, eventName) {
|
|
1938
1937
|
return context.availableGrid || null;
|
|
1939
1938
|
}
|
|
1940
1939
|
};
|