UNPKG

@aws-amplify/analytics

Version:

Analytics category of aws-amplify

1 lines 2.11 kB
{"version":3,"file":"configureAutoTrack.mjs","sources":["../../../../../src/providers/pinpoint/apis/configureAutoTrack.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { updateProviderTrackers, validateTrackerConfiguration, } from '../../../utils';\nimport { record } from './record';\n// Configured Tracker instances for Pinpoint\nconst configuredTrackers = {};\n// Callback that will emit an appropriate event to Pinpoint when required by the Tracker\nconst emitTrackingEvent = (eventName, attributes) => {\n record({\n name: eventName,\n attributes,\n });\n};\n/**\n * Configures automatic event tracking for Pinpoint. This API will automatically transmit an analytic event when\n * configured events are detected within your application. This can include: DOM element events (via the `event`\n * tracker), session events (via the `session` tracker), and page view events (via the `pageView` tracker).\n *\n * @remark Only session tracking is currently supported on React Native.\n *\n * @param {ConfigureAutoTrackInput} params The input object to configure auto track behavior.\n *\n * @throws service: {@link UpdateEndpointException} - Thrown when the underlying Pinpoint service returns an error.\n * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect.\n */\nexport const configureAutoTrack = (input) => {\n validateTrackerConfiguration(input);\n // Initialize or update this provider's trackers\n updateProviderTrackers(input, emitTrackingEvent, configuredTrackers);\n};\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AAGA;AACA,MAAM,kBAAkB,GAAG,EAAE;AAC7B;AACA,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,UAAU,KAAK;AACrD,IAAI,MAAM,CAAC;AACX,QAAQ,IAAI,EAAE,SAAS;AACvB,QAAQ,UAAU;AAClB,KAAK,CAAC;AACN,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,kBAAkB,GAAG,CAAC,KAAK,KAAK;AAC7C,IAAI,4BAA4B,CAAC,KAAK,CAAC;AACvC;AACA,IAAI,sBAAsB,CAAC,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,CAAC;AACxE;;;;"}