@walkeros/web-source-datalayer
Version:
DataLayer source for walkerOS
102 lines (94 loc) • 3.45 kB
TypeScript
import { Source, Mapping } from '@walkeros/core';
/**
* Environment interface for dataLayer source
*/
interface DataLayerEnv extends Source.BaseEnv {
window?: typeof window;
}
/**
* Standard mock environment for testing dataLayer source
*
* Use this for testing dataLayer.push interception and event transformation
* without requiring a real browser environment.
*/
declare const push: DataLayerEnv;
declare const env_push: typeof push;
declare namespace env {
export { env_push as push };
}
/**
* Sample gtag events that would be pushed to dataLayer
* These represent real-world gtag calls that the dataLayer source should transform to WalkerOS events
*/
/**
* Consent Mode Events - Primary use case
*/
declare function consentUpdate$1(): unknown[];
declare function consentDefault(): unknown[];
/**
* E-commerce Events
*/
declare function purchase$1(): unknown[];
declare function add_to_cart$1(): unknown[];
declare function view_item$1(): unknown[];
/**
* Config Events
*/
declare function config$1(): unknown[];
/**
* Set Events
*/
declare function setCustom(): unknown[];
/**
* Direct dataLayer object pushes (not gtag)
*/
declare function directDataLayerEvent(): Record<string, unknown>;
declare const events_consentDefault: typeof consentDefault;
declare const events_directDataLayerEvent: typeof directDataLayerEvent;
declare const events_setCustom: typeof setCustom;
declare namespace events {
export { add_to_cart$1 as add_to_cart, config$1 as config, events_consentDefault as consentDefault, consentUpdate$1 as consentUpdate, events_directDataLayerEvent as directDataLayerEvent, purchase$1 as purchase, events_setCustom as setCustom, view_item$1 as view_item };
}
/**
* Consent Mode Mapping - Primary use case
* Maps gtag consent events to walker consent commands
*/
declare const consentUpdate: Mapping.Rule;
/**
* E-commerce Event Mappings
* Transform GA4 ecommerce events to WalkerOS events
*/
declare const purchase: Mapping.Rule;
declare const add_to_cart: Mapping.Rule;
declare const view_item: Mapping.Rule;
/**
* Config Event Mapping
* Transform GA4 config events to WalkerOS page events
*/
declare const configGA4: Mapping.Rule;
/**
* Custom Event Mapping
* Handle direct dataLayer pushes
*/
declare const customEvent: Mapping.Rule;
/**
* Complete mapping configuration
* Following the same pattern as destination mappings
*/
declare const config: Mapping.Rules;
/**
* Minimal consent-only mapping for focused use cases
*/
declare const consentOnlyMapping: Mapping.Rules;
declare const mapping_add_to_cart: typeof add_to_cart;
declare const mapping_config: typeof config;
declare const mapping_configGA4: typeof configGA4;
declare const mapping_consentOnlyMapping: typeof consentOnlyMapping;
declare const mapping_consentUpdate: typeof consentUpdate;
declare const mapping_customEvent: typeof customEvent;
declare const mapping_purchase: typeof purchase;
declare const mapping_view_item: typeof view_item;
declare namespace mapping {
export { mapping_add_to_cart as add_to_cart, mapping_config as config, mapping_configGA4 as configGA4, mapping_consentOnlyMapping as consentOnlyMapping, mapping_consentUpdate as consentUpdate, mapping_customEvent as customEvent, mapping_purchase as purchase, mapping_view_item as view_item };
}
export { events as Events, mapping as Mapping, consentOnlyMapping, consentUpdate$1 as consentUpdateEvent, config as dataLayerExamples, env };