@beworke/pixel 0.1.0-rc.5 → 0.1.0-rc.7
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/CHANGELOG.md +9 -0
- package/README.md +38 -69
- package/RELEASE_CANDIDATE.md +19 -13
- package/dist/{StorageFactory-CPghDPBj.d.mts → StorageFactory-Cq29vF32.d.mts} +2 -2
- package/dist/{StorageFactory-tjfzk57c.d.ts → StorageFactory-DeMaZ8wk.d.ts} +2 -2
- package/dist/config/index.cjs.js +1 -1
- package/dist/config/index.cjs.js.map +1 -1
- package/dist/config/index.d.mts +4 -4
- package/dist/config/index.d.ts +4 -4
- package/dist/config/index.esm.js +1 -1
- package/dist/config/index.esm.js.map +1 -1
- package/dist/events/index.cjs.js.map +1 -1
- package/dist/events/index.d.mts +2 -2
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.esm.js.map +1 -1
- package/dist/examples/html-script/README.md +20 -76
- package/dist/examples/html-script/RELEASE_CANDIDATE.md +14 -13
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-autocomplete.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-fields.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-data-track.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-dedupe.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-manual.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-rules-card.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-security.html +1 -1
- package/dist/examples/html-script/add-to-cart/README.md +6 -3
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-attribute.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-auto.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-click.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-dedupe.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-link.html +597 -0
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-manual.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-order-bump.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-text.html +3 -2
- package/dist/examples/html-script/behavior/example-behavior-engagement.html +1 -1
- package/dist/examples/html-script/behavior/example-behavior-heartbeat.html +1 -1
- package/dist/examples/html-script/behavior/example-behavior-runtime-intelligence.html +1 -1
- package/dist/examples/html-script/behavior/example-behavior-viewport.html +1 -1
- package/dist/examples/html-script/behavior/example-behavior.html +1 -1
- package/dist/examples/html-script/example-basic.html +1 -1
- package/dist/examples/html-script/example-checkout-commerce.html +1 -1
- package/dist/examples/html-script/example-conversion.html +1 -1
- package/dist/examples/html-script/example-integration.html +1 -1
- package/dist/examples/html-script/example-landing-commerce.html +42 -1
- package/dist/examples/html-script/example-runtime-diagnostics.html +1 -1
- package/dist/examples/html-script/example-transport.html +6 -1
- package/dist/examples/html-script/full-funnel/README.md +1 -1
- package/dist/examples/html-script/full-funnel/checkout.html +1 -1
- package/dist/examples/html-script/full-funnel/downsell.html +1 -1
- package/dist/examples/html-script/full-funnel/landing.html +54 -2
- package/dist/examples/html-script/full-funnel/thank-you.html +1 -1
- package/dist/examples/html-script/full-funnel/upsell.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-attribute.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-auto.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-click.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-manual.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-snapshot.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-submit.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-text.html +1 -1
- package/dist/examples/html-script/lead/example-lead-trigger-attribute.html +1 -1
- package/dist/examples/html-script/lead/example-lead-trigger-auto.html +1 -1
- package/dist/examples/html-script/lead/example-lead-trigger-click.html +1 -1
- package/dist/examples/html-script/release-candidate.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-attribute.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-css.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-dedupe.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-manual.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-multi.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-state.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-text.html +1 -1
- package/dist/examples/html-script/search/example-search-attribute.html +1 -1
- package/dist/examples/html-script/search/example-search-button-sync.html +1 -1
- package/dist/examples/html-script/search/example-search-dedupe.html +1 -1
- package/dist/examples/html-script/search/example-search-input.html +1 -1
- package/dist/examples/html-script/search/example-search-manual.html +1 -1
- package/dist/examples/html-script/search/example-search-submit.html +1 -1
- package/dist/examples/html-script/search/example-search-text.html +1 -1
- package/dist/examples/html-script/url-context/example-url-context-allowed-domains.html +38 -9
- package/dist/examples/html-script/url-context/example-url-context-landing.html +53 -13
- package/dist/examples/html-script/url-context/example-url-context-upsell.html +48 -10
- package/dist/examples/html-script/url-context/example-url-context.html +51 -17
- package/dist/examples/html-script/view-content/example-view-content-attribute.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-css.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-dedupe.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-empty.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-manual.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-product-card.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-text.html +1 -1
- package/dist/examples/release-candidate/README.md +2 -1
- package/dist/examples/v2/README.md +15 -15
- package/dist/{index-CQAyT5Od.d.ts → index-B8u_3PGG.d.ts} +21 -2
- package/dist/{index-JlKPz4pp.d.mts → index-BxT2d-TK.d.mts} +21 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +19 -782
- package/dist/index.d.ts +19 -782
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/{pixel-BxZZx8l5.d.ts → pixel-2uL4LSyC.d.ts} +126 -5
- package/dist/{pixel-CKc4OQUx.d.mts → pixel-DMwpppf_.d.mts} +126 -5
- package/dist/{pixel-default-config-aAOujzwp.d.ts → pixel-default-config-BDPUVHse.d.ts} +1 -1
- package/dist/{pixel-default-config-CJl-eypl.d.mts → pixel-default-config-C5uLt52W.d.mts} +1 -1
- package/dist/runtime/index.cjs.js +1 -1
- package/dist/runtime/index.cjs.js.map +1 -1
- package/dist/runtime/index.d.mts +6 -6
- package/dist/runtime/index.d.ts +6 -6
- package/dist/runtime/index.esm.js +1 -1
- package/dist/runtime/index.esm.js.map +1 -1
- package/dist/services/index.cjs.js +1 -1
- package/dist/services/index.cjs.js.map +1 -1
- package/dist/services/index.d.mts +7 -7
- package/dist/services/index.d.ts +7 -7
- package/dist/services/index.esm.js +1 -1
- package/dist/services/index.esm.js.map +1 -1
- package/dist/{types-BP8dz1gP.d.mts → types-6HF3UlsL.d.mts} +2 -2
- package/dist/{types-C75pQP31.d.ts → types-BqUEoZo0.d.ts} +2 -2
- package/dist/{types-DMhzHSVC.d.mts → types-CgrabttM.d.mts} +2 -2
- package/dist/{types-D_SsCur9.d.ts → types-fFcQ1apy.d.ts} +2 -2
- package/dist/{url-context-BjAsQoVl.d.mts → url-context-Ck2LK18V.d.mts} +4 -2
- package/dist/{url-context-BjAsQoVl.d.ts → url-context-Ck2LK18V.d.ts} +4 -2
- package/dist/v2/global.global.js +1 -1
- package/dist/v2/global.global.js.map +1 -1
- package/dist/v2/index.cjs.js +1 -1
- package/dist/v2/index.cjs.js.map +1 -1
- package/dist/v2/index.d.mts +793 -9
- package/dist/v2/index.d.ts +793 -9
- package/dist/v2/index.esm.js +1 -1
- package/dist/v2/index.esm.js.map +1 -1
- package/docs/public/README.md +77 -0
- package/docs/public/api/exports.md +47 -0
- package/docs/public/api/pixel.md +65 -0
- package/docs/public/configuration/commerce.md +44 -0
- package/docs/public/configuration/modules.md +66 -0
- package/docs/public/configuration/overview.md +66 -0
- package/docs/public/events/catalog.md +65 -0
- package/docs/public/getting-started/installation.md +78 -0
- package/docs/public/getting-started/quick-start.md +77 -0
- package/docs/public/getting-started/react-nextjs.md +55 -0
- package/docs/public/getting-started/script-tag.md +57 -0
- package/docs/public/guides/funnel-checkout.md +52 -0
- package/docs/public/guides/funnel-downsell.md +53 -0
- package/docs/public/guides/funnel-full.md +64 -0
- package/docs/public/guides/funnel-landing.md +68 -0
- package/docs/public/guides/funnel-thank-you.md +48 -0
- package/docs/public/guides/funnel-upsell.md +72 -0
- package/docs/public/limitations.md +32 -0
- package/docs/public/privacy/limitations.md +33 -0
- package/docs/public/release-candidate/validation.md +42 -0
- package/docs/public/troubleshooting.md +55 -0
- package/package.json +10 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/config/shared/selector.ts","../../src/config/shared/commerce.ts","../../src/config/defaults/attribution.ts","../../src/config/defaults/modules/behavior.ts","../../src/config/defaults/modules/conversion.ts","../../src/config/defaults/modules/core.ts","../../src/config/defaults/modules/integrations.ts","../../src/config/defaults/modules/privacy.ts","../../src/config/defaults/modules/transport.ts","../../src/config/defaults/pixel-default-config.ts"],"sourcesContent":["/**\n * Tipo padrão/fallback para interpretar selectors string sem prefixo.\n *\n * Ordem de resolução (`SelectorResolver`):\n * 1. Objeto → selector.type\n * 2. String com prefixo (css:, id:, class:, attr:, attribute:, text:) → prefixo\n * 3. String sem prefixo → selectorType\n * 4. Sem selectorType → css (DEFAULT_SELECTOR_TYPE)\n */\nexport type SelectorType = 'css' | 'id' | 'class' | 'attribute' | 'text';\n\n/** Fallback quando `selectorType` é omitido. */\nexport const DEFAULT_SELECTOR_TYPE: SelectorType = 'css';\n\n/**\n * Forma avançada de um seletor individual.\n * `exact` / `caseSensitive` aplicam-se principalmente a `type: 'text'`.\n * `closest` restringe a busca a um ancestral CSS (resolvido na etapa do Resolver).\n */\nexport type SelectorDescriptor = {\n type: SelectorType;\n value: string;\n exact?: boolean;\n caseSensitive?: boolean;\n closest?: string;\n};\n\n/** Um seletor: string simples/prefixada ou descritor tipado. */\nexport type SelectorInput = string | SelectorDescriptor;\n\n/** Um ou vários seletores (OR — qualquer match dispara). */\nexport type SelectorConfig = SelectorInput | SelectorInput[];\n\n/**\n * Extrai o valor primário de um `SelectorConfig` (utilitário de config).\n * Para match/query no DOM, use `SelectorResolver`.\n */\nexport function getPrimarySelectorValue(\n selector: SelectorConfig | undefined\n): string | null {\n if (selector == null) return null;\n\n if (typeof selector === 'string') {\n const trimmed = selector.trim();\n return trimmed.length > 0 ? trimmed : null;\n }\n\n if (Array.isArray(selector)) {\n for (const item of selector) {\n const value = getPrimarySelectorValue(item);\n if (value) return value;\n }\n return null;\n }\n\n const value = selector.value?.trim();\n return value && value.length > 0 ? value : null;\n}\n\n/**\n * Resolve o `selectorType` efetivo: config explícita → tipo do descriptor → css.\n */\nexport function resolveSelectorTypeFallback(\n selector: SelectorConfig | undefined,\n selectorType?: SelectorType\n): SelectorType {\n if (selectorType) return selectorType;\n\n if (selector != null && typeof selector !== 'string') {\n if (Array.isArray(selector)) {\n for (const item of selector) {\n if (typeof item !== 'string') return item.type;\n }\n } else {\n return selector.type;\n }\n }\n\n return DEFAULT_SELECTOR_TYPE;\n}","/**\n * Contratos globais de commerce (root `PixelConfig.commerce`).\n * Não pertencem a conversion — representam o contexto comercial da página/fluxo.\n */\n\nexport type ProductType =\n | 'main'\n | 'order_bump'\n | 'upsell'\n | 'downsell'\n | 'cross_sell'\n | 'addon'\n | 'subscription'\n | 'custom'\n | 'other';\n\nexport type CommerceProduct = {\n id: string;\n name?: string;\n sku?: string;\n type?: ProductType;\n price?: number;\n currency?: string;\n quantity?: number;\n category?: string;\n variant?: string;\n brand?: string;\n metadata?: Record<string, unknown>;\n};\n\nexport type CommerceCartItem = {\n productId: string;\n quantity?: number;\n price?: number;\n currency?: string;\n selected?: boolean;\n metadata?: Record<string, unknown>;\n};\n\nexport type CommerceCartMode =\n | 'landing_page'\n | 'single_product'\n | 'multi_product'\n | 'checkout'\n | 'upsell'\n | 'custom'\n | 'cart'\n | 'funnel';\n\nexport type CommerceCalculateValueFrom =\n | 'cart'\n | 'event'\n | 'manual'\n | 'catalog';\n\nexport type CommerceEnrichmentSource =\n | 'cart'\n | 'event'\n | 'event_or_cart'\n | 'catalog';\n\nexport type CommerceEventEnrichmentConfig = {\n enabled: boolean;\n source?: CommerceEnrichmentSource;\n};\n\nexport type CommerceEnrichmentConfig = {\n pageView?: CommerceEventEnrichmentConfig;\n viewContent?: CommerceEventEnrichmentConfig;\n lead?: CommerceEventEnrichmentConfig;\n addToCart?: CommerceEventEnrichmentConfig;\n removeFromCart?: CommerceEventEnrichmentConfig;\n initiateCheckout?: CommerceEventEnrichmentConfig;\n addPaymentInfo?: CommerceEventEnrichmentConfig;\n purchase?: CommerceEventEnrichmentConfig;\n};\n\nexport type ProductCatalogConfig = {\n products?: CommerceProduct[];\n};\n\nexport type CommerceCartConfig = {\n mode?: CommerceCartMode;\n /** Seed inicial do carrinho — não é estado vivo. */\n initialItems?: CommerceCartItem[];\n allowDynamicItems?: boolean;\n calculateValueFrom?: CommerceCalculateValueFrom;\n metadata?: Record<string, unknown>;\n};\n\nexport type CommerceMappingsConfig = {\n attributes?: Record<string, string[]>;\n fields?: Record<string, string[]>;\n};\n\nexport type CommerceConfig = {\n enabled?: boolean;\n currency?: string;\n catalog?: ProductCatalogConfig;\n cart?: CommerceCartConfig;\n mappings?: CommerceMappingsConfig;\n enrichment?: CommerceEnrichmentConfig;\n};\n\nexport const DEFAULT_COMMERCE_ENRICHMENT: Required<CommerceEnrichmentConfig> = {\n pageView: { enabled: false, source: 'cart' },\n viewContent: { enabled: true, source: 'event_or_cart' },\n lead: { enabled: false, source: 'event_or_cart' },\n addToCart: { enabled: true, source: 'event_or_cart' },\n removeFromCart: { enabled: true, source: 'event_or_cart' },\n initiateCheckout: { enabled: true, source: 'cart' },\n addPaymentInfo: { enabled: true, source: 'cart' },\n purchase: { enabled: true, source: 'cart' },\n};\n\n/** Default seguro: commerce off, sem produtos, sem itens. */\nexport const DEFAULT_COMMERCE_CONFIG: CommerceConfig = {\n enabled: false,\n currency: 'BRL',\n catalog: {\n products: [],\n },\n cart: {\n mode: 'custom',\n initialItems: [],\n allowDynamicItems: true,\n calculateValueFrom: 'cart',\n },\n mappings: {\n attributes: {},\n fields: {},\n },\n enrichment: { ...DEFAULT_COMMERCE_ENRICHMENT },\n};\n\n/** Normaliza calculateValueFrom (inclui aliases legado em runtime). */\nexport function normalizeCalculateValueFrom(\n value: CommerceCalculateValueFrom | string | undefined\n): 'cart' | 'event' | 'manual' | 'catalog' {\n switch (value) {\n case 'event':\n case 'event_items':\n return 'event';\n case 'manual':\n return 'manual';\n case 'catalog':\n return 'catalog';\n case 'cart':\n case 'selected_items':\n default:\n return 'cart';\n }\n}\n","import type { AttributionConfig } from '../types/attribution';\n\nexport const DEFAULT_ATTRIBUTION_CONFIG: AttributionConfig = {\n enabled: true,\n ttlDays: 90,\n persist: true,\n captureUrlParams: true,\n captureCookies: true,\n customClickIdParams: [],\n};\n","import type { BehaviorModuleConfig } from '../../types/modules/behavior';\n\nexport const DEFAULT_BEHAVIOR_MODULE_CONFIG: BehaviorModuleConfig = {\n enabled: false,\n\n heartbeat: {\n enabled: false,\n intervalMs: 15_000,\n hiddenIntervalMs: 60_000,\n emitWhenHidden: false,\n emitWhenIdle: true,\n includeSnapshot: true,\n fireImmediately: false,\n },\n\n engagement: {\n enabled: false,\n evaluationIntervalMs: 5_000,\n emitOnChange: true,\n minScoreDelta: 5,\n emitSummaryOnDestroy: true,\n\n weights: {\n activeTime: 0.25,\n scroll: 0.2,\n click: 0.15,\n viewport: 0.2,\n visibility: 0.1,\n heartbeat: 0.1,\n },\n\n penalties: {\n idle: 0.2,\n rageClick: 0.1,\n },\n\n thresholds: {\n lowMax: 29,\n mediumMax: 69,\n },\n },\n\n rateLimit: {\n enabled: false,\n windowMs: 1_000,\n maxSignalsPerWindow: 50,\n criticalBypass: true,\n },\n\n buffer: {\n enabled: false,\n maxSize: 200,\n maxAgeMs: 30_000,\n flushSize: 50,\n dropStrategy: 'compress_similar',\n flushOnHidden: true,\n },\n\n stateMachine: {\n enabled: false,\n historyLimit: 50,\n },\n\n sessionSummary: {\n enabled: false,\n emitOnHidden: false,\n emitOnDestroy: true,\n minimumSessionMs: 0,\n },\n\n trackers: {\n scroll: {\n enabled: false,\n thresholds: [25, 50, 75, 100],\n debounceMs: 100,\n },\n\n click: {\n enabled: false,\n rageClick: {\n enabled: true,\n threshold: 3,\n windowMs: 500,\n },\n },\n\n idle: {\n enabled: false,\n thresholdMs: 60_000,\n },\n\n visibility: {\n enabled: false,\n },\n\n exitIntent: {\n enabled: false,\n },\n\n viewport: {\n enabled: false,\n targets: [],\n rootMargin: '0px',\n observeMutations: true,\n mutationDebounceMs: 100,\n maxObservedElements: 500,\n },\n },\n};\n","import type { ConversionModuleConfig } from '../../types/modules/conversion';\n\nconst EMPTY_DETECTOR = { enabled: false, sources: [] as const };\n\nexport const DEFAULT_CONVERSION_MODULE_CONFIG: ConversionModuleConfig = {\n enabled: false,\n\n manual: {\n pageView: {\n enabled: false,\n },\n purchase: {\n enabled: false,\n },\n lead: {\n enabled: false,\n },\n addToCart: {\n enabled: false,\n },\n removeFromCart: {\n enabled: false,\n },\n initiateCheckout: {\n enabled: false,\n },\n addPaymentInfo: {\n enabled: false,\n },\n search: {\n enabled: false,\n },\n viewContent: {\n enabled: false,\n },\n },\n\n auto: {\n enabled: false,\n\n detectors: {\n lead: { ...EMPTY_DETECTOR, sources: [] },\n addToCart: { ...EMPTY_DETECTOR, sources: [] },\n removeFromCart: { ...EMPTY_DETECTOR, sources: [] },\n initiateCheckout: { ...EMPTY_DETECTOR, sources: [] },\n purchase: { ...EMPTY_DETECTOR, sources: [] },\n addPaymentInfo: { ...EMPTY_DETECTOR, sources: [] },\n search: { ...EMPTY_DETECTOR, sources: [] },\n viewContent: { ...EMPTY_DETECTOR, sources: [] },\n },\n },\n\n rules: {\n enabled: false,\n selectors: ['[data-track]'],\n texts: ['Comprar', 'Comprar Agora', 'Finalizar Compra', 'Checkout'],\n urlPatterns: ['thank-you', 'purchase', 'success', 'order', 'checkout'],\n checkout: {\n enabled: false,\n },\n card: {\n enabled: false,\n },\n },\n};\n","import type { CoreModuleConfig } from '../../types/modules/core';\n\nexport const DEFAULT_CORE_MODULE_CONFIG: CoreModuleConfig = {\n enabled: true,\n\n pageView: {\n enabled: true,\n trackInitialPageView: true,\n spa: true,\n dedupeMs: 2000,\n },\n\n visitor: {\n enabled: true,\n persistence: 'cookie_localStorage',\n renew: false,\n },\n\n session: {\n enabled: true,\n ttlMs: 10800000,\n renewOnActivity: true,\n renewOnPageView: true,\n },\n\n fingerprint: {\n enabled: true,\n mode: 'light',\n cache: true,\n },\n\n consent: {\n enabled: false,\n required: false,\n waitForConsent: false,\n },\n\n dedupe: {\n enabled: true,\n windowMs: 2000,\n },\n\n coordination: {\n enabled: true,\n leaderElection: true,\n broadcastChannel: true,\n },\n\n ordering: {\n enabled: true,\n preserveOrder: true,\n },\n\n urlContext: {\n enabled: false,\n },\n};\n","import type { IntegrationsModuleConfig } from '../../types/modules/integrations';\n\nexport const DEFAULT_INTEGRATIONS_MODULE_CONFIG: IntegrationsModuleConfig = {\n enabled: false,\n debug: false,\n concurrency: 3,\n timeoutMs: 5000,\n continueOnError: true,\n\n destinations: {\n console: { enabled: false },\n memory: { enabled: false },\n mock: { enabled: false },\n meta: {\n enabled: false,\n pixelIds: [],\n autoPageView: true,\n loadScript: true,\n },\n google: {\n enabled: false,\n tagIds: [],\n autoPageView: true,\n loadScript: true,\n },\n tiktok: {\n enabled: false,\n pixelIds: [],\n autoPageView: true,\n loadScript: true,\n },\n },\n};\n","import type { PrivacyModuleConfig } from '../../types/modules/privacy';\n\nexport const DEFAULT_PRIVACY_MODULE_CONFIG: PrivacyModuleConfig = {\n enabled: false,\n\n consent: {\n enabled: false,\n required: false,\n },\n\n pii: {\n enabled: false,\n hashEmail: true,\n hashPhone: true,\n },\n\n anonymization: {\n enabled: false,\n anonymizeIp: true,\n },\n};\n","import type { TransportModuleConfig } from '../../types/modules/transport';\n\nexport const DEFAULT_TRANSPORT_MODULE_CONFIG: TransportModuleConfig = {\n enabled: false,\n\n mockSender: {\n enabled: true,\n },\n\n sender: {\n mode: 'mock',\n },\n\n persistence: {\n enabled: true,\n },\n\n replay: {\n enabled: true,\n },\n\n ordering: {\n enabled: true,\n },\n\n coordination: {\n enabled: true,\n },\n\n circuitBreaker: {\n enabled: true,\n failureThreshold: 5,\n resetTimeoutMs: 30_000,\n halfOpenMaxAttempts: 2,\n },\n\n backpressure: {\n enabled: true,\n maxQueueSize: 500,\n policy: 'drop_oldest',\n sampleRate: 0.5,\n },\n\n deadLetter: {\n enabled: true,\n maxEntries: 200,\n },\n\n compression: {\n enabled: true,\n strategy: 'identity',\n },\n\n retry: {\n enabled: true,\n maxAttempts: 4,\n baseDelayMs: 500,\n maxDelayMs: 4000,\n multiplier: 2,\n },\n\n batch: {\n enabled: true,\n batchSize: 10,\n flushIntervalMs: 2000,\n maxWaitMs: 5000,\n },\n\n timeout: {\n enabled: true,\n timeoutMs: 10000,\n },\n\n offline: {\n enabled: true,\n },\n\n flush: {\n enabled: true,\n flushIntervalMs: 2000,\n flushOnDestroy: true,\n prepareUnloadHooks: true,\n },\n};\n","import type { PixelConfig } from '../types/pixel';\nimport { DEFAULT_ATTRIBUTION_CONFIG } from './attribution';\nimport { DEFAULT_BEHAVIOR_MODULE_CONFIG } from './modules/behavior';\nimport { DEFAULT_CONVERSION_MODULE_CONFIG } from './modules/conversion';\nimport { DEFAULT_CORE_MODULE_CONFIG } from './modules/core';\nimport { DEFAULT_INTEGRATIONS_MODULE_CONFIG } from './modules/integrations';\nimport { DEFAULT_PRIVACY_MODULE_CONFIG } from './modules/privacy';\nimport { DEFAULT_TRANSPORT_MODULE_CONFIG } from './modules/transport';\nimport { DEFAULT_COMMERCE_CONFIG } from '../shared/commerce';\n\nexport const DEFAULT_PIXEL_CONFIG: PixelConfig = {\n app: {\n source: 'custom',\n target: 'custom',\n environment: 'production',\n debug: false,\n },\n\n identity: {\n pixelId: '',\n },\n\n transport: {\n apiEndpoint: '',\n timeoutMs: 10000,\n },\n\n storage: {\n prefix: '__gmk',\n namespace: 'pixel',\n\n queue: {\n enabled: true,\n persistence: 'memory',\n index: true,\n },\n },\n\n attribution: { ...DEFAULT_ATTRIBUTION_CONFIG },\n\n commerce: {\n ...DEFAULT_COMMERCE_CONFIG,\n catalog: { products: [] },\n cart: {\n mode: 'custom',\n initialItems: [],\n allowDynamicItems: true,\n calculateValueFrom: 'cart',\n },\n mappings: { attributes: {}, fields: {} },\n enrichment: { ...DEFAULT_COMMERCE_CONFIG.enrichment },\n },\n\n modules: {\n core: DEFAULT_CORE_MODULE_CONFIG,\n behavior: DEFAULT_BEHAVIOR_MODULE_CONFIG,\n conversion: DEFAULT_CONVERSION_MODULE_CONFIG,\n transport: DEFAULT_TRANSPORT_MODULE_CONFIG,\n integrations: DEFAULT_INTEGRATIONS_MODULE_CONFIG,\n privacy: DEFAULT_PRIVACY_MODULE_CONFIG,\n },\n};\n"],"mappings":";AAYO,IAAMA,EAAsC,MAyB5C,SAASC,EACdC,EACe,CACf,GAAIA,GAAY,KAAM,OAAO,KAE7B,GAAI,OAAOA,GAAa,SAAU,CAChC,IAAMC,EAAUD,EAAS,KAAK,EAC9B,OAAOC,EAAQ,OAAS,EAAIA,EAAU,IACxC,CAEA,GAAI,MAAM,QAAQD,CAAQ,EAAG,CAC3B,QAAWE,KAAQF,EAAU,CAC3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EA,QAAS,CACP,QAAS,GACT,UAAW,GACb,EAEA,QAAS,CACP,QAAS,EACX,EAEA,MAAO,CACL,QAAS,GACT,gBAAiB,IACjB,eAAgB,GAChB,mBAAoB,EACtB,CACF,ECzEO,IAAMC,EAAoC,CAC/C,IAAK,CACH,OAAQ,SACR,OAAQ,SACR,YAAa,aACb,MAAO,EACT,EAEA,SAAU,CACR,QAAS,EACX,EAEA,UAAW,CACT,YAAa,GACb,UAAW,GACb,EAEA,QAAS,CACP,OAAQ,QACR,UAAW,QAEX,MAAO,CACL,QAAS,GACT,YAAa,SACb,MAAO,EACT,CACF,EAEA,YAAa,CAAE,GAAGC,CAA2B,EAE7C,SAAU,CACR,GAAGC,EACH,QAAS,CAAE,SAAU,CAAC,CAAE,EACxB,KAAM,CACJ,KAAM,SACN,aAAc,CAAC,EACf,kBAAmB,GACnB,mBAAoB,MACtB,EACA,SAAU,CAAE,WAAY,CAAC,EAAG,OAAQ,CAAC,CAAE,EACvC,WAAY,CAAE,GAAGA,EAAwB,UAAW,CACtD,EAEA,QAAS,CACP,KAAMC,EACN,SAAUC,EACV,WAAYC,EACZ,UAAWC,EACX,aAAcC,EACd,QAASC,CACX,CACF","names":["DEFAULT_SELECTOR_TYPE","getPrimarySelectorValue","selector","trimmed","item","value","resolveSelectorTypeFallback","selectorType","DEFAULT_COMMERCE_ENRICHMENT","DEFAULT_COMMERCE_CONFIG","normalizeCalculateValueFrom","value","DEFAULT_ATTRIBUTION_CONFIG","DEFAULT_BEHAVIOR_MODULE_CONFIG","EMPTY_DETECTOR","DEFAULT_CONVERSION_MODULE_CONFIG","DEFAULT_CORE_MODULE_CONFIG","DEFAULT_INTEGRATIONS_MODULE_CONFIG","DEFAULT_PRIVACY_MODULE_CONFIG","DEFAULT_TRANSPORT_MODULE_CONFIG","DEFAULT_PIXEL_CONFIG","DEFAULT_ATTRIBUTION_CONFIG","DEFAULT_COMMERCE_CONFIG","DEFAULT_CORE_MODULE_CONFIG","DEFAULT_BEHAVIOR_MODULE_CONFIG","DEFAULT_CONVERSION_MODULE_CONFIG","DEFAULT_TRANSPORT_MODULE_CONFIG","DEFAULT_INTEGRATIONS_MODULE_CONFIG","DEFAULT_PRIVACY_MODULE_CONFIG"]}
|
|
1
|
+
{"version":3,"sources":["../../src/config/shared/selector.ts","../../src/config/shared/commerce.ts","../../src/config/defaults/attribution.ts","../../src/config/defaults/modules/behavior.ts","../../src/config/defaults/modules/conversion.ts","../../src/config/defaults/modules/core.ts","../../src/config/defaults/modules/integrations.ts","../../src/config/defaults/modules/privacy.ts","../../src/config/defaults/modules/transport.ts","../../src/config/defaults/pixel-default-config.ts"],"sourcesContent":["/**\n * Tipo padrão/fallback para interpretar selectors string sem prefixo.\n *\n * Ordem de resolução (`SelectorResolver`):\n * 1. Objeto → selector.type\n * 2. String com prefixo (css:, id:, class:, attr:, attribute:, text:) → prefixo\n * 3. String sem prefixo → selectorType\n * 4. Sem selectorType → css (DEFAULT_SELECTOR_TYPE)\n */\nexport type SelectorType = 'css' | 'id' | 'class' | 'attribute' | 'text';\n\n/** Fallback quando `selectorType` é omitido. */\nexport const DEFAULT_SELECTOR_TYPE: SelectorType = 'css';\n\n/**\n * Forma avançada de um seletor individual.\n * `exact` / `caseSensitive` aplicam-se principalmente a `type: 'text'`.\n * `closest` restringe a busca a um ancestral CSS (resolvido na etapa do Resolver).\n */\nexport type SelectorDescriptor = {\n type: SelectorType;\n value: string;\n exact?: boolean;\n caseSensitive?: boolean;\n closest?: string;\n};\n\n/** Um seletor: string simples/prefixada ou descritor tipado. */\nexport type SelectorInput = string | SelectorDescriptor;\n\n/** Um ou vários seletores (OR — qualquer match dispara). */\nexport type SelectorConfig = SelectorInput | SelectorInput[];\n\n/**\n * Extrai o valor primário de um `SelectorConfig` (utilitário de config).\n * Para match/query no DOM, use `SelectorResolver`.\n */\nexport function getPrimarySelectorValue(\n selector: SelectorConfig | undefined\n): string | null {\n if (selector == null) return null;\n\n if (typeof selector === 'string') {\n const trimmed = selector.trim();\n return trimmed.length > 0 ? trimmed : null;\n }\n\n if (Array.isArray(selector)) {\n for (const item of selector) {\n const value = getPrimarySelectorValue(item);\n if (value) return value;\n }\n return null;\n }\n\n const value = selector.value?.trim();\n return value && value.length > 0 ? value : null;\n}\n\n/**\n * Resolve o `selectorType` efetivo: config explícita → tipo do descriptor → css.\n */\nexport function resolveSelectorTypeFallback(\n selector: SelectorConfig | undefined,\n selectorType?: SelectorType\n): SelectorType {\n if (selectorType) return selectorType;\n\n if (selector != null && typeof selector !== 'string') {\n if (Array.isArray(selector)) {\n for (const item of selector) {\n if (typeof item !== 'string') return item.type;\n }\n } else {\n return selector.type;\n }\n }\n\n return DEFAULT_SELECTOR_TYPE;\n}\n","/**\n * Contratos globais de commerce (root `PixelConfig.commerce`).\n * Não pertencem a conversion — representam o contexto comercial da página/fluxo.\n */\n\nexport type ProductType =\n | 'main'\n | 'order_bump'\n | 'upsell'\n | 'downsell'\n | 'cross_sell'\n | 'addon'\n | 'subscription'\n | 'custom'\n | 'other';\n\nexport type CommerceProduct = {\n id: string;\n name?: string;\n sku?: string;\n type?: ProductType;\n price?: number;\n currency?: string;\n quantity?: number;\n category?: string;\n variant?: string;\n brand?: string;\n metadata?: Record<string, unknown>;\n};\n\nexport type CommerceCartItem = {\n productId: string;\n quantity?: number;\n price?: number;\n currency?: string;\n selected?: boolean;\n metadata?: Record<string, unknown>;\n};\n\nexport type CommerceCartMode =\n | 'landing_page'\n | 'single_product'\n | 'multi_product'\n | 'checkout'\n | 'upsell'\n | 'custom'\n | 'cart'\n | 'funnel';\n\nexport type CommerceCalculateValueFrom =\n | 'cart'\n | 'event'\n | 'manual'\n | 'catalog';\n\nexport type CommerceEnrichmentSource =\n | 'cart'\n | 'event'\n | 'event_or_cart'\n | 'catalog';\n\nexport type CommerceEventEnrichmentConfig = {\n enabled: boolean;\n source?: CommerceEnrichmentSource;\n};\n\nexport type CommerceEnrichmentConfig = {\n pageView?: CommerceEventEnrichmentConfig;\n viewContent?: CommerceEventEnrichmentConfig;\n lead?: CommerceEventEnrichmentConfig;\n addToCart?: CommerceEventEnrichmentConfig;\n removeFromCart?: CommerceEventEnrichmentConfig;\n initiateCheckout?: CommerceEventEnrichmentConfig;\n addPaymentInfo?: CommerceEventEnrichmentConfig;\n purchase?: CommerceEventEnrichmentConfig;\n};\n\nexport type ProductCatalogConfig = {\n products?: CommerceProduct[];\n};\n\nexport type CommerceCartConfig = {\n mode?: CommerceCartMode;\n /** Seed inicial do carrinho — não é estado vivo. */\n initialItems?: CommerceCartItem[];\n allowDynamicItems?: boolean;\n calculateValueFrom?: CommerceCalculateValueFrom;\n metadata?: Record<string, unknown>;\n};\n\nexport type CommerceMappingsConfig = {\n attributes?: Record<string, string[]>;\n fields?: Record<string, string[]>;\n};\n\nexport type CommerceConfig = {\n enabled?: boolean;\n currency?: string;\n catalog?: ProductCatalogConfig;\n cart?: CommerceCartConfig;\n mappings?: CommerceMappingsConfig;\n enrichment?: CommerceEnrichmentConfig;\n};\n\nexport const DEFAULT_COMMERCE_ENRICHMENT: Required<CommerceEnrichmentConfig> = {\n pageView: { enabled: false, source: 'cart' },\n viewContent: { enabled: true, source: 'event_or_cart' },\n lead: { enabled: false, source: 'event_or_cart' },\n addToCart: { enabled: true, source: 'event_or_cart' },\n removeFromCart: { enabled: true, source: 'event_or_cart' },\n initiateCheckout: { enabled: true, source: 'cart' },\n addPaymentInfo: { enabled: true, source: 'cart' },\n purchase: { enabled: true, source: 'cart' },\n};\n\n/** Default seguro: commerce off, sem produtos, sem itens. */\nexport const DEFAULT_COMMERCE_CONFIG: CommerceConfig = {\n enabled: false,\n currency: 'BRL',\n catalog: {\n products: [],\n },\n cart: {\n mode: 'custom',\n initialItems: [],\n allowDynamicItems: true,\n calculateValueFrom: 'cart',\n },\n mappings: {\n attributes: {},\n fields: {},\n },\n enrichment: { ...DEFAULT_COMMERCE_ENRICHMENT },\n};\n\n/** Normaliza calculateValueFrom (inclui aliases legado em runtime). */\nexport function normalizeCalculateValueFrom(\n value: CommerceCalculateValueFrom | string | undefined\n): 'cart' | 'event' | 'manual' | 'catalog' {\n switch (value) {\n case 'event':\n case 'event_items':\n return 'event';\n case 'manual':\n return 'manual';\n case 'catalog':\n return 'catalog';\n case 'cart':\n case 'selected_items':\n default:\n return 'cart';\n }\n}\n","import type { AttributionConfig } from '../types/attribution';\n\nexport const DEFAULT_ATTRIBUTION_CONFIG: AttributionConfig = {\n enabled: true,\n ttlDays: 90,\n persist: true,\n captureUrlParams: true,\n captureCookies: true,\n customClickIdParams: [],\n};\n","import type { BehaviorModuleConfig } from '../../types/modules/behavior';\n\nexport const DEFAULT_BEHAVIOR_MODULE_CONFIG: BehaviorModuleConfig = {\n enabled: false,\n\n heartbeat: {\n enabled: false,\n intervalMs: 15_000,\n hiddenIntervalMs: 60_000,\n emitWhenHidden: false,\n emitWhenIdle: true,\n includeSnapshot: true,\n fireImmediately: false,\n },\n\n engagement: {\n enabled: false,\n evaluationIntervalMs: 5_000,\n emitOnChange: true,\n minScoreDelta: 5,\n emitSummaryOnDestroy: true,\n\n weights: {\n activeTime: 0.25,\n scroll: 0.2,\n click: 0.15,\n viewport: 0.2,\n visibility: 0.1,\n heartbeat: 0.1,\n },\n\n penalties: {\n idle: 0.2,\n rageClick: 0.1,\n },\n\n thresholds: {\n lowMax: 29,\n mediumMax: 69,\n },\n },\n\n rateLimit: {\n enabled: false,\n windowMs: 1_000,\n maxSignalsPerWindow: 50,\n criticalBypass: true,\n },\n\n buffer: {\n enabled: false,\n maxSize: 200,\n maxAgeMs: 30_000,\n flushSize: 50,\n dropStrategy: 'compress_similar',\n flushOnHidden: true,\n },\n\n stateMachine: {\n enabled: false,\n historyLimit: 50,\n },\n\n sessionSummary: {\n enabled: false,\n emitOnHidden: false,\n emitOnDestroy: true,\n minimumSessionMs: 0,\n },\n\n trackers: {\n scroll: {\n enabled: false,\n thresholds: [25, 50, 75, 100],\n debounceMs: 100,\n },\n\n click: {\n enabled: false,\n rageClick: {\n enabled: true,\n threshold: 3,\n windowMs: 500,\n },\n },\n\n idle: {\n enabled: false,\n thresholdMs: 60_000,\n },\n\n visibility: {\n enabled: false,\n },\n\n exitIntent: {\n enabled: false,\n },\n\n viewport: {\n enabled: false,\n targets: [],\n rootMargin: '0px',\n observeMutations: true,\n mutationDebounceMs: 100,\n maxObservedElements: 500,\n },\n },\n};\n","import type { ConversionModuleConfig } from '../../types/modules/conversion';\n\nconst EMPTY_DETECTOR = { enabled: false, sources: [] as const };\n\nexport const DEFAULT_CONVERSION_MODULE_CONFIG: ConversionModuleConfig = {\n enabled: false,\n\n manual: {\n pageView: {\n enabled: false,\n },\n purchase: {\n enabled: false,\n },\n lead: {\n enabled: false,\n },\n addToCart: {\n enabled: false,\n },\n removeFromCart: {\n enabled: false,\n },\n initiateCheckout: {\n enabled: false,\n },\n addPaymentInfo: {\n enabled: false,\n },\n search: {\n enabled: false,\n },\n viewContent: {\n enabled: false,\n },\n },\n\n auto: {\n enabled: false,\n\n detectors: {\n lead: { ...EMPTY_DETECTOR, sources: [] },\n addToCart: { ...EMPTY_DETECTOR, sources: [] },\n removeFromCart: { ...EMPTY_DETECTOR, sources: [] },\n initiateCheckout: { ...EMPTY_DETECTOR, sources: [] },\n purchase: { ...EMPTY_DETECTOR, sources: [] },\n addPaymentInfo: { ...EMPTY_DETECTOR, sources: [] },\n search: { ...EMPTY_DETECTOR, sources: [] },\n viewContent: { ...EMPTY_DETECTOR, sources: [] },\n },\n },\n\n rules: {\n enabled: false,\n selectors: ['[data-track]'],\n texts: ['Comprar', 'Comprar Agora', 'Finalizar Compra', 'Checkout'],\n urlPatterns: ['thank-you', 'purchase', 'success', 'order', 'checkout'],\n checkout: {\n enabled: false,\n },\n card: {\n enabled: false,\n },\n },\n};\n","import type { CoreModuleConfig } from '../../types/modules/core';\n\nexport const DEFAULT_CORE_MODULE_CONFIG: CoreModuleConfig = {\n enabled: true,\n\n pageView: {\n enabled: true,\n trackInitialPageView: true,\n spa: true,\n dedupeMs: 2000,\n },\n\n visitor: {\n enabled: true,\n persistence: 'cookie_localStorage',\n renew: false,\n },\n\n session: {\n enabled: true,\n ttlMs: 10800000,\n renewOnActivity: true,\n renewOnPageView: true,\n },\n\n fingerprint: {\n enabled: true,\n mode: 'light',\n cache: true,\n },\n\n consent: {\n enabled: false,\n required: false,\n waitForConsent: false,\n },\n\n dedupe: {\n enabled: true,\n windowMs: 2000,\n },\n\n coordination: {\n enabled: true,\n leaderElection: true,\n broadcastChannel: true,\n },\n\n ordering: {\n enabled: true,\n preserveOrder: true,\n },\n\n urlContext: {\n enabled: false,\n },\n};\n","import type { IntegrationsModuleConfig } from '../../types/modules/integrations';\n\nexport const DEFAULT_INTEGRATIONS_MODULE_CONFIG: IntegrationsModuleConfig = {\n enabled: false,\n debug: false,\n concurrency: 3,\n timeoutMs: 5000,\n continueOnError: true,\n\n destinations: {\n console: { enabled: false },\n memory: { enabled: false },\n mock: { enabled: false },\n meta: {\n enabled: false,\n pixelIds: [],\n autoPageView: true,\n loadScript: true,\n },\n google: {\n enabled: false,\n tagIds: [],\n autoPageView: true,\n loadScript: true,\n },\n tiktok: {\n enabled: false,\n pixelIds: [],\n autoPageView: true,\n loadScript: true,\n },\n },\n};\n","import type { PrivacyModuleConfig } from '../../types/modules/privacy';\n\nexport const DEFAULT_PRIVACY_MODULE_CONFIG: PrivacyModuleConfig = {\n enabled: false,\n\n consent: {\n enabled: false,\n required: false,\n },\n\n pii: {\n enabled: false,\n hashEmail: true,\n hashPhone: true,\n },\n\n anonymization: {\n enabled: false,\n anonymizeIp: true,\n },\n};\n","import type { TransportModuleConfig } from '../../types/modules/transport';\n\nexport const DEFAULT_TRANSPORT_MODULE_CONFIG: TransportModuleConfig = {\n enabled: false,\n\n mockSender: {\n enabled: true,\n },\n\n sender: {\n mode: 'mock',\n },\n\n persistence: {\n enabled: true,\n },\n\n replay: {\n enabled: true,\n },\n\n ordering: {\n enabled: true,\n },\n\n coordination: {\n enabled: true,\n },\n\n circuitBreaker: {\n enabled: true,\n failureThreshold: 5,\n resetTimeoutMs: 30_000,\n halfOpenMaxAttempts: 2,\n },\n\n backpressure: {\n enabled: true,\n maxQueueSize: 500,\n policy: 'drop_oldest',\n sampleRate: 0.5,\n },\n\n deadLetter: {\n enabled: true,\n maxEntries: 200,\n },\n\n compression: {\n enabled: true,\n strategy: 'identity',\n },\n\n retry: {\n enabled: true,\n maxAttempts: 4,\n baseDelayMs: 500,\n maxDelayMs: 4000,\n multiplier: 2,\n },\n\n batch: {\n enabled: true,\n batchSize: 10,\n flushIntervalMs: 2000,\n maxWaitMs: 5000,\n },\n\n timeout: {\n enabled: true,\n timeoutMs: 10000,\n },\n\n offline: {\n enabled: true,\n },\n\n flush: {\n enabled: true,\n flushIntervalMs: 2000,\n flushOnDestroy: true,\n prepareUnloadHooks: true,\n },\n};\n","import type { PixelConfig } from '../types/pixel';\nimport { DEFAULT_ATTRIBUTION_CONFIG } from './attribution';\nimport { DEFAULT_BEHAVIOR_MODULE_CONFIG } from './modules/behavior';\nimport { DEFAULT_CONVERSION_MODULE_CONFIG } from './modules/conversion';\nimport { DEFAULT_CORE_MODULE_CONFIG } from './modules/core';\nimport { DEFAULT_INTEGRATIONS_MODULE_CONFIG } from './modules/integrations';\nimport { DEFAULT_PRIVACY_MODULE_CONFIG } from './modules/privacy';\nimport { DEFAULT_TRANSPORT_MODULE_CONFIG } from './modules/transport';\nimport { DEFAULT_COMMERCE_CONFIG } from '../shared/commerce';\n\nexport const DEFAULT_PIXEL_CONFIG: PixelConfig = {\n app: {\n source: 'custom',\n target: 'custom',\n environment: 'production',\n debug: false,\n },\n\n identity: {\n pixelId: '',\n },\n\n transport: {\n apiEndpoint: '',\n timeoutMs: 10000,\n },\n\n storage: {\n prefix: '__gmk',\n namespace: 'pixel',\n\n queue: {\n enabled: true,\n persistence: 'memory',\n index: true,\n },\n },\n\n attribution: { ...DEFAULT_ATTRIBUTION_CONFIG },\n\n commerce: {\n ...DEFAULT_COMMERCE_CONFIG,\n catalog: { products: [] },\n cart: {\n mode: 'custom',\n initialItems: [],\n allowDynamicItems: true,\n calculateValueFrom: 'cart',\n },\n mappings: { attributes: {}, fields: {} },\n enrichment: { ...DEFAULT_COMMERCE_CONFIG.enrichment },\n },\n\n modules: {\n core: DEFAULT_CORE_MODULE_CONFIG,\n behavior: DEFAULT_BEHAVIOR_MODULE_CONFIG,\n conversion: DEFAULT_CONVERSION_MODULE_CONFIG,\n transport: DEFAULT_TRANSPORT_MODULE_CONFIG,\n integrations: DEFAULT_INTEGRATIONS_MODULE_CONFIG,\n privacy: DEFAULT_PRIVACY_MODULE_CONFIG,\n },\n};\n"],"mappings":";AAYO,IAAMA,EAAsC,MAyB5C,SAASC,EACdC,EACe,CACf,GAAIA,GAAY,KAAM,OAAO,KAE7B,GAAI,OAAOA,GAAa,SAAU,CAChC,IAAMC,EAAUD,EAAS,KAAK,EAC9B,OAAOC,EAAQ,OAAS,EAAIA,EAAU,IACxC,CAEA,GAAI,MAAM,QAAQD,CAAQ,EAAG,CAC3B,QAAWE,KAAQF,EAAU,CAC3B,IAAMG,EAAQJ,EAAwBG,CAAI,EAC1C,GAAIC,EAAO,OAAOA,CACpB,CACA,OAAO,IACT,CAEA,IAAMA,EAAQH,EAAS,OAAO,KAAK,EACnC,OAAOG,GAASA,EAAM,OAAS,EAAIA,EAAQ,IAC7C,CAKO,SAASC,EACdJ,EACAK,EACc,CACd,GAAIA,EAAc,OAAOA,EAEzB,GAAIL,GAAY,MAAQ,OAAOA,GAAa,SAC1C,GAAI,MAAM,QAAQA,CAAQ,GACxB,QAAWE,KAAQF,EACjB,GAAI,OAAOE,GAAS,SAAU,OAAOA,EAAK,SAG5C,QAAOF,EAAS,KAIpB,MAAO,KACT,CCyBO,IAAMM,EAAkE,CAC7E,SAAU,CAAE,QAAS,GAAO,OAAQ,MAAO,EAC3C,YAAa,CAAE,QAAS,GAAM,OAAQ,eAAgB,EACtD,KAAM,CAAE,QAAS,GAAO,OAAQ,eAAgB,EAChD,UAAW,CAAE,QAA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Q,CAAC,CAAE,EACvC,WAAY,CAAE,GAAGA,EAAwB,UAAW,CACtD,EAEA,QAAS,CACP,KAAMC,EACN,SAAUC,EACV,WAAYC,EACZ,UAAWC,EACX,aAAcC,EACd,QAASC,CACX,CACF","names":["DEFAULT_SELECTOR_TYPE","getPrimarySelectorValue","selector","trimmed","item","value","resolveSelectorTypeFallback","selectorType","DEFAULT_COMMERCE_ENRICHMENT","DEFAULT_COMMERCE_CONFIG","normalizeCalculateValueFrom","value","DEFAULT_ATTRIBUTION_CONFIG","DEFAULT_BEHAVIOR_MODULE_CONFIG","EMPTY_DETECTOR","DEFAULT_CONVERSION_MODULE_CONFIG","DEFAULT_CORE_MODULE_CONFIG","DEFAULT_INTEGRATIONS_MODULE_CONFIG","DEFAULT_PRIVACY_MODULE_CONFIG","DEFAULT_TRANSPORT_MODULE_CONFIG","DEFAULT_PIXEL_CONFIG","DEFAULT_ATTRIBUTION_CONFIG","DEFAULT_COMMERCE_CONFIG","DEFAULT_CORE_MODULE_CONFIG","DEFAULT_BEHAVIOR_MODULE_CONFIG","DEFAULT_CONVERSION_MODULE_CONFIG","DEFAULT_TRANSPORT_MODULE_CONFIG","DEFAULT_INTEGRATIONS_MODULE_CONFIG","DEFAULT_PRIVACY_MODULE_CONFIG"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/events/index.ts","../../src/events/builder/BaseEventBuilder.ts"],"sourcesContent":["export type { BasePixelEvent } from './base';\nexport type { PageViewEvent } from './page-view';\nexport type {\n ScrollEvent,\n PageClickEvent,\n RageClickEvent,\n VisibilityChangeEvent,\n UserIdleEvent,\n UserActiveEvent,\n ExitIntentEvent,\n BehaviorHeartbeatEvent,\n ViewportEnterEvent,\n ViewportExitEvent,\n ViewportExitReason,\n EngagementUpdateEvent,\n EngagementSummaryEvent,\n BehaviorSessionSummaryEvent,\n BehaviorSessionSummaryReason,\n BehaviorState,\n EngagementLevel,\n EngagementUpdateReason,\n} from './behavior';\nexport type { SessionRenewedEvent, SessionExpiredEvent } from './session';\nexport type {\n PurchaseEvent,\n LeadEvent,\n AddToCartEvent,\n RemoveFromCartEvent,\n InitiateCheckoutEvent,\n AddPaymentInfoEvent,\n ViewContentEvent,\n SearchEvent,\n PurchaseData,\n LeadData,\n AddToCartData,\n RemoveFromCartData,\n InitiateCheckoutData,\n AddPaymentInfoData,\n ViewContentData,\n SearchData,\n PixelItem,\n ConversionEventData,\n} from './conversion';\nexport type {\n PixelEventCategory,\n EngagementEventCategory,\n ConversionEventCategory,\n} from './shared/category';\nexport type { ElementDescriptor } from './shared/ElementDescriptor';\nexport type { PixelEvent } from './types';\nexport { BaseEventBuilder } from './builder';\n","import type { AttributionService } from '@/services/attribution/types';\nimport type { BrowserMetadataService } from '@/services/browser-metadata';\nimport type { UrlContextService } from '@/modules/core/url-context';\n\nimport type { BasePixelEvent } from '../base';\n\nexport class BaseEventBuilder {\n private readonly metadataService: BrowserMetadataService;\n\n private readonly attribution: AttributionService | null;\n\n private readonly urlContext: UrlContextService | null;\n\n constructor(\n metadataService: BrowserMetadataService,\n attribution?: AttributionService | null,\n urlContext?: UrlContextService | null\n ) {\n this.metadataService = metadataService;\n this.attribution = attribution ?? null;\n this.urlContext = urlContext ?? null;\n }\n\n build<T extends { type: string }>(event: T): T & BasePixelEvent {\n const metadata = this.metadataService.getMetadata();\n const identifiers = this.attribution?.getSnapshot();\n const hasIdentifiers =\n identifiers !== undefined &&\n Object.keys(identifiers).some(key => {\n const value = identifiers[key as keyof typeof identifiers];\n return value !== undefined && value !== null && value !== '';\n });\n\n const urlSnapshot = this.urlContext?.isEnabled()\n ? this.urlContext.getSnapshot()\n : null;\n\n const hasQueryParams =\n urlSnapshot !== null
|
|
1
|
+
{"version":3,"sources":["../../src/events/index.ts","../../src/events/builder/BaseEventBuilder.ts"],"sourcesContent":["export type { BasePixelEvent } from './base';\nexport type { PageViewEvent } from './page-view';\nexport type {\n ScrollEvent,\n PageClickEvent,\n RageClickEvent,\n VisibilityChangeEvent,\n UserIdleEvent,\n UserActiveEvent,\n ExitIntentEvent,\n BehaviorHeartbeatEvent,\n ViewportEnterEvent,\n ViewportExitEvent,\n ViewportExitReason,\n EngagementUpdateEvent,\n EngagementSummaryEvent,\n BehaviorSessionSummaryEvent,\n BehaviorSessionSummaryReason,\n BehaviorState,\n EngagementLevel,\n EngagementUpdateReason,\n} from './behavior';\nexport type { SessionRenewedEvent, SessionExpiredEvent } from './session';\nexport type {\n PurchaseEvent,\n LeadEvent,\n AddToCartEvent,\n RemoveFromCartEvent,\n InitiateCheckoutEvent,\n AddPaymentInfoEvent,\n ViewContentEvent,\n SearchEvent,\n PurchaseData,\n LeadData,\n AddToCartData,\n RemoveFromCartData,\n InitiateCheckoutData,\n AddPaymentInfoData,\n ViewContentData,\n SearchData,\n PixelItem,\n ConversionEventData,\n} from './conversion';\nexport type {\n PixelEventCategory,\n EngagementEventCategory,\n ConversionEventCategory,\n} from './shared/category';\nexport type { ElementDescriptor } from './shared/ElementDescriptor';\nexport type { PixelEvent } from './types';\nexport { BaseEventBuilder } from './builder';\n","import type { AttributionService } from '@/services/attribution/types';\nimport type { BrowserMetadataService } from '@/services/browser-metadata';\nimport type { UrlContextService } from '@/modules/core/url-context';\n\nimport type { BasePixelEvent } from '../base';\n\nexport class BaseEventBuilder {\n private readonly metadataService: BrowserMetadataService;\n\n private readonly attribution: AttributionService | null;\n\n private readonly urlContext: UrlContextService | null;\n\n constructor(\n metadataService: BrowserMetadataService,\n attribution?: AttributionService | null,\n urlContext?: UrlContextService | null\n ) {\n this.metadataService = metadataService;\n this.attribution = attribution ?? null;\n this.urlContext = urlContext ?? null;\n }\n\n build<T extends { type: string }>(event: T): T & BasePixelEvent {\n const metadata = this.metadataService.getMetadata();\n const identifiers = this.attribution?.getSnapshot();\n const hasIdentifiers =\n identifiers !== undefined &&\n Object.keys(identifiers).some(key => {\n const value = identifiers[key as keyof typeof identifiers];\n return value !== undefined && value !== null && value !== '';\n });\n\n const urlSnapshot = this.urlContext?.isEnabled()\n ? this.urlContext.getSnapshot()\n : null;\n\n const hasQueryParams =\n urlSnapshot !== null && Object.keys(urlSnapshot.queryParams).length > 0;\n const hasUrlContext =\n urlSnapshot !== null &&\n ((urlSnapshot.urlContext.managed &&\n Object.keys(urlSnapshot.urlContext.managed).length > 0) ||\n (urlSnapshot.urlContext.forwarded &&\n Object.keys(urlSnapshot.urlContext.forwarded).length > 0) ||\n (urlSnapshot.urlContext.source &&\n Object.keys(urlSnapshot.urlContext.source).length > 0));\n\n return {\n ...event,\n timestamp: Date.now(),\n path: metadata.path,\n url: metadata.url,\n hostname: metadata.hostname,\n language: metadata.language,\n timezone: metadata.timezone,\n ...(hasIdentifiers ? { identifiers } : {}),\n ...(hasQueryParams\n ? { queryParams: { ...urlSnapshot!.queryParams } }\n : {}),\n ...(hasUrlContext\n ? {\n urlContext: {\n ...(urlSnapshot!.urlContext.managed\n ? { managed: { ...urlSnapshot!.urlContext.managed } }\n : {}),\n ...(urlSnapshot!.urlContext.forwarded\n ? { forwarded: { ...urlSnapshot!.urlContext.forwarded } }\n : {}),\n ...(urlSnapshot!.urlContext.source\n ? { source: { ...urlSnapshot!.urlContext.source } }\n : {}),\n },\n }\n : {}),\n };\n }\n}\n"],"mappings":";yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GCMO,IAAMI,EAAN,KAAuB,CAO5B,YACEC,EACAC,EACAC,EACA,CACA,KAAK,gBAAkBF,EACvB,KAAK,YAAcC,GAAe,KAClC,KAAK,WAAaC,GAAc,IAClC,CAEA,MAAkCC,EAA8B,CAC9D,IAAMC,EAAW,KAAK,gBAAgB,YAAY,EAC5CC,EAAc,KAAK,aAAa,YAAY,EAC5CC,EACJD,IAAgB,QAChB,OAAO,KAAKA,CAAW,EAAE,KAAKE,GAAO,CACnC,IAAMC,EAAQH,EAAYE,CAA+B,EACzD,OAA8BC,GAAU,MAAQA,IAAU,EAC5D,CAAC,EAEGC,EAAc,KAAK,YAAY,UAAU,EAC3C,KAAK,WAAW,YAAY,EAC5B,KAEEC,EACJD,IAAgB,MAAQ,OAAO,KAAKA,EAAY,WAAW,EAAE,OAAS,EAClEE,EACJF,IAAgB,OACdA,EAAY,WAAW,SACvB,OAAO,KAAKA,EAAY,WAAW,OAAO,EAAE,OAAS,GACpDA,EAAY,WAAW,WACtB,OAAO,KAAKA,EAAY,WAAW,SAAS,EAAE,OAAS,GACxDA,EAAY,WAAW,QACtB,OAAO,KAAKA,EAAY,WAAW,MAAM,EAAE,OAAS,GAE1D,MAAO,CACL,GAAGN,EACH,UAAW,KAAK,IAAI,EACpB,KAAMC,EAAS,KACf,IAAKA,EAAS,IACd,SAAUA,EAAS,SACnB,SAAUA,EAAS,SACnB,SAAUA,EAAS,SACnB,GAAIE,EAAiB,CAAE,YAAAD,CAAY,EAAI,CAAC,EACxC,GAAIK,EACA,CAAE,YAAa,CAAE,GAAGD,EAAa,WAAY,CAAE,EAC/C,CAAC,EACL,GAAIE,EACA,CACE,WAAY,CACV,GAAIF,EAAa,WAAW,QACxB,CAAE,QAAS,CAAE,GAAGA,EAAa,WAAW,OAAQ,CAAE,EAClD,CAAC,EACL,GAAIA,EAAa,WAAW,UACxB,CAAE,UAAW,CAAE,GAAGA,EAAa,WAAW,SAAU,CAAE,EACtD,CAAC,EACL,GAAIA,EAAa,WAAW,OACxB,CAAE,OAAQ,CAAE,GAAGA,EAAa,WAAW,MAAO,CAAE,EAChD,CAAC,CACP,CACF,EACA,CAAC,CACP,CACF,CACF","names":["events_exports","__export","BaseEventBuilder","__toCommonJS","BaseEventBuilder","metadataService","attribution","urlContext","event","metadata","identifiers","hasIdentifiers","key","value","urlSnapshot","hasQueryParams","hasUrlContext"]}
|
package/dist/events/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { n as AddPaymentInfoData, W as AddPaymentInfoEvent, m as AddToCartData, O as AddToCartEvent, c as BaseEventBuilder, g as BasePixelEvent, v as BehaviorHeartbeatEvent, F as BehaviorSessionSummaryEvent, G as BehaviorSessionSummaryReason, H as BehaviorState, a0 as ConversionEventCategory, Z as ConversionEventData, a1 as ElementDescriptor, $ as EngagementEventCategory, J as EngagementLevel, C as EngagementSummaryEvent, z as EngagementUpdateEvent, K as EngagementUpdateReason, E as ExitIntentEvent, I as InitiateCheckoutData, T as InitiateCheckoutEvent, L as LeadData, N as LeadEvent, q as PageClickEvent, h as PageViewEvent, P as PixelEvent, _ as PixelEventCategory,
|
|
2
|
-
import '../url-context-
|
|
1
|
+
export { n as AddPaymentInfoData, W as AddPaymentInfoEvent, m as AddToCartData, O as AddToCartEvent, c as BaseEventBuilder, g as BasePixelEvent, v as BehaviorHeartbeatEvent, F as BehaviorSessionSummaryEvent, G as BehaviorSessionSummaryReason, H as BehaviorState, a0 as ConversionEventCategory, Z as ConversionEventData, a1 as ElementDescriptor, $ as EngagementEventCategory, J as EngagementLevel, C as EngagementSummaryEvent, z as EngagementUpdateEvent, K as EngagementUpdateReason, E as ExitIntentEvent, I as InitiateCheckoutData, T as InitiateCheckoutEvent, L as LeadData, N as LeadEvent, q as PageClickEvent, h as PageViewEvent, P as PixelEvent, _ as PixelEventCategory, b as PixelItem, l as PurchaseData, M as PurchaseEvent, r as RageClickEvent, R as RemoveFromCartData, Q as RemoveFromCartEvent, p as ScrollEvent, o as SearchData, Y as SearchEvent, j as SessionExpiredEvent, i as SessionRenewedEvent, u as UserActiveEvent, t as UserIdleEvent, V as ViewContentData, X as ViewContentEvent, w as ViewportEnterEvent, x as ViewportExitEvent, y as ViewportExitReason, s as VisibilityChangeEvent } from '../index-BxT2d-TK.mjs';
|
|
2
|
+
import '../url-context-Ck2LK18V.mjs';
|
package/dist/events/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { n as AddPaymentInfoData, W as AddPaymentInfoEvent, m as AddToCartData, O as AddToCartEvent, c as BaseEventBuilder, g as BasePixelEvent, v as BehaviorHeartbeatEvent, F as BehaviorSessionSummaryEvent, G as BehaviorSessionSummaryReason, H as BehaviorState, a0 as ConversionEventCategory, Z as ConversionEventData, a1 as ElementDescriptor, $ as EngagementEventCategory, J as EngagementLevel, C as EngagementSummaryEvent, z as EngagementUpdateEvent, K as EngagementUpdateReason, E as ExitIntentEvent, I as InitiateCheckoutData, T as InitiateCheckoutEvent, L as LeadData, N as LeadEvent, q as PageClickEvent, h as PageViewEvent, P as PixelEvent, _ as PixelEventCategory,
|
|
2
|
-
import '../url-context-
|
|
1
|
+
export { n as AddPaymentInfoData, W as AddPaymentInfoEvent, m as AddToCartData, O as AddToCartEvent, c as BaseEventBuilder, g as BasePixelEvent, v as BehaviorHeartbeatEvent, F as BehaviorSessionSummaryEvent, G as BehaviorSessionSummaryReason, H as BehaviorState, a0 as ConversionEventCategory, Z as ConversionEventData, a1 as ElementDescriptor, $ as EngagementEventCategory, J as EngagementLevel, C as EngagementSummaryEvent, z as EngagementUpdateEvent, K as EngagementUpdateReason, E as ExitIntentEvent, I as InitiateCheckoutData, T as InitiateCheckoutEvent, L as LeadData, N as LeadEvent, q as PageClickEvent, h as PageViewEvent, P as PixelEvent, _ as PixelEventCategory, b as PixelItem, l as PurchaseData, M as PurchaseEvent, r as RageClickEvent, R as RemoveFromCartData, Q as RemoveFromCartEvent, p as ScrollEvent, o as SearchData, Y as SearchEvent, j as SessionExpiredEvent, i as SessionRenewedEvent, u as UserActiveEvent, t as UserIdleEvent, V as ViewContentData, X as ViewContentEvent, w as ViewportEnterEvent, x as ViewportExitEvent, y as ViewportExitReason, s as VisibilityChangeEvent } from '../index-B8u_3PGG.js';
|
|
2
|
+
import '../url-context-Ck2LK18V.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/events/builder/BaseEventBuilder.ts"],"sourcesContent":["import type { AttributionService } from '@/services/attribution/types';\nimport type { BrowserMetadataService } from '@/services/browser-metadata';\nimport type { UrlContextService } from '@/modules/core/url-context';\n\nimport type { BasePixelEvent } from '../base';\n\nexport class BaseEventBuilder {\n private readonly metadataService: BrowserMetadataService;\n\n private readonly attribution: AttributionService | null;\n\n private readonly urlContext: UrlContextService | null;\n\n constructor(\n metadataService: BrowserMetadataService,\n attribution?: AttributionService | null,\n urlContext?: UrlContextService | null\n ) {\n this.metadataService = metadataService;\n this.attribution = attribution ?? null;\n this.urlContext = urlContext ?? null;\n }\n\n build<T extends { type: string }>(event: T): T & BasePixelEvent {\n const metadata = this.metadataService.getMetadata();\n const identifiers = this.attribution?.getSnapshot();\n const hasIdentifiers =\n identifiers !== undefined &&\n Object.keys(identifiers).some(key => {\n const value = identifiers[key as keyof typeof identifiers];\n return value !== undefined && value !== null && value !== '';\n });\n\n const urlSnapshot = this.urlContext?.isEnabled()\n ? this.urlContext.getSnapshot()\n : null;\n\n const hasQueryParams =\n urlSnapshot !== null
|
|
1
|
+
{"version":3,"sources":["../../src/events/builder/BaseEventBuilder.ts"],"sourcesContent":["import type { AttributionService } from '@/services/attribution/types';\nimport type { BrowserMetadataService } from '@/services/browser-metadata';\nimport type { UrlContextService } from '@/modules/core/url-context';\n\nimport type { BasePixelEvent } from '../base';\n\nexport class BaseEventBuilder {\n private readonly metadataService: BrowserMetadataService;\n\n private readonly attribution: AttributionService | null;\n\n private readonly urlContext: UrlContextService | null;\n\n constructor(\n metadataService: BrowserMetadataService,\n attribution?: AttributionService | null,\n urlContext?: UrlContextService | null\n ) {\n this.metadataService = metadataService;\n this.attribution = attribution ?? null;\n this.urlContext = urlContext ?? null;\n }\n\n build<T extends { type: string }>(event: T): T & BasePixelEvent {\n const metadata = this.metadataService.getMetadata();\n const identifiers = this.attribution?.getSnapshot();\n const hasIdentifiers =\n identifiers !== undefined &&\n Object.keys(identifiers).some(key => {\n const value = identifiers[key as keyof typeof identifiers];\n return value !== undefined && value !== null && value !== '';\n });\n\n const urlSnapshot = this.urlContext?.isEnabled()\n ? this.urlContext.getSnapshot()\n : null;\n\n const hasQueryParams =\n urlSnapshot !== null && Object.keys(urlSnapshot.queryParams).length > 0;\n const hasUrlContext =\n urlSnapshot !== null &&\n ((urlSnapshot.urlContext.managed &&\n Object.keys(urlSnapshot.urlContext.managed).length > 0) ||\n (urlSnapshot.urlContext.forwarded &&\n Object.keys(urlSnapshot.urlContext.forwarded).length > 0) ||\n (urlSnapshot.urlContext.source &&\n Object.keys(urlSnapshot.urlContext.source).length > 0));\n\n return {\n ...event,\n timestamp: Date.now(),\n path: metadata.path,\n url: metadata.url,\n hostname: metadata.hostname,\n language: metadata.language,\n timezone: metadata.timezone,\n ...(hasIdentifiers ? { identifiers } : {}),\n ...(hasQueryParams\n ? { queryParams: { ...urlSnapshot!.queryParams } }\n : {}),\n ...(hasUrlContext\n ? {\n urlContext: {\n ...(urlSnapshot!.urlContext.managed\n ? { managed: { ...urlSnapshot!.urlContext.managed } }\n : {}),\n ...(urlSnapshot!.urlContext.forwarded\n ? { forwarded: { ...urlSnapshot!.urlContext.forwarded } }\n : {}),\n ...(urlSnapshot!.urlContext.source\n ? { source: { ...urlSnapshot!.urlContext.source } }\n : {}),\n },\n }\n : {}),\n };\n }\n}\n"],"mappings":";AAMO,IAAMA,EAAN,KAAuB,CAO5B,YACEC,EACAC,EACAC,EACA,CACA,KAAK,gBAAkBF,EACvB,KAAK,YAAcC,GAAe,KAClC,KAAK,WAAaC,GAAc,IAClC,CAEA,MAAkCC,EAA8B,CAC9D,IAAMC,EAAW,KAAK,gBAAgB,YAAY,EAC5CC,EAAc,KAAK,aAAa,YAAY,EAC5CC,EACJD,IAAgB,QAChB,OAAO,KAAKA,CAAW,EAAE,KAAKE,GAAO,CACnC,IAAMC,EAAQH,EAAYE,CAA+B,EACzD,OAA8BC,GAAU,MAAQA,IAAU,EAC5D,CAAC,EAEGC,EAAc,KAAK,YAAY,UAAU,EAC3C,KAAK,WAAW,YAAY,EAC5B,KAEEC,EACJD,IAAgB,MAAQ,OAAO,KAAKA,EAAY,WAAW,EAAE,OAAS,EAClEE,EACJF,IAAgB,OACdA,EAAY,WAAW,SACvB,OAAO,KAAKA,EAAY,WAAW,OAAO,EAAE,OAAS,GACpDA,EAAY,WAAW,WACtB,OAAO,KAAKA,EAAY,WAAW,SAAS,EAAE,OAAS,GACxDA,EAAY,WAAW,QACtB,OAAO,KAAKA,EAAY,WAAW,MAAM,EAAE,OAAS,GAE1D,MAAO,CACL,GAAGN,EACH,UAAW,KAAK,IAAI,EACpB,KAAMC,EAAS,KACf,IAAKA,EAAS,IACd,SAAUA,EAAS,SACnB,SAAUA,EAAS,SACnB,SAAUA,EAAS,SACnB,GAAIE,EAAiB,CAAE,YAAAD,CAAY,EAAI,CAAC,EACxC,GAAIK,EACA,CAAE,YAAa,CAAE,GAAGD,EAAa,WAAY,CAAE,EAC/C,CAAC,EACL,GAAIE,EACA,CACE,WAAY,CACV,GAAIF,EAAa,WAAW,QACxB,CAAE,QAAS,CAAE,GAAGA,EAAa,WAAW,OAAQ,CAAE,EAClD,CAAC,EACL,GAAIA,EAAa,WAAW,UACxB,CAAE,UAAW,CAAE,GAAGA,EAAa,WAAW,SAAU,CAAE,EACtD,CAAC,EACL,GAAIA,EAAa,WAAW,OACxB,CAAE,OAAQ,CAAE,GAAGA,EAAa,WAAW,MAAO,CAAE,EAChD,CAAC,CACP,CACF,EACA,CAAC,CACP,CACF,CACF","names":["BaseEventBuilder","metadataService","attribution","urlContext","event","metadata","identifiers","hasIdentifiers","key","value","urlSnapshot","hasQueryParams","hasUrlContext"]}
|
|
@@ -1,93 +1,37 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Playground HTML — Pixel v2
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Exemplos HTML internos para validação manual do SDK.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Pré-requisito
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Na raiz do monorepo:
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
```txt
|
|
12
|
-
dist/examples/html-script/
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
O bundle global usado pelos exemplos:
|
|
16
|
-
|
|
17
|
-
```txt
|
|
18
|
-
../../../dist/v2/global.global.js
|
|
9
|
+
```bash
|
|
10
|
+
pnpm --filter @beworke/pixel build
|
|
19
11
|
```
|
|
20
12
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Eventos (pastas)
|
|
13
|
+
## Bundle global
|
|
26
14
|
|
|
27
|
-
|
|
28
|
-
|--------|-------|------------------|
|
|
29
|
-
| LEAD | `lead/` | click, auto, attribute |
|
|
30
|
-
| ADD_TO_CART | `add-to-cart/` | attribute, click, auto, text, manual, dedupe, order-bump |
|
|
31
|
-
| REMOVE_FROM_CART | `remove-from-cart/` | attribute, text, css, manual, state, dedupe, multi |
|
|
32
|
-
| INITIATE_CHECKOUT | `initiate-checkout/` | attribute, click, submit, auto, text, manual, snapshot |
|
|
33
|
-
| ADD_PAYMENT_INFO | `add-payment-info/` | autocomplete, fields, disabled, manual, dedupe, security, rules, data-track |
|
|
34
|
-
| SEARCH | `search/` | attribute, button, input, submit, text, manual, dedupe |
|
|
35
|
-
| VIEW_CONTENT | `view-content/` | attribute, product-card, text, css, manual, empty, dedupe |
|
|
15
|
+
Os HTMLs referenciam o IIFE em:
|
|
36
16
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## Exemplos gerais (raiz)
|
|
42
|
-
|
|
43
|
-
```txt
|
|
44
|
-
release-candidate.html # Etapa 13A — consumidor real (script tag + API)
|
|
45
|
-
RELEASE_CANDIDATE.md # como consumir / testar o RC (14C fechamento)
|
|
46
|
-
example-checkout-commerce.html # checkout: form ATC → main_offer do cart
|
|
47
|
-
example-landing-commerce.html # landing_page + PAGE_VIEW enriquecido (14A)
|
|
48
|
-
example-basic.html
|
|
49
|
-
example-behavior.html
|
|
50
|
-
example-conversion.html
|
|
51
|
-
example-transport.html
|
|
52
|
-
example-integration.html
|
|
53
|
-
example-url-context.html # checkout + upsell (15A)
|
|
54
|
-
example-url-context-landing.html # landing com sid gerado (15A)
|
|
55
|
-
example-url-context-upsell.html # upsell com forward params (15A)
|
|
56
|
-
example-url-context-allowed-domains.html # allowedDomains restrito (15A)
|
|
57
|
-
example-runtime-diagnostics.html # Etapa 16 — getDebugSnapshot()
|
|
58
|
-
example-behavior-heartbeat.html # Etapa 17 — Heartbeat Runtime
|
|
59
|
-
example-behavior-viewport.html # Etapa 18 — Viewport Runtime
|
|
60
|
-
example-behavior-engagement.html # Etapa 19 — Engagement Runtime
|
|
61
|
-
example-behavior-runtime-intelligence.html # Etapa 20 — Runtime Intelligence
|
|
62
|
-
full-funnel/ # funil completo (15B) — contrato oficial commerce
|
|
17
|
+
```text
|
|
18
|
+
../../packages/pixel/dist/v2/global.global.js (raiz do playground)
|
|
19
|
+
../../../packages/pixel/dist/v2/global.global.js (subpastas)
|
|
63
20
|
```
|
|
64
21
|
|
|
65
|
-
|
|
22
|
+
Após o build, abra os `.html` no navegador (servidor estático local recomendado).
|
|
66
23
|
|
|
67
|
-
|
|
68
|
-
- Auto via `sources[]` — **não** `selector`/`selectorForm` soltos no detector
|
|
69
|
-
- Core UrlContext via `modules.core.urlContext` (`query_params`, `url_context`, link decoration)
|
|
24
|
+
## AutoTrack — source `link`
|
|
70
25
|
|
|
71
|
-
|
|
26
|
+
Nova source do Core: observa o **destino** de um `<a href>` (não a URL da página).
|
|
72
27
|
|
|
73
|
-
|
|
28
|
+
Exemplo dedicado:
|
|
74
29
|
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
npm run test:smoke:real
|
|
78
|
-
|
|
79
|
-
# com .env (não commitar):
|
|
80
|
-
# PIXEL_REAL_API_SMOKE=true
|
|
81
|
-
# PIXEL_API_ENDPOINT=https://...
|
|
82
|
-
# PIXEL_ID=pix_...
|
|
83
|
-
npm run test:smoke:real
|
|
30
|
+
```text
|
|
31
|
+
add-to-cart/example-add-to-cart-link.html
|
|
84
32
|
```
|
|
85
33
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
---
|
|
89
|
-
|
|
90
|
-
## Nota sobre `examples/v2/`
|
|
34
|
+
Também presente em `example-landing-commerce.html` (CTA externo).
|
|
91
35
|
|
|
92
|
-
|
|
93
|
-
|
|
36
|
+
> **Legado:** na estrutura anterior ao monorepo, este diretório era `examples/html-script/`.
|
|
37
|
+
> No tarball npm, cópias transformadas ficam em `dist/examples/html-script/` com caminhos relativos ao `dist`.
|
|
@@ -5,24 +5,24 @@ Validação do pacote como **consumidor real** (script tag + bundle global + Tra
|
|
|
5
5
|
## Pré-requisitos
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
pnpm --filter @beworke/pixel build
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
Artefatos esperados:
|
|
12
12
|
|
|
13
13
|
```txt
|
|
14
|
-
dist/v2/global.global.js # IIFE → window.PixelV2
|
|
15
|
-
dist/examples/html-script/ #
|
|
16
|
-
dist/index.esm.js / index.cjs.js
|
|
17
|
-
dist/index.d.ts
|
|
14
|
+
packages/pixel/dist/v2/global.global.js # IIFE → window.PixelV2
|
|
15
|
+
packages/pixel/dist/examples/html-script/ # cópia empacotada dos playgrounds
|
|
16
|
+
packages/pixel/dist/index.esm.js / index.cjs.js
|
|
17
|
+
packages/pixel/dist/index.d.ts
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## Abrir a página RC
|
|
21
21
|
|
|
22
22
|
```txt
|
|
23
|
-
|
|
24
|
-
# ou pós-build:
|
|
25
|
-
dist/examples/html-script/release-candidate.html
|
|
23
|
+
apps/playground-html/release-candidate.html
|
|
24
|
+
# ou pós-build (tarball / dist):
|
|
25
|
+
packages/pixel/dist/examples/html-script/release-candidate.html
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
Abra no navegador (file:// ou servidor estático).
|
|
@@ -104,9 +104,10 @@ Ver `example-checkout-commerce.html` / `release-candidate.html` para checkout co
|
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
106
|
pnpm add @beworke/pixel
|
|
107
|
-
# ou validar tarball local:
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
# ou validar tarball local (fluxo oficial do monorepo):
|
|
108
|
+
pnpm pack:pixel
|
|
109
|
+
pnpm validate:pixel-package
|
|
110
|
+
# npm install ./artifacts/beworke-pixel-VERSAO.tgz
|
|
110
111
|
```
|
|
111
112
|
|
|
112
113
|
```ts
|
|
@@ -118,7 +119,7 @@ Exports: ver `package.json` → `exports` (`.` / `./global` / `./v2` / `./config
|
|
|
118
119
|
## Smoke automatizado (complementar)
|
|
119
120
|
|
|
120
121
|
```bash
|
|
121
|
-
|
|
122
|
+
pnpm --filter @beworke/pixel test:smoke:real # skip seguro sem .env
|
|
122
123
|
# com .env: Event 8× ACK + Batch 8 eventos
|
|
123
124
|
```
|
|
124
125
|
|
|
@@ -132,4 +133,4 @@ A etapa 13A está **pronta para RC** quando:
|
|
|
132
133
|
4. HTTP Event/Batch com ACK (se endpoint disponível)
|
|
133
134
|
5. destroy/reinit sem duplicar listeners
|
|
134
135
|
|
|
135
|
-
Pendências futuras: `PIXEL_V2_BACKLOG_PENDENCIAS_ISOLADO.md` (P1/P2).
|
|
136
|
+
Pendências futuras: `PLAN_PIXEL/PIXEL_V2_BACKLOG_PENDENCIAS_ISOLADO.md` (P1/P2).
|
package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-autocomplete.html
CHANGED
|
@@ -180,7 +180,7 @@ code { font-size: 0.85em; }
|
|
|
180
180
|
</div>
|
|
181
181
|
</div>
|
|
182
182
|
|
|
183
|
-
<script src="../../../
|
|
183
|
+
<script src="../../../v2/global.global.js"></script>
|
|
184
184
|
<script>
|
|
185
185
|
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
186
186
|
const API_ENDPOINT =
|
package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html
CHANGED
|
@@ -159,7 +159,7 @@ code { font-size: 0.85em; }
|
|
|
159
159
|
</div>
|
|
160
160
|
</div>
|
|
161
161
|
|
|
162
|
-
<script src="../../../
|
|
162
|
+
<script src="../../../v2/global.global.js"></script>
|
|
163
163
|
<script>
|
|
164
164
|
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
165
165
|
const API_ENDPOINT =
|
package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-fields.html
CHANGED
|
@@ -172,7 +172,7 @@ code { font-size: 0.85em; }
|
|
|
172
172
|
</div>
|
|
173
173
|
</div>
|
|
174
174
|
|
|
175
|
-
<script src="../../../
|
|
175
|
+
<script src="../../../v2/global.global.js"></script>
|
|
176
176
|
<script>
|
|
177
177
|
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
178
178
|
const API_ENDPOINT =
|
|
@@ -161,7 +161,7 @@ code { font-size: 0.85em; }
|
|
|
161
161
|
</div>
|
|
162
162
|
</div>
|
|
163
163
|
|
|
164
|
-
<script src="../../../
|
|
164
|
+
<script src="../../../v2/global.global.js"></script>
|
|
165
165
|
<script>
|
|
166
166
|
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
167
167
|
const API_ENDPOINT =
|
|
@@ -167,7 +167,7 @@ code { font-size: 0.85em; }
|
|
|
167
167
|
</div>
|
|
168
168
|
</div>
|
|
169
169
|
|
|
170
|
-
<script src="../../../
|
|
170
|
+
<script src="../../../v2/global.global.js"></script>
|
|
171
171
|
<script>
|
|
172
172
|
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
173
173
|
const API_ENDPOINT =
|
|
@@ -166,7 +166,7 @@ code { font-size: 0.85em; }
|
|
|
166
166
|
</div>
|
|
167
167
|
</div>
|
|
168
168
|
|
|
169
|
-
<script src="../../../
|
|
169
|
+
<script src="../../../v2/global.global.js"></script>
|
|
170
170
|
<script>
|
|
171
171
|
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
172
172
|
const API_ENDPOINT =
|
|
@@ -155,7 +155,7 @@ code { font-size: 0.85em; }
|
|
|
155
155
|
</div>
|
|
156
156
|
</div>
|
|
157
157
|
|
|
158
|
-
<script src="../../../
|
|
158
|
+
<script src="../../../v2/global.global.js"></script>
|
|
159
159
|
<script>
|
|
160
160
|
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
161
161
|
const API_ENDPOINT =
|
|
@@ -175,7 +175,7 @@ code { font-size: 0.85em; }
|
|
|
175
175
|
</div>
|
|
176
176
|
</div>
|
|
177
177
|
|
|
178
|
-
<script src="../../../
|
|
178
|
+
<script src="../../../v2/global.global.js"></script>
|
|
179
179
|
<script>
|
|
180
180
|
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
181
181
|
const API_ENDPOINT =
|
|
@@ -11,6 +11,7 @@ Cada HTML valida **um** comportamento. Abra um de cada vez.
|
|
|
11
11
|
| 5 | [`example-add-to-cart-manual.html`](./example-add-to-cart-manual.html) | `pixel.addToCart()` | Payload manual, catalog, override de preço |
|
|
12
12
|
| 6 | [`example-add-to-cart-dedupe.html`](./example-add-to-cart-dedupe.html) | clique / API rápida | Janela ~500ms sem bloquear ação futura |
|
|
13
13
|
| 7 | [`example-add-to-cart-order-bump.html`](./example-add-to-cart-order-bump.html) | multi produto | CommerceState / cart mirror |
|
|
14
|
+
| 8 | [`example-add-to-cart-link.html`](./example-add-to-cart-link.html) | source `type: link` + `<a href>` | Match de destino + bindings + catalog |
|
|
14
15
|
|
|
15
16
|
## Fontes de produto (merge)
|
|
16
17
|
|
|
@@ -23,14 +24,16 @@ Cada HTML valida **um** comportamento. Abra um de cada vez.
|
|
|
23
24
|
6. defaults
|
|
24
25
|
```
|
|
25
26
|
|
|
27
|
+
Source `link`: `productId` vem de bindings (`dataset` → `query` → `pathParam`), depois o enrich do Core.
|
|
28
|
+
|
|
26
29
|
## Como abrir
|
|
27
30
|
|
|
28
|
-
1. Na raiz: `
|
|
31
|
+
1. Na raiz: `pnpm --filter @beworke/pixel build`
|
|
29
32
|
2. Abra o HTML (live server recomendado)
|
|
30
|
-
3. Script: `../../../dist/v2/global.global.js`
|
|
33
|
+
3. Script: `../../../packages/pixel/dist/v2/global.global.js`
|
|
31
34
|
|
|
32
35
|
## Ordem sugerida
|
|
33
36
|
|
|
34
|
-
`atributo → click+form → auto → text → manual → dedupe → order bump`
|
|
37
|
+
`atributo → click+form → auto → text → manual → dedupe → order bump → link`
|
|
35
38
|
|
|
36
39
|
LEAD (referência): [`../lead/`](../lead/)
|
|
@@ -92,7 +92,8 @@ code { font-size: 0.85em; }
|
|
|
92
92
|
<a href="example-add-to-cart-text.html" class="">4. Text</a>
|
|
93
93
|
<a href="example-add-to-cart-manual.html" class="">5. Manual API</a>
|
|
94
94
|
<a href="example-add-to-cart-dedupe.html" class="">6. Dedupe</a>
|
|
95
|
-
<a href="example-add-to-cart-order-bump.html" class="">7. Order bump</a
|
|
95
|
+
<a href="example-add-to-cart-order-bump.html" class="">7. Order bump</a>
|
|
96
|
+
<a href="example-add-to-cart-link.html" class="">8. Link</a></div>
|
|
96
97
|
<div class="hint"><strong>Contexto:</strong> PDP / card de produto. Clique em botão com
|
|
97
98
|
<code>data-track="add_to_cart"</code> + <code>data-product-*</code>.
|
|
98
99
|
Sem <code>selectorForm</code> — <code>ConfiguredSelectorDetector</code> +
|
|
@@ -181,7 +182,7 @@ code { font-size: 0.85em; }
|
|
|
181
182
|
</div>
|
|
182
183
|
</div>
|
|
183
184
|
|
|
184
|
-
<script src="../../../
|
|
185
|
+
<script src="../../../v2/global.global.js"></script>
|
|
185
186
|
<script>
|
|
186
187
|
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
187
188
|
const API_ENDPOINT =
|
|
@@ -92,7 +92,8 @@ code { font-size: 0.85em; }
|
|
|
92
92
|
<a href="example-add-to-cart-text.html" class="">4. Text</a>
|
|
93
93
|
<a href="example-add-to-cart-manual.html" class="">5. Manual API</a>
|
|
94
94
|
<a href="example-add-to-cart-dedupe.html" class="">6. Dedupe</a>
|
|
95
|
-
<a href="example-add-to-cart-order-bump.html" class="">7. Order bump</a
|
|
95
|
+
<a href="example-add-to-cart-order-bump.html" class="">7. Order bump</a>
|
|
96
|
+
<a href="example-add-to-cart-link.html" class="">8. Link</a></div>
|
|
96
97
|
<div class="hint"><strong>Contexto:</strong> ao completar contato no checkout, dispara
|
|
97
98
|
<code>ADD_TO_CART</code> automaticamente (input/change) com produto de
|
|
98
99
|
<code>initialItems</code> / catálogo. <code>fireOnce: true</code>.</div>
|
|
@@ -172,7 +173,7 @@ code { font-size: 0.85em; }
|
|
|
172
173
|
</div>
|
|
173
174
|
</div>
|
|
174
175
|
|
|
175
|
-
<script src="../../../
|
|
176
|
+
<script src="../../../v2/global.global.js"></script>
|
|
176
177
|
<script>
|
|
177
178
|
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
178
179
|
const API_ENDPOINT =
|
|
@@ -92,7 +92,8 @@ code { font-size: 0.85em; }
|
|
|
92
92
|
<a href="example-add-to-cart-text.html" class="">4. Text</a>
|
|
93
93
|
<a href="example-add-to-cart-manual.html" class="">5. Manual API</a>
|
|
94
94
|
<a href="example-add-to-cart-dedupe.html" class="">6. Dedupe</a>
|
|
95
|
-
<a href="example-add-to-cart-order-bump.html" class="">7. Order bump</a
|
|
95
|
+
<a href="example-add-to-cart-order-bump.html" class="">7. Order bump</a>
|
|
96
|
+
<a href="example-add-to-cart-link.html" class="">8. Link</a></div>
|
|
96
97
|
<div class="hint"><strong>Contexto:</strong> checkout — só adiciona ao carrinho depois que
|
|
97
98
|
contato (email <em>e</em> phone) está ok. <code>mode: 'all'</code> +
|
|
98
99
|
<code>trigger: 'click'</code> no CTA.</div>
|
|
@@ -179,7 +180,7 @@ code { font-size: 0.85em; }
|
|
|
179
180
|
</div>
|
|
180
181
|
</div>
|
|
181
182
|
|
|
182
|
-
<script src="../../../
|
|
183
|
+
<script src="../../../v2/global.global.js"></script>
|
|
183
184
|
<script>
|
|
184
185
|
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
185
186
|
const API_ENDPOINT =
|
|
@@ -92,7 +92,8 @@ code { font-size: 0.85em; }
|
|
|
92
92
|
<a href="example-add-to-cart-text.html" class="">4. Text</a>
|
|
93
93
|
<a href="example-add-to-cart-manual.html" class="">5. Manual API</a>
|
|
94
94
|
<a href="example-add-to-cart-dedupe.html" class="active">6. Dedupe</a>
|
|
95
|
-
<a href="example-add-to-cart-order-bump.html" class="">7. Order bump</a
|
|
95
|
+
<a href="example-add-to-cart-order-bump.html" class="">7. Order bump</a>
|
|
96
|
+
<a href="example-add-to-cart-link.html" class="">8. Link</a></div>
|
|
96
97
|
<div class="hint"><strong>Contexto:</strong> janela de dedupe (~500ms). Dois cliques rápidos
|
|
97
98
|
no mesmo produto → <strong>1</strong> evento. Após >500ms → novo evento legítimo.</div>
|
|
98
99
|
|
|
@@ -167,7 +168,7 @@ code { font-size: 0.85em; }
|
|
|
167
168
|
</div>
|
|
168
169
|
</div>
|
|
169
170
|
|
|
170
|
-
<script src="../../../
|
|
171
|
+
<script src="../../../v2/global.global.js"></script>
|
|
171
172
|
<script>
|
|
172
173
|
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
173
174
|
const API_ENDPOINT =
|