@beworke/pixel 0.1.0-rc.1 → 0.1.0-rc.6
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 +260 -4
- package/README.md +65 -118
- package/RELEASE_CANDIDATE.md +181 -36
- package/dist/{StorageFactory-BhpbB6Jj.d.mts → StorageFactory-CPghDPBj.d.mts} +2 -2
- package/dist/{StorageFactory-CAkJJqVD.d.ts → StorageFactory-tjfzk57c.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 -3
- package/dist/config/index.d.ts +4 -3
- package/dist/config/index.esm.js +1 -1
- package/dist/config/index.esm.js.map +1 -1
- package/dist/events/index.cjs.js +1 -1
- package/dist/events/index.cjs.js.map +1 -1
- package/dist/events/index.d.mts +2 -1
- package/dist/events/index.d.ts +2 -1
- package/dist/events/index.esm.js +1 -1
- package/dist/events/index.esm.js.map +1 -1
- package/dist/examples/html-script/README.md +24 -2
- package/dist/examples/html-script/RELEASE_CANDIDATE.md +20 -6
- package/dist/examples/html-script/add-payment-info/README.md +3 -3
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-autocomplete.html +66 -48
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html +66 -48
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-fields.html +65 -47
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-data-track.html +73 -47
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-dedupe.html +65 -47
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-manual.html +56 -47
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-rules-card.html +65 -47
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-security.html +65 -47
- package/dist/examples/html-script/add-to-cart/README.md +3 -3
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-attribute.html +90 -70
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-auto.html +103 -81
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-click.html +101 -78
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-dedupe.html +90 -70
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-manual.html +81 -67
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-order-bump.html +90 -70
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-text.html +104 -81
- package/dist/examples/html-script/behavior/example-behavior-engagement.html +489 -0
- package/dist/examples/html-script/behavior/example-behavior-heartbeat.html +350 -0
- package/dist/examples/html-script/behavior/example-behavior-runtime-intelligence.html +433 -0
- package/dist/examples/html-script/behavior/example-behavior-viewport.html +397 -0
- package/dist/examples/html-script/{example-behavior.html → behavior/example-behavior.html} +23 -17
- package/dist/examples/html-script/example-checkout-commerce.html +825 -0
- package/dist/examples/html-script/example-integration.html +5 -5
- package/dist/examples/html-script/example-landing-commerce.html +380 -0
- package/dist/examples/html-script/example-runtime-diagnostics.html +108 -0
- package/dist/examples/html-script/example-transport.html +5 -5
- package/dist/examples/html-script/full-funnel/README.md +64 -0
- package/dist/examples/html-script/full-funnel/checkout.html +116 -0
- package/dist/examples/html-script/full-funnel/downsell.html +58 -0
- package/dist/examples/html-script/full-funnel/landing.html +99 -0
- package/dist/examples/html-script/full-funnel/thank-you.html +85 -0
- package/dist/examples/html-script/full-funnel/upsell.html +64 -0
- package/dist/examples/html-script/initiate-checkout/README.md +6 -6
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-attribute.html +94 -74
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-auto.html +102 -80
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-click.html +103 -80
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-manual.html +86 -72
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-snapshot.html +95 -75
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-submit.html +103 -83
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-text.html +105 -82
- package/dist/examples/html-script/lead/README.md +9 -7
- package/dist/examples/html-script/lead/example-lead-trigger-attribute.html +67 -47
- package/dist/examples/html-script/lead/example-lead-trigger-auto.html +78 -56
- package/dist/examples/html-script/lead/example-lead-trigger-click.html +78 -55
- package/dist/examples/html-script/release-candidate.html +187 -76
- package/dist/examples/html-script/remove-from-cart/README.md +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-attribute.html +93 -73
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-css.html +93 -73
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-dedupe.html +93 -73
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-manual.html +84 -70
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-multi.html +94 -74
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-state.html +95 -75
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-text.html +98 -76
- package/dist/examples/html-script/search/README.md +1 -1
- package/dist/examples/html-script/search/example-search-attribute.html +66 -51
- package/dist/examples/html-script/search/example-search-button-sync.html +66 -51
- package/dist/examples/html-script/search/example-search-dedupe.html +66 -51
- package/dist/examples/html-script/search/example-search-input.html +67 -51
- package/dist/examples/html-script/search/example-search-manual.html +57 -48
- package/dist/examples/html-script/search/example-search-submit.html +66 -51
- package/dist/examples/html-script/search/example-search-text.html +71 -51
- package/dist/examples/html-script/url-context/example-url-context-allowed-domains.html +63 -0
- package/dist/examples/html-script/url-context/example-url-context-landing.html +70 -0
- package/dist/examples/html-script/url-context/example-url-context-upsell.html +67 -0
- package/dist/examples/html-script/url-context/example-url-context.html +171 -0
- package/dist/examples/html-script/view-content/README.md +1 -1
- package/dist/examples/html-script/view-content/example-view-content-attribute.html +85 -70
- package/dist/examples/html-script/view-content/example-view-content-css.html +85 -70
- package/dist/examples/html-script/view-content/example-view-content-dedupe.html +85 -70
- package/dist/examples/html-script/view-content/example-view-content-empty.html +85 -70
- package/dist/examples/html-script/view-content/example-view-content-manual.html +76 -67
- package/dist/examples/html-script/view-content/example-view-content-product-card.html +85 -70
- package/dist/examples/html-script/view-content/example-view-content-text.html +90 -73
- package/dist/examples/v2/README.md +4 -1
- package/dist/{index-DUfFzniE.d.ts → index-CQAyT5Od.d.ts} +170 -3
- package/dist/{index-DUfFzniE.d.mts → index-JlKPz4pp.d.mts} +170 -3
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +435 -12
- package/dist/index.d.ts +435 -12
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/{pixel-CbeF25mD.d.mts → pixel-BxZZx8l5.d.ts} +248 -72
- package/dist/{pixel-CbeF25mD.d.ts → pixel-CKc4OQUx.d.mts} +248 -72
- package/dist/{pixel-default-config-1VgLFOiL.d.mts → pixel-default-config-CJl-eypl.d.mts} +1 -1
- package/dist/{pixel-default-config-Bxb-Vdd8.d.ts → pixel-default-config-aAOujzwp.d.ts} +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 +19 -26
- package/dist/runtime/index.d.ts +19 -26
- 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 +14 -6
- package/dist/services/index.d.ts +14 -6
- package/dist/services/index.esm.js +1 -1
- package/dist/services/index.esm.js.map +1 -1
- package/dist/types-BP8dz1gP.d.mts +19 -0
- package/dist/types-C75pQP31.d.ts +19 -0
- package/dist/types-DMhzHSVC.d.mts +293 -0
- package/dist/types-D_SsCur9.d.ts +293 -0
- package/dist/url-context-BjAsQoVl.d.mts +85 -0
- package/dist/url-context-BjAsQoVl.d.ts +85 -0
- 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 +8 -6
- package/dist/v2/index.d.ts +8 -6
- package/dist/v2/index.esm.js +1 -1
- package/dist/v2/index.esm.js.map +1 -1
- package/docs/public/README.md +75 -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 +75 -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 +37 -0
- package/docs/public/troubleshooting.md +55 -0
- package/package.json +13 -1
- package/dist/types-CTpRvFKZ.d.ts +0 -71
- package/dist/types-DGlBdsAy.d.mts +0 -71
|
@@ -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 (catálogo, checkout inicial, mappings).\n * Vivem em `conversion.commerce`, fora de `auto`.\n * Runtime: ProductCatalog + CommerceState + Extractors +\n * CommerceResolver + OrderCalculator (Etapas 12C–12F).\n */\n\nexport type ProductType =\n | 'main'\n | 'order_bump'\n | 'upsell'\n | 'downsell'\n | 'cross_sell'\n | 'addon'\n | 'subscription'\n | 'custom';\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 CommerceItem = {\n productId: string;\n quantity?: number;\n price?: number;\n currency?: string;\n selected?: boolean;\n metadata?: Record<string, unknown>;\n};\n\nexport type CommerceCheckoutMode =\n | 'single_product'\n | 'multi_product'\n | 'cart'\n | 'funnel';\n\nexport type CommerceCalculateValueFrom =\n | 'selected_items'\n | 'event_items'\n | 'manual';\n\nexport type CommerceConfig = {\n currency?: string;\n\n catalog?: {\n products?: CommerceProduct[];\n };\n\n checkout?: {\n mode?: CommerceCheckoutMode;\n selectedItems?: CommerceItem[];\n calculateValueFrom?: CommerceCalculateValueFrom;\n allowDynamicItems?: boolean;\n };\n\n mappings?: {\n attributes?: Record<string, string[]>;\n fields?: Record<string, string[]>;\n };\n};\n\n/** Default seguro: sem produtos, sem itens, sem auto-disparo implícito. */\nexport const DEFAULT_COMMERCE_CONFIG: CommerceConfig = {\n catalog: {\n products: [],\n },\n checkout: {\n selectedItems: [],\n allowDynamicItems: true,\n calculateValueFrom: 'selected_items',\n },\n mappings: {\n attributes: {},\n fields: {},\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 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 selector: '',\n selectorType: 'attribute',\n visibilityThreshold: 0.5,\n },\n\n heartbeat: {\n enabled: false,\n intervalMs: 5_000,\n hiddenIntervalMs: 30_000,\n },\n\n engagement: {\n enabled: false,\n weights: {\n scroll: 0.3,\n click: 0.3,\n time: 0.25,\n },\n thresholds: {\n low: 30,\n medium: 70,\n },\n },\n },\n};\n","import type { ConversionModuleConfig } from '../../types/modules/conversion';\n\nexport const DEFAULT_CONVERSION_MODULE_CONFIG: ConversionModuleConfig = {\n enabled: false,\n\n commerce: {\n catalog: {\n products: [],\n },\n checkout: {\n selectedItems: [],\n allowDynamicItems: true,\n calculateValueFrom: 'selected_items',\n },\n mappings: {\n attributes: {},\n fields: {},\n },\n },\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: {\n enabled: false,\n },\n purchase: {\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 paymentMethod: 'CREDIT_CARD',\n cardDetection: true,\n autoDispatch: true,\n },\n search: {\n enabled: false,\n },\n viewContent: {\n enabled: false,\n },\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","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';\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 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,CCPO,IAAMM,EAA0C,CACrD,QAAS,CACP,SAAU,CAAC,CACb,EACA,SAAU,CACR,cAAe,CAAC,EAChB,kBAAmB,GACnB,mBAAoB,gBACtB,EACA,SAAU,CACR,WAAY,CAAC,EACb,OAAQ,CAAC,CACX,CACF,ECnFO,IAAMC,EAAgD,CAC3D,QAAS,GACT,QAAS,GACT,QAAS,GACT,iBAAkB,GAClB,e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,EAEA,IAAK,CACH,QAAS,GACT,UAAW,GACX,UAAW,EACb,EAEA,cAAe,CACb,QAAS,GACT,YAAa,EACf,CACF,EClBO,IAAMC,EAAyD,CACpE,QAAS,GAET,WAAY,CACV,QAAS,EACX,EAEA,OAAQ,CACN,KAAM,MACR,EAEA,YAAa,CACX,QAAS,EACX,EAEA,OAAQ,CACN,QAAS,EACX,EAEA,SAAU,CACR,QAAS,EACX,EAEA,aAAc,CACZ,QAAS,EACX,EAEA,eAAgB,CACd,QAAS,GACT,iBAAkB,EAClB,eAAgB,IAChB,oBAAqB,CACvB,EAEA,aAAc,CACZ,QAAS,GACT,aAAc,IACd,OAAQ,cACR,WAAY,EACd,EAEA,WAAY,CACV,QAAS,GACT,WAAY,GACd,EAEA,YAAa,CACX,QAAS,GACT,SAAU,UACZ,EAEA,MAAO,CACL,QAAS,GACT,YAAa,EACb,YAAa,IACb,WAAY,IACZ,WAAY,CACd,EAEA,MAAO,CACL,QAAS,GACT,UAAW,GACX,gBAAiB,IACjB,UAAW,GACb,EAEA,QAAS,CACP,QAAS,GACT,UAAW,GACb,EAEA,QAAS,CACP,QAAS,EACX,EAEA,MAAO,CACL,QAAS,GACT,gBAAiB,IACjB,eAAgB,GAChB,mBAAoB,EACtB,CACF,EC1EO,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,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_CONFIG","DEFAULT_ATTRIBUTION_CONFIG","DEFAULT_BEHAVIOR_MODULE_CONFIG","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_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 * 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,OAA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AW,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"]}
|
package/dist/events/index.cjs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* Pixel v2 — SDK de analytics e conversão */
|
|
2
|
-
"use strict";var
|
|
2
|
+
"use strict";var l=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var E=(a,t)=>{for(var r in t)l(a,r,{get:t[r],enumerable:!0})},x=(a,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of c(t))!p.call(a,o)&&o!==r&&l(a,o,{get:()=>t[o],enumerable:!(n=d(t,o))||n.enumerable});return a};var y=a=>x(l({},"__esModule",{value:!0}),a);var C={};E(C,{BaseEventBuilder:()=>i});module.exports=y(C);var i=class{constructor(t,r,n){this.metadataService=t,this.attribution=r??null,this.urlContext=n??null}build(t){let r=this.metadataService.getMetadata(),n=this.attribution?.getSnapshot(),o=n!==void 0&&Object.keys(n).some(m=>{let s=n[m];return s!=null&&s!==""}),e=this.urlContext?.isEnabled()?this.urlContext.getSnapshot():null,u=e!==null&&Object.keys(e.queryParams).length>0,v=e!==null&&(e.urlContext.managed&&Object.keys(e.urlContext.managed).length>0||e.urlContext.forwarded&&Object.keys(e.urlContext.forwarded).length>0||e.urlContext.source&&Object.keys(e.urlContext.source).length>0);return{...t,timestamp:Date.now(),path:r.path,url:r.url,hostname:r.hostname,language:r.language,timezone:r.timezone,...o?{identifiers:n}:{},...u?{queryParams:{...e.queryParams}}:{},...v?{urlContext:{...e.urlContext.managed?{managed:{...e.urlContext.managed}}:{},...e.urlContext.forwarded?{forwarded:{...e.urlContext.forwarded}}:{},...e.urlContext.source?{source:{...e.urlContext.source}}:{}}}:{}}}};0&&(module.exports={BaseEventBuilder});
|
|
3
3
|
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -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} 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 {
|
|
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 &&\n 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 },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A,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 +1,2 @@
|
|
|
1
|
-
export {
|
|
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, a 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-JlKPz4pp.mjs';
|
|
2
|
+
import '../url-context-BjAsQoVl.mjs';
|
package/dist/events/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
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, a 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-CQAyT5Od.js';
|
|
2
|
+
import '../url-context-BjAsQoVl.js';
|
package/dist/events/index.esm.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* Pixel v2 — SDK de analytics e conversão */
|
|
2
|
-
var
|
|
2
|
+
var n=class{constructor(a,t,r){this.metadataService=a,this.attribution=t??null,this.urlContext=r??null}build(a){let t=this.metadataService.getMetadata(),r=this.attribution?.getSnapshot(),i=r!==void 0&&Object.keys(r).some(u=>{let o=r[u];return o!=null&&o!==""}),e=this.urlContext?.isEnabled()?this.urlContext.getSnapshot():null,s=e!==null&&Object.keys(e.queryParams).length>0,l=e!==null&&(e.urlContext.managed&&Object.keys(e.urlContext.managed).length>0||e.urlContext.forwarded&&Object.keys(e.urlContext.forwarded).length>0||e.urlContext.source&&Object.keys(e.urlContext.source).length>0);return{...a,timestamp:Date.now(),path:t.path,url:t.url,hostname:t.hostname,language:t.language,timezone:t.timezone,...i?{identifiers:r}:{},...s?{queryParams:{...e.queryParams}}:{},...l?{urlContext:{...e.urlContext.managed?{managed:{...e.urlContext.managed}}:{},...e.urlContext.forwarded?{forwarded:{...e.urlContext.forwarded}}:{},...e.urlContext.source?{source:{...e.urlContext.source}}:{}}}:{}}}};export{n as BaseEventBuilder};
|
|
3
3
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -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';\n\nimport type { BasePixelEvent } from '../base';\n\nexport class BaseEventBuilder {\n private readonly metadataService: BrowserMetadataService;\n\n private readonly attribution: AttributionService | null;\n\n constructor(\n metadataService: BrowserMetadataService,\n attribution?: AttributionService | null\n ) {\n this.metadataService = metadataService;\n this.attribution = attribution ?? 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 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 };\n }\n}\n"],"mappings":";
|
|
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 &&\n 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,MAChB,OAAO,KAAKA,EAAY,WAAW,EAAE,OAAS,EAC1CE,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,6 +1,10 @@
|
|
|
1
1
|
# Pixel v2 — Playgrounds HTML (Commerce + AutoTrack)
|
|
2
2
|
|
|
3
|
-
Playgrounds oficiais da frente **Commerce + AutoTrack Avançado** (Etapas 12L–
|
|
3
|
+
Playgrounds oficiais da frente **Commerce + AutoTrack Avançado** (Etapas 12L–14C).
|
|
4
|
+
|
|
5
|
+
**Versão RC:** `@beworke/pixel` `0.1.0-rc.5` · Etapas 1–20 · contrato `config.commerce` + `auto.detectors[event].sources[]` + Core UrlContext
|
|
6
|
+
|
|
7
|
+
> Playgrounds **internos** — podem usar APIs `@internal`. Para exemplos públicos, use [`examples/public/`](../public/).
|
|
4
8
|
|
|
5
9
|
Após `npm run build`, os mesmos arquivos ficam em:
|
|
6
10
|
|
|
@@ -38,14 +42,32 @@ Cada pasta tem um `README.md` com o mapa dos cenários.
|
|
|
38
42
|
|
|
39
43
|
```txt
|
|
40
44
|
release-candidate.html # Etapa 13A — consumidor real (script tag + API)
|
|
41
|
-
RELEASE_CANDIDATE.md # como consumir / testar o RC
|
|
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)
|
|
42
48
|
example-basic.html
|
|
43
49
|
example-behavior.html
|
|
44
50
|
example-conversion.html
|
|
45
51
|
example-transport.html
|
|
46
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
|
|
47
63
|
```
|
|
48
64
|
|
|
65
|
+
Contratos nos exemplos:
|
|
66
|
+
|
|
67
|
+
- `commerce` na raiz (`enabled`, `cart.initialItems`, `enrichment[event]`)
|
|
68
|
+
- Auto via `sources[]` — **não** `selector`/`selectorForm` soltos no detector
|
|
69
|
+
- Core UrlContext via `modules.core.urlContext` (`query_params`, `url_context`, link decoration)
|
|
70
|
+
|
|
49
71
|
---
|
|
50
72
|
|
|
51
73
|
## Smoke real (opcional)
|
|
@@ -49,15 +49,29 @@ Valores ficam em `localStorage` (`pixel_rc_conn`) — **não commitar `.env`**.
|
|
|
49
49
|
| `window.PixelV2` | Pill no topo |
|
|
50
50
|
| PAGE_VIEW | Core `trackInitialPageView` no init — painel conta via Transport `sentCount` (subscribe é pós-init) |
|
|
51
51
|
| LEAD / ATC / IC / PURCHASE manuais | Botões Manual |
|
|
52
|
-
| LEAD auto | Campos email/phone (
|
|
53
|
-
| ADD_TO_CART data-track / text | `
|
|
54
|
-
| INITIATE_CHECKOUT submit |
|
|
52
|
+
| LEAD auto | Campos email/phone (source `form` · trigger auto) |
|
|
53
|
+
| ADD_TO_CART data-track / text | source `selector` (sem source `form` no ATC) |
|
|
54
|
+
| INITIATE_CHECKOUT submit | source `form` em `#checkout-form` + lifecycle `ready` |
|
|
55
55
|
| Dedupe 500ms | Cliques rápidos em ATC |
|
|
56
56
|
| Transport ACK | Painel Transport debug + Flush |
|
|
57
57
|
| destroy / reinit | Botões Lifecycle |
|
|
58
58
|
|
|
59
59
|
Checklist visual está no rodapé da página.
|
|
60
60
|
|
|
61
|
+
## Configuração Commerce + Auto Sources (Etapa 14A–14B)
|
|
62
|
+
|
|
63
|
+
`commerce` fica na **raiz** de `PixelConfig` (não em `modules.conversion`):
|
|
64
|
+
|
|
65
|
+
- `commerce.enabled` — gate global de enrichment
|
|
66
|
+
- `cart.initialItems` — seed do carrinho
|
|
67
|
+
- `cart.calculateValueFrom: 'cart'`
|
|
68
|
+
- `enrichment[event].enabled` — gate por evento
|
|
69
|
+
- `auto.detectors[event].sources[]` — contrato auto oficial
|
|
70
|
+
|
|
71
|
+
Ver `example-landing-commerce.html` para `mode: 'landing_page'` + `enrichment.pageView.enabled: true`.
|
|
72
|
+
Ver `example-checkout-commerce.html` / `release-candidate.html` para checkout completo
|
|
73
|
+
(lifecycle → IC, form → ATC, selector → bump, payment → ADD_PAYMENT_INFO).
|
|
74
|
+
|
|
61
75
|
## Consumo CDN / script tag
|
|
62
76
|
|
|
63
77
|
```html
|
|
@@ -89,14 +103,14 @@ Checklist visual está no rodapé da página.
|
|
|
89
103
|
## Consumo ESM / CJS (pacote)
|
|
90
104
|
|
|
91
105
|
```bash
|
|
92
|
-
pnpm add @
|
|
106
|
+
pnpm add @beworke/pixel
|
|
93
107
|
# ou validar tarball local:
|
|
94
108
|
npm pack
|
|
95
|
-
# npm install ./
|
|
109
|
+
# npm install ./beworke-pixel-0.1.0-rc.4.tgz
|
|
96
110
|
```
|
|
97
111
|
|
|
98
112
|
```ts
|
|
99
|
-
import { Pixel, DEFAULT_PIXEL_CONFIG } from '@
|
|
113
|
+
import { Pixel, DEFAULT_PIXEL_CONFIG } from '@beworke/pixel';
|
|
100
114
|
```
|
|
101
115
|
|
|
102
116
|
Exports: ver `package.json` → `exports` (`.` / `./global` / `./v2` / `./config` …).
|
|
@@ -4,11 +4,11 @@ Cada HTML valida **um** comportamento. Abra um de cada vez.
|
|
|
4
4
|
|
|
5
5
|
## Como a SDK funciona (importante)
|
|
6
6
|
|
|
7
|
-
`addPaymentInfo`
|
|
7
|
+
`addPaymentInfo` usa `sources[]` — não tem `selector` / `selectorForm` no nível do detector.
|
|
8
8
|
|
|
9
9
|
| Caminho | Como ativa |
|
|
10
10
|
|---------|------------|
|
|
11
|
-
| **CardDetector** | `
|
|
11
|
+
| **CardDetector** | `sources[]` com `type: 'payment'` e `cardDetection: true` **ou** `rules.card.enabled` |
|
|
12
12
|
| **Manual** | `pixel.addPaymentInfo({ paymentMethod })` |
|
|
13
13
|
| **data-track** | só via `rules.selectors` + `SelectorDetector` legado |
|
|
14
14
|
|
|
@@ -26,7 +26,7 @@ Dedupe: `ADD_PAYMENT_INFO:session:{sessionId}` (1x por sessão).
|
|
|
26
26
|
|---|---------|--------------|
|
|
27
27
|
| 1 | [`example-add-payment-info-card-autocomplete.html`](./example-add-payment-info-card-autocomplete.html) | CardDetector + autocomplete |
|
|
28
28
|
| 2 | [`example-add-payment-info-card-fields.html`](./example-add-payment-info-card-fields.html) | id/name/CVV |
|
|
29
|
-
| 3 | [`example-add-payment-info-card-disabled.html`](./example-add-payment-info-card-disabled.html) | `cardDetection: false` |
|
|
29
|
+
| 3 | [`example-add-payment-info-card-disabled.html`](./example-add-payment-info-card-disabled.html) | `sources[]` com `type: 'payment'` e `cardDetection: false` |
|
|
30
30
|
| 4 | [`example-add-payment-info-manual.html`](./example-add-payment-info-manual.html) | API (CREDIT_CARD/PIX/BOLETO/…) |
|
|
31
31
|
| 5 | [`example-add-payment-info-dedupe.html`](./example-add-payment-info-dedupe.html) | Dedupe de sessão |
|
|
32
32
|
| 6 | [`example-add-payment-info-security.html`](./example-add-payment-info-security.html) | Sem vazamento de PAN/CVV |
|
package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-autocomplete.html
CHANGED
|
@@ -94,7 +94,7 @@ code { font-size: 0.85em; }
|
|
|
94
94
|
<a href="example-add-payment-info-rules-card.html" class="">7. rules.card</a>
|
|
95
95
|
<a href="example-add-payment-info-data-track.html" class="">8. data-track</a></div>
|
|
96
96
|
<div class="hint"><strong>Contexto:</strong> auto via <code>CardDetector</code>
|
|
97
|
-
(<code>
|
|
97
|
+
(<code>sources[]</code> com <code>type: 'payment'</code> e <code>cardDetection: true</code>). Dispara ao
|
|
98
98
|
<em>começar</em> a preencher campo com <code>autocomplete="cc-number"</code>
|
|
99
99
|
(também cc-exp / cc-csc). Payload: <code>{ paymentMethod: "CREDIT_CARD" }</code>
|
|
100
100
|
— o detector <strong>não</strong> usa <code>config.paymentMethod</code>.</div>
|
|
@@ -207,11 +207,18 @@ code { font-size: 0.85em; }
|
|
|
207
207
|
|
|
208
208
|
function addPaymentInfoDetectorConfig() {
|
|
209
209
|
return {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
210
|
+
enabled: true,
|
|
211
|
+
sources: [
|
|
212
|
+
{
|
|
213
|
+
name: 'credit-card-detection',
|
|
214
|
+
type: 'payment',
|
|
215
|
+
paymentMethod: 'PIX',
|
|
216
|
+
cardDetection: true,
|
|
217
|
+
autoDispatch: true,
|
|
218
|
+
fireOnce: true
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
};
|
|
215
222
|
}
|
|
216
223
|
|
|
217
224
|
function rulesConfig() {
|
|
@@ -241,6 +248,45 @@ code { font-size: 0.85em; }
|
|
|
241
248
|
timeoutMs: 10000,
|
|
242
249
|
},
|
|
243
250
|
identity: { ...base.identity, pixelId: PIXEL_ID },
|
|
251
|
+
commerce: {
|
|
252
|
+
enabled: true,
|
|
253
|
+
currency: 'BRL',
|
|
254
|
+
catalog: { products: [] },
|
|
255
|
+
cart: {
|
|
256
|
+
mode: 'single_product',
|
|
257
|
+
initialItems: [],
|
|
258
|
+
calculateValueFrom: 'cart',
|
|
259
|
+
allowDynamicItems: true,
|
|
260
|
+
},
|
|
261
|
+
mappings: {
|
|
262
|
+
attributes: {
|
|
263
|
+
productId: ['data-product-id'],
|
|
264
|
+
productName: ['data-product-name'],
|
|
265
|
+
price: ['data-product-price'],
|
|
266
|
+
quantity: ['data-quantity'],
|
|
267
|
+
currency: ['data-currency'],
|
|
268
|
+
},
|
|
269
|
+
fields: {
|
|
270
|
+
email: ['email'],
|
|
271
|
+
phone: ['phone'],
|
|
272
|
+
productId: ['productId'],
|
|
273
|
+
productName: ['productName'],
|
|
274
|
+
price: ['price'],
|
|
275
|
+
quantity: ['quantity'],
|
|
276
|
+
currency: ['currency'],
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
enrichment: {
|
|
280
|
+
pageView: { enabled: false, source: 'cart' },
|
|
281
|
+
viewContent: { enabled: true, source: 'event_or_cart' },
|
|
282
|
+
lead: { enabled: false, source: 'event_or_cart' },
|
|
283
|
+
addToCart: { enabled: true, source: 'event_or_cart' },
|
|
284
|
+
removeFromCart: { enabled: true, source: 'event_or_cart' },
|
|
285
|
+
initiateCheckout: { enabled: true, source: 'cart' },
|
|
286
|
+
addPaymentInfo: { enabled: true, source: 'cart' },
|
|
287
|
+
purchase: { enabled: true, source: 'cart' },
|
|
288
|
+
}
|
|
289
|
+
},
|
|
244
290
|
modules: {
|
|
245
291
|
...base.modules,
|
|
246
292
|
core: {
|
|
@@ -302,56 +348,28 @@ code { font-size: 0.85em; }
|
|
|
302
348
|
integrations: { ...base.modules.integrations, enabled: false },
|
|
303
349
|
conversion: {
|
|
304
350
|
enabled: true,
|
|
305
|
-
commerce: {
|
|
306
|
-
currency: 'BRL',
|
|
307
|
-
catalog: { products: [] },
|
|
308
|
-
checkout: {
|
|
309
|
-
mode: 'single_product',
|
|
310
|
-
selectedItems: [],
|
|
311
|
-
calculateValueFrom: 'selected_items',
|
|
312
|
-
allowDynamicItems: true,
|
|
313
|
-
},
|
|
314
|
-
mappings: {
|
|
315
|
-
attributes: {
|
|
316
|
-
productId: ['data-product-id'],
|
|
317
|
-
productName: ['data-product-name'],
|
|
318
|
-
price: ['data-product-price'],
|
|
319
|
-
quantity: ['data-quantity'],
|
|
320
|
-
currency: ['data-currency'],
|
|
321
|
-
},
|
|
322
|
-
fields: {
|
|
323
|
-
email: ['email'],
|
|
324
|
-
phone: ['phone'],
|
|
325
|
-
productId: ['productId'],
|
|
326
|
-
productName: ['productName'],
|
|
327
|
-
price: ['price'],
|
|
328
|
-
quantity: ['quantity'],
|
|
329
|
-
currency: ['currency'],
|
|
330
|
-
},
|
|
331
|
-
},
|
|
332
|
-
},
|
|
333
351
|
manual: {
|
|
334
352
|
pageView: { enabled: false },
|
|
335
|
-
purchase: { enabled: false },
|
|
336
|
-
lead: { enabled: false },
|
|
337
|
-
addToCart: { enabled: false },
|
|
338
|
-
removeFromCart: { enabled: false },
|
|
339
|
-
initiateCheckout: { enabled: false },
|
|
353
|
+
purchase: { enabled: false, sources: [] },
|
|
354
|
+
lead: { enabled: false, sources: [] },
|
|
355
|
+
addToCart: { enabled: false, sources: [] },
|
|
356
|
+
removeFromCart: { enabled: false, sources: [] },
|
|
357
|
+
initiateCheckout: { enabled: false, sources: [] },
|
|
340
358
|
addPaymentInfo: { enabled: true },
|
|
341
|
-
search: { enabled: false },
|
|
342
|
-
viewContent: { enabled: false },
|
|
359
|
+
search: { enabled: false, sources: [] },
|
|
360
|
+
viewContent: { enabled: false, sources: [] },
|
|
343
361
|
},
|
|
344
362
|
auto: {
|
|
345
363
|
enabled: true,
|
|
346
364
|
detectors: {
|
|
347
|
-
lead: { enabled: false },
|
|
348
|
-
purchase: { enabled: false },
|
|
349
|
-
addToCart: { enabled: false },
|
|
350
|
-
removeFromCart: { enabled: false },
|
|
351
|
-
initiateCheckout: { enabled: false },
|
|
365
|
+
lead: { enabled: false, sources: [] },
|
|
366
|
+
purchase: { enabled: false, sources: [] },
|
|
367
|
+
addToCart: { enabled: false, sources: [] },
|
|
368
|
+
removeFromCart: { enabled: false, sources: [] },
|
|
369
|
+
initiateCheckout: { enabled: false, sources: [] },
|
|
352
370
|
addPaymentInfo: addPaymentInfoDetectorConfig(),
|
|
353
|
-
search: { enabled: false },
|
|
354
|
-
viewContent: { enabled: false },
|
|
371
|
+
search: { enabled: false, sources: [] },
|
|
372
|
+
viewContent: { enabled: false, sources: [] },
|
|
355
373
|
},
|
|
356
374
|
},
|
|
357
375
|
rules: rulesConfig(),
|
package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html
CHANGED
|
@@ -94,7 +94,7 @@ code { font-size: 0.85em; }
|
|
|
94
94
|
<a href="example-add-payment-info-rules-card.html" class="">7. rules.card</a>
|
|
95
95
|
<a href="example-add-payment-info-data-track.html" class="">8. data-track</a></div>
|
|
96
96
|
<div class="hint"><strong>Contexto:</strong> <code>addPaymentInfo.enabled: true</code> mas
|
|
97
|
-
<code>cardDetection: false</code> → <strong>nenhum</strong> CardDetector.
|
|
97
|
+
<code>sources[]</code> com <code>type: 'payment'</code> e <code>cardDetection: false</code> → <strong>nenhum</strong> CardDetector.
|
|
98
98
|
Preencher cartão não dispara. Use API manual se quiser evento.</div>
|
|
99
99
|
|
|
100
100
|
<div class="card">
|
|
@@ -186,11 +186,18 @@ code { font-size: 0.85em; }
|
|
|
186
186
|
|
|
187
187
|
function addPaymentInfoDetectorConfig() {
|
|
188
188
|
return {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
189
|
+
enabled: true,
|
|
190
|
+
sources: [
|
|
191
|
+
{
|
|
192
|
+
name: 'credit-card-detection',
|
|
193
|
+
type: 'payment',
|
|
194
|
+
paymentMethod: 'CREDIT_CARD',
|
|
195
|
+
cardDetection: false,
|
|
196
|
+
autoDispatch: false,
|
|
197
|
+
fireOnce: true
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
};
|
|
194
201
|
}
|
|
195
202
|
|
|
196
203
|
function rulesConfig() {
|
|
@@ -220,6 +227,45 @@ code { font-size: 0.85em; }
|
|
|
220
227
|
timeoutMs: 10000,
|
|
221
228
|
},
|
|
222
229
|
identity: { ...base.identity, pixelId: PIXEL_ID },
|
|
230
|
+
commerce: {
|
|
231
|
+
enabled: true,
|
|
232
|
+
currency: 'BRL',
|
|
233
|
+
catalog: { products: [] },
|
|
234
|
+
cart: {
|
|
235
|
+
mode: 'single_product',
|
|
236
|
+
initialItems: [],
|
|
237
|
+
calculateValueFrom: 'cart',
|
|
238
|
+
allowDynamicItems: true,
|
|
239
|
+
},
|
|
240
|
+
mappings: {
|
|
241
|
+
attributes: {
|
|
242
|
+
productId: ['data-product-id'],
|
|
243
|
+
productName: ['data-product-name'],
|
|
244
|
+
price: ['data-product-price'],
|
|
245
|
+
quantity: ['data-quantity'],
|
|
246
|
+
currency: ['data-currency'],
|
|
247
|
+
},
|
|
248
|
+
fields: {
|
|
249
|
+
email: ['email'],
|
|
250
|
+
phone: ['phone'],
|
|
251
|
+
productId: ['productId'],
|
|
252
|
+
productName: ['productName'],
|
|
253
|
+
price: ['price'],
|
|
254
|
+
quantity: ['quantity'],
|
|
255
|
+
currency: ['currency'],
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
enrichment: {
|
|
259
|
+
pageView: { enabled: false, source: 'cart' },
|
|
260
|
+
viewContent: { enabled: true, source: 'event_or_cart' },
|
|
261
|
+
lead: { enabled: false, source: 'event_or_cart' },
|
|
262
|
+
addToCart: { enabled: true, source: 'event_or_cart' },
|
|
263
|
+
removeFromCart: { enabled: true, source: 'event_or_cart' },
|
|
264
|
+
initiateCheckout: { enabled: true, source: 'cart' },
|
|
265
|
+
addPaymentInfo: { enabled: true, source: 'cart' },
|
|
266
|
+
purchase: { enabled: true, source: 'cart' },
|
|
267
|
+
}
|
|
268
|
+
},
|
|
223
269
|
modules: {
|
|
224
270
|
...base.modules,
|
|
225
271
|
core: {
|
|
@@ -281,56 +327,28 @@ code { font-size: 0.85em; }
|
|
|
281
327
|
integrations: { ...base.modules.integrations, enabled: false },
|
|
282
328
|
conversion: {
|
|
283
329
|
enabled: true,
|
|
284
|
-
commerce: {
|
|
285
|
-
currency: 'BRL',
|
|
286
|
-
catalog: { products: [] },
|
|
287
|
-
checkout: {
|
|
288
|
-
mode: 'single_product',
|
|
289
|
-
selectedItems: [],
|
|
290
|
-
calculateValueFrom: 'selected_items',
|
|
291
|
-
allowDynamicItems: true,
|
|
292
|
-
},
|
|
293
|
-
mappings: {
|
|
294
|
-
attributes: {
|
|
295
|
-
productId: ['data-product-id'],
|
|
296
|
-
productName: ['data-product-name'],
|
|
297
|
-
price: ['data-product-price'],
|
|
298
|
-
quantity: ['data-quantity'],
|
|
299
|
-
currency: ['data-currency'],
|
|
300
|
-
},
|
|
301
|
-
fields: {
|
|
302
|
-
email: ['email'],
|
|
303
|
-
phone: ['phone'],
|
|
304
|
-
productId: ['productId'],
|
|
305
|
-
productName: ['productName'],
|
|
306
|
-
price: ['price'],
|
|
307
|
-
quantity: ['quantity'],
|
|
308
|
-
currency: ['currency'],
|
|
309
|
-
},
|
|
310
|
-
},
|
|
311
|
-
},
|
|
312
330
|
manual: {
|
|
313
331
|
pageView: { enabled: false },
|
|
314
|
-
purchase: { enabled: false },
|
|
315
|
-
lead: { enabled: false },
|
|
316
|
-
addToCart: { enabled: false },
|
|
317
|
-
removeFromCart: { enabled: false },
|
|
318
|
-
initiateCheckout: { enabled: false },
|
|
332
|
+
purchase: { enabled: false, sources: [] },
|
|
333
|
+
lead: { enabled: false, sources: [] },
|
|
334
|
+
addToCart: { enabled: false, sources: [] },
|
|
335
|
+
removeFromCart: { enabled: false, sources: [] },
|
|
336
|
+
initiateCheckout: { enabled: false, sources: [] },
|
|
319
337
|
addPaymentInfo: { enabled: true },
|
|
320
|
-
search: { enabled: false },
|
|
321
|
-
viewContent: { enabled: false },
|
|
338
|
+
search: { enabled: false, sources: [] },
|
|
339
|
+
viewContent: { enabled: false, sources: [] },
|
|
322
340
|
},
|
|
323
341
|
auto: {
|
|
324
342
|
enabled: true,
|
|
325
343
|
detectors: {
|
|
326
|
-
lead: { enabled: false },
|
|
327
|
-
purchase: { enabled: false },
|
|
328
|
-
addToCart: { enabled: false },
|
|
329
|
-
removeFromCart: { enabled: false },
|
|
330
|
-
initiateCheckout: { enabled: false },
|
|
344
|
+
lead: { enabled: false, sources: [] },
|
|
345
|
+
purchase: { enabled: false, sources: [] },
|
|
346
|
+
addToCart: { enabled: false, sources: [] },
|
|
347
|
+
removeFromCart: { enabled: false, sources: [] },
|
|
348
|
+
initiateCheckout: { enabled: false, sources: [] },
|
|
331
349
|
addPaymentInfo: addPaymentInfoDetectorConfig(),
|
|
332
|
-
search: { enabled: false },
|
|
333
|
-
viewContent: { enabled: false },
|
|
350
|
+
search: { enabled: false, sources: [] },
|
|
351
|
+
viewContent: { enabled: false, sources: [] },
|
|
334
352
|
},
|
|
335
353
|
},
|
|
336
354
|
rules: rulesConfig(),
|