@amplitude/analytics-core 2.5.6 → 2.6.1
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/lib/cjs/analytics-connector.d.ts +5 -0
- package/lib/cjs/analytics-connector.d.ts.map +1 -0
- package/lib/cjs/analytics-connector.js +20 -0
- package/lib/cjs/analytics-connector.js.map +1 -0
- package/lib/cjs/config.d.ts +107 -3
- package/lib/cjs/config.d.ts.map +1 -1
- package/lib/cjs/config.js +3 -3
- package/lib/cjs/config.js.map +1 -1
- package/lib/cjs/cookie-name.d.ts +3 -0
- package/lib/cjs/cookie-name.d.ts.map +1 -0
- package/lib/cjs/cookie-name.js +15 -0
- package/lib/cjs/cookie-name.js.map +1 -0
- package/lib/cjs/core-client.d.ts +154 -14
- package/lib/cjs/core-client.d.ts.map +1 -1
- package/lib/cjs/core-client.js +1 -1
- package/lib/cjs/core-client.js.map +1 -1
- package/lib/cjs/event-bridge/event-bridge-channel.d.ts +4 -3
- package/lib/cjs/event-bridge/event-bridge-channel.d.ts.map +1 -1
- package/lib/cjs/event-bridge/event-bridge-channel.js.map +1 -1
- package/lib/cjs/event-bridge/event-bridge-container.d.ts +1 -1
- package/lib/cjs/event-bridge/event-bridge-container.d.ts.map +1 -1
- package/lib/cjs/event-bridge/event-bridge-container.js.map +1 -1
- package/lib/cjs/event-bridge/event-bridge.d.ts +9 -2
- package/lib/cjs/event-bridge/event-bridge.d.ts.map +1 -1
- package/lib/cjs/event-bridge/event-bridge.js.map +1 -1
- package/lib/cjs/global-scope.d.ts +2 -0
- package/lib/cjs/global-scope.d.ts.map +1 -0
- package/lib/cjs/global-scope.js +28 -0
- package/lib/cjs/global-scope.js.map +1 -0
- package/lib/cjs/identify.d.ts +48 -1
- package/lib/cjs/identify.d.ts.map +1 -1
- package/lib/cjs/identify.js +32 -16
- package/lib/cjs/identify.js.map +1 -1
- package/lib/cjs/index.d.ts +37 -8
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +45 -6
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/language.d.ts +2 -0
- package/lib/cjs/language.d.ts.map +1 -0
- package/lib/cjs/language.js +13 -0
- package/lib/cjs/language.js.map +1 -0
- package/lib/cjs/logger.d.ts +27 -1
- package/lib/cjs/logger.d.ts.map +1 -1
- package/lib/cjs/logger.js +8 -8
- package/lib/cjs/logger.js.map +1 -1
- package/lib/cjs/plugins/destination.d.ts +14 -3
- package/lib/cjs/plugins/destination.d.ts.map +1 -1
- package/lib/cjs/plugins/destination.js +8 -8
- package/lib/cjs/plugins/destination.js.map +1 -1
- package/lib/cjs/plugins/identity.d.ts +11 -0
- package/lib/cjs/plugins/identity.d.ts.map +1 -0
- package/lib/cjs/plugins/identity.js +37 -0
- package/lib/cjs/plugins/identity.js.map +1 -0
- package/lib/cjs/query-params.d.ts +3 -0
- package/lib/cjs/query-params.d.ts.map +1 -0
- package/lib/cjs/query-params.js +36 -0
- package/lib/cjs/query-params.js.map +1 -0
- package/lib/cjs/revenue.d.ts +43 -1
- package/lib/cjs/revenue.d.ts.map +1 -1
- package/lib/cjs/revenue.js +28 -8
- package/lib/cjs/revenue.js.map +1 -1
- package/lib/cjs/session.d.ts +2 -0
- package/lib/cjs/session.d.ts.map +1 -0
- package/lib/cjs/session.js +11 -0
- package/lib/cjs/session.js.map +1 -0
- package/lib/cjs/storage/cookie.d.ts +13 -0
- package/lib/cjs/storage/cookie.d.ts.map +1 -0
- package/lib/cjs/storage/cookie.js +172 -0
- package/lib/cjs/storage/cookie.js.map +1 -0
- package/lib/cjs/storage/helpers.d.ts +2 -0
- package/lib/cjs/storage/helpers.d.ts.map +1 -0
- package/lib/cjs/storage/helpers.js +11 -0
- package/lib/cjs/storage/helpers.js.map +1 -0
- package/lib/cjs/storage/memory.d.ts +1 -1
- package/lib/cjs/storage/memory.d.ts.map +1 -1
- package/lib/cjs/storage/memory.js.map +1 -1
- package/lib/cjs/timeline.d.ts +8 -3
- package/lib/cjs/timeline.d.ts.map +1 -1
- package/lib/cjs/timeline.js.map +1 -1
- package/lib/cjs/transports/base.d.ts +4 -1
- package/lib/cjs/transports/base.d.ts.map +1 -1
- package/lib/cjs/transports/base.js +13 -16
- package/lib/cjs/transports/base.js.map +1 -1
- package/lib/cjs/transports/fetch.d.ts +8 -0
- package/lib/cjs/transports/fetch.d.ts.map +1 -0
- package/lib/cjs/transports/fetch.js +50 -0
- package/lib/cjs/transports/fetch.js.map +1 -0
- package/lib/cjs/types/browser-client.d.ts +131 -0
- package/lib/cjs/types/browser-client.d.ts.map +1 -0
- package/lib/cjs/types/browser-client.js +3 -0
- package/lib/cjs/types/browser-client.js.map +1 -0
- package/lib/cjs/types/browser-config.d.ts +217 -0
- package/lib/cjs/types/browser-config.d.ts.map +1 -0
- package/lib/cjs/types/browser-config.js +3 -0
- package/lib/cjs/types/browser-config.js.map +1 -0
- package/lib/cjs/types/constants.d.ts.map +1 -0
- package/lib/cjs/types/constants.js.map +1 -0
- package/lib/cjs/types/element-interactions.d.ts +73 -0
- package/lib/cjs/types/element-interactions.d.ts.map +1 -0
- package/lib/cjs/types/element-interactions.js +34 -0
- package/lib/cjs/types/element-interactions.js.map +1 -0
- package/lib/cjs/types/event/base-event.d.ts +64 -0
- package/lib/cjs/types/event/base-event.d.ts.map +1 -0
- package/lib/cjs/types/event/base-event.js +3 -0
- package/lib/cjs/types/event/base-event.js.map +1 -0
- package/lib/cjs/types/event/event.d.ts +68 -0
- package/lib/cjs/types/event/event.d.ts.map +1 -0
- package/lib/cjs/types/event/event.js +31 -0
- package/lib/cjs/types/event/event.js.map +1 -0
- package/lib/cjs/types/event/ingestion-metadata.d.ts +19 -0
- package/lib/cjs/types/event/ingestion-metadata.d.ts.map +1 -0
- package/lib/cjs/types/event/ingestion-metadata.js +3 -0
- package/lib/cjs/types/event/ingestion-metadata.js.map +1 -0
- package/lib/cjs/types/event/plan.d.ts +14 -0
- package/lib/cjs/types/event/plan.d.ts.map +1 -0
- package/lib/cjs/types/event/plan.js +3 -0
- package/lib/cjs/types/event/plan.js.map +1 -0
- package/lib/cjs/types/event-callback.d.ts +3 -0
- package/lib/cjs/types/event-callback.d.ts.map +1 -0
- package/lib/cjs/types/event-callback.js +3 -0
- package/lib/cjs/types/event-callback.js.map +1 -0
- package/lib/cjs/types/loglevel.d.ts +8 -0
- package/lib/cjs/types/loglevel.d.ts.map +1 -0
- package/lib/cjs/types/loglevel.js +12 -0
- package/lib/cjs/types/loglevel.js.map +1 -0
- package/lib/cjs/types/messages.d.ts.map +1 -0
- package/lib/cjs/types/messages.js.map +1 -0
- package/lib/cjs/types/offline.d.ts +2 -0
- package/lib/cjs/types/offline.d.ts.map +1 -0
- package/lib/cjs/types/offline.js +5 -0
- package/lib/cjs/types/offline.js.map +1 -0
- package/lib/cjs/types/page-view-tracking.d.ts +9 -0
- package/lib/cjs/types/page-view-tracking.d.ts.map +1 -0
- package/lib/cjs/types/page-view-tracking.js +3 -0
- package/lib/cjs/types/page-view-tracking.js.map +1 -0
- package/lib/cjs/types/payload.d.ts +13 -0
- package/lib/cjs/types/payload.d.ts.map +1 -0
- package/lib/cjs/types/payload.js +3 -0
- package/lib/cjs/types/payload.js.map +1 -0
- package/lib/cjs/types/plugin.d.ts +30 -0
- package/lib/cjs/types/plugin.d.ts.map +1 -0
- package/lib/cjs/types/plugin.js +3 -0
- package/lib/cjs/types/plugin.js.map +1 -0
- package/lib/cjs/types/response.d.ts +81 -0
- package/lib/cjs/types/response.d.ts.map +1 -0
- package/lib/cjs/types/response.js +3 -0
- package/lib/cjs/types/response.js.map +1 -0
- package/lib/cjs/types/result.d.ts +7 -0
- package/lib/cjs/types/result.d.ts.map +1 -0
- package/lib/cjs/types/result.js +3 -0
- package/lib/cjs/types/result.js.map +1 -0
- package/lib/cjs/types/server-zone.d.ts +9 -0
- package/lib/cjs/types/server-zone.d.ts.map +1 -0
- package/lib/cjs/types/server-zone.js +12 -0
- package/lib/cjs/types/server-zone.js.map +1 -0
- package/lib/cjs/types/status.d.ts +22 -0
- package/lib/cjs/types/status.d.ts.map +1 -0
- package/lib/cjs/types/status.js +26 -0
- package/lib/cjs/types/status.js.map +1 -0
- package/lib/cjs/types/storage.d.ts +16 -0
- package/lib/cjs/types/storage.d.ts.map +1 -0
- package/lib/cjs/types/storage.js +3 -0
- package/lib/cjs/types/storage.js.map +1 -0
- package/lib/cjs/types/transport.d.ts +7 -0
- package/lib/cjs/types/transport.d.ts.map +1 -0
- package/lib/cjs/types/transport.js +3 -0
- package/lib/cjs/types/transport.js.map +1 -0
- package/lib/cjs/types/user-session.d.ts +11 -0
- package/lib/cjs/types/user-session.d.ts.map +1 -0
- package/lib/cjs/types/user-session.js +3 -0
- package/lib/cjs/types/user-session.js.map +1 -0
- package/lib/cjs/utils/debug.d.ts +1 -1
- package/lib/cjs/utils/debug.d.ts.map +1 -1
- package/lib/cjs/utils/debug.js +2 -6
- package/lib/cjs/utils/debug.js.map +1 -1
- package/lib/cjs/utils/event-builder.d.ts +5 -2
- package/lib/cjs/utils/event-builder.d.ts.map +1 -1
- package/lib/cjs/utils/event-builder.js +5 -5
- package/lib/cjs/utils/event-builder.js.map +1 -1
- package/lib/cjs/utils/result-builder.d.ts +2 -1
- package/lib/cjs/utils/result-builder.d.ts.map +1 -1
- package/lib/cjs/utils/result-builder.js +2 -2
- package/lib/cjs/utils/result-builder.js.map +1 -1
- package/lib/cjs/utils/return-wrapper.d.ts +3 -1
- package/lib/cjs/utils/return-wrapper.d.ts.map +1 -1
- package/lib/cjs/utils/return-wrapper.js.map +1 -1
- package/lib/esm/analytics-connector.d.ts +5 -0
- package/lib/esm/analytics-connector.d.ts.map +1 -0
- package/lib/esm/analytics-connector.js +14 -0
- package/lib/esm/analytics-connector.js.map +1 -0
- package/lib/esm/config.d.ts +107 -3
- package/lib/esm/config.d.ts.map +1 -1
- package/lib/esm/config.js +2 -2
- package/lib/esm/config.js.map +1 -1
- package/lib/esm/cookie-name.d.ts +3 -0
- package/lib/esm/cookie-name.d.ts.map +1 -0
- package/lib/esm/cookie-name.js +10 -0
- package/lib/esm/cookie-name.js.map +1 -0
- package/lib/esm/core-client.d.ts +154 -14
- package/lib/esm/core-client.d.ts.map +1 -1
- package/lib/esm/core-client.js +1 -1
- package/lib/esm/core-client.js.map +1 -1
- package/lib/esm/event-bridge/event-bridge-channel.d.ts +4 -3
- package/lib/esm/event-bridge/event-bridge-channel.d.ts.map +1 -1
- package/lib/esm/event-bridge/event-bridge-channel.js.map +1 -1
- package/lib/esm/event-bridge/event-bridge-container.d.ts +1 -1
- package/lib/esm/event-bridge/event-bridge-container.d.ts.map +1 -1
- package/lib/esm/event-bridge/event-bridge-container.js.map +1 -1
- package/lib/esm/event-bridge/event-bridge.d.ts +9 -2
- package/lib/esm/event-bridge/event-bridge.d.ts.map +1 -1
- package/lib/esm/event-bridge/event-bridge.js.map +1 -1
- package/lib/esm/global-scope.d.ts +2 -0
- package/lib/esm/global-scope.d.ts.map +1 -0
- package/lib/esm/global-scope.js +24 -0
- package/lib/esm/global-scope.js.map +1 -0
- package/lib/esm/identify.d.ts +48 -1
- package/lib/esm/identify.d.ts.map +1 -1
- package/lib/esm/identify.js +18 -2
- package/lib/esm/identify.js.map +1 -1
- package/lib/esm/index.d.ts +37 -8
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +19 -3
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/language.d.ts +2 -0
- package/lib/esm/language.d.ts.map +1 -0
- package/lib/esm/language.js +9 -0
- package/lib/esm/language.js.map +1 -0
- package/lib/esm/logger.d.ts +27 -1
- package/lib/esm/logger.d.ts.map +1 -1
- package/lib/esm/logger.js +1 -1
- package/lib/esm/logger.js.map +1 -1
- package/lib/esm/plugins/destination.d.ts +14 -3
- package/lib/esm/plugins/destination.d.ts.map +1 -1
- package/lib/esm/plugins/destination.js +3 -3
- package/lib/esm/plugins/destination.js.map +1 -1
- package/lib/esm/plugins/identity.d.ts +11 -0
- package/lib/esm/plugins/identity.d.ts.map +1 -0
- package/lib/esm/plugins/identity.js +34 -0
- package/lib/esm/plugins/identity.js.map +1 -0
- package/lib/esm/query-params.d.ts +3 -0
- package/lib/esm/query-params.d.ts.map +1 -0
- package/lib/esm/query-params.js +31 -0
- package/lib/esm/query-params.js.map +1 -0
- package/lib/esm/revenue.d.ts +43 -1
- package/lib/esm/revenue.d.ts.map +1 -1
- package/lib/esm/revenue.js +21 -1
- package/lib/esm/revenue.js.map +1 -1
- package/lib/esm/session.d.ts +2 -0
- package/lib/esm/session.d.ts.map +1 -0
- package/lib/esm/session.js +7 -0
- package/lib/esm/session.js.map +1 -0
- package/lib/esm/storage/cookie.d.ts +13 -0
- package/lib/esm/storage/cookie.d.ts.map +1 -0
- package/lib/esm/storage/cookie.js +169 -0
- package/lib/esm/storage/cookie.js.map +1 -0
- package/lib/esm/storage/helpers.d.ts +2 -0
- package/lib/esm/storage/helpers.d.ts.map +1 -0
- package/lib/esm/storage/helpers.js +7 -0
- package/lib/esm/storage/helpers.js.map +1 -0
- package/lib/esm/storage/memory.d.ts +1 -1
- package/lib/esm/storage/memory.d.ts.map +1 -1
- package/lib/esm/storage/memory.js.map +1 -1
- package/lib/esm/timeline.d.ts +8 -3
- package/lib/esm/timeline.d.ts.map +1 -1
- package/lib/esm/timeline.js.map +1 -1
- package/lib/esm/transports/base.d.ts +4 -1
- package/lib/esm/transports/base.d.ts.map +1 -1
- package/lib/esm/transports/base.js +1 -4
- package/lib/esm/transports/base.js.map +1 -1
- package/lib/esm/transports/fetch.d.ts +8 -0
- package/lib/esm/transports/fetch.d.ts.map +1 -0
- package/lib/esm/transports/fetch.js +47 -0
- package/lib/esm/transports/fetch.js.map +1 -0
- package/lib/esm/types/browser-client.d.ts +131 -0
- package/lib/esm/types/browser-client.d.ts.map +1 -0
- package/lib/esm/types/browser-client.js +2 -0
- package/lib/esm/types/browser-client.js.map +1 -0
- package/lib/esm/types/browser-config.d.ts +217 -0
- package/lib/esm/types/browser-config.d.ts.map +1 -0
- package/lib/esm/types/browser-config.js +2 -0
- package/lib/esm/types/browser-config.js.map +1 -0
- package/lib/esm/types/constants.d.ts.map +1 -0
- package/lib/esm/types/constants.js.map +1 -0
- package/lib/esm/types/element-interactions.d.ts +73 -0
- package/lib/esm/types/element-interactions.d.ts.map +1 -0
- package/lib/esm/types/element-interactions.js +31 -0
- package/lib/esm/types/element-interactions.js.map +1 -0
- package/lib/esm/types/event/base-event.d.ts +64 -0
- package/lib/esm/types/event/base-event.d.ts.map +1 -0
- package/lib/esm/types/event/base-event.js +2 -0
- package/lib/esm/types/event/base-event.js.map +1 -0
- package/lib/esm/types/event/event.d.ts +68 -0
- package/lib/esm/types/event/event.d.ts.map +1 -0
- package/lib/esm/types/event/event.js +28 -0
- package/lib/esm/types/event/event.js.map +1 -0
- package/lib/esm/types/event/ingestion-metadata.d.ts +19 -0
- package/lib/esm/types/event/ingestion-metadata.d.ts.map +1 -0
- package/lib/esm/types/event/ingestion-metadata.js +2 -0
- package/lib/esm/types/event/ingestion-metadata.js.map +1 -0
- package/lib/esm/types/event/plan.d.ts +14 -0
- package/lib/esm/types/event/plan.d.ts.map +1 -0
- package/lib/esm/types/event/plan.js +2 -0
- package/lib/esm/types/event/plan.js.map +1 -0
- package/lib/esm/types/event-callback.d.ts +3 -0
- package/lib/esm/types/event-callback.d.ts.map +1 -0
- package/lib/esm/types/event-callback.js +2 -0
- package/lib/esm/types/event-callback.js.map +1 -0
- package/lib/esm/types/loglevel.d.ts +8 -0
- package/lib/esm/types/loglevel.d.ts.map +1 -0
- package/lib/esm/types/loglevel.js +9 -0
- package/lib/esm/types/loglevel.js.map +1 -0
- package/lib/esm/types/messages.d.ts.map +1 -0
- package/lib/esm/types/messages.js.map +1 -0
- package/lib/esm/types/offline.d.ts +2 -0
- package/lib/esm/types/offline.d.ts.map +1 -0
- package/lib/esm/types/offline.js +2 -0
- package/lib/esm/types/offline.js.map +1 -0
- package/lib/esm/types/page-view-tracking.d.ts +9 -0
- package/lib/esm/types/page-view-tracking.d.ts.map +1 -0
- package/lib/esm/types/page-view-tracking.js +2 -0
- package/lib/esm/types/page-view-tracking.js.map +1 -0
- package/lib/esm/types/payload.d.ts +13 -0
- package/lib/esm/types/payload.d.ts.map +1 -0
- package/lib/esm/types/payload.js +2 -0
- package/lib/esm/types/payload.js.map +1 -0
- package/lib/esm/types/plugin.d.ts +30 -0
- package/lib/esm/types/plugin.d.ts.map +1 -0
- package/lib/esm/types/plugin.js +2 -0
- package/lib/esm/types/plugin.js.map +1 -0
- package/lib/esm/types/response.d.ts +81 -0
- package/lib/esm/types/response.d.ts.map +1 -0
- package/lib/esm/types/response.js +2 -0
- package/lib/esm/types/response.js.map +1 -0
- package/lib/esm/types/result.d.ts +7 -0
- package/lib/esm/types/result.d.ts.map +1 -0
- package/lib/esm/types/result.js +2 -0
- package/lib/esm/types/result.js.map +1 -0
- package/lib/esm/types/server-zone.d.ts +9 -0
- package/lib/esm/types/server-zone.d.ts.map +1 -0
- package/lib/esm/types/server-zone.js +9 -0
- package/lib/esm/types/server-zone.js.map +1 -0
- package/lib/esm/types/status.d.ts +22 -0
- package/lib/esm/types/status.d.ts.map +1 -0
- package/lib/esm/types/status.js +23 -0
- package/lib/esm/types/status.js.map +1 -0
- package/lib/esm/types/storage.d.ts +16 -0
- package/lib/esm/types/storage.d.ts.map +1 -0
- package/lib/esm/types/storage.js +2 -0
- package/lib/esm/types/storage.js.map +1 -0
- package/lib/esm/types/transport.d.ts +7 -0
- package/lib/esm/types/transport.d.ts.map +1 -0
- package/lib/esm/types/transport.js +2 -0
- package/lib/esm/types/transport.js.map +1 -0
- package/lib/esm/types/user-session.d.ts +11 -0
- package/lib/esm/types/user-session.d.ts.map +1 -0
- package/lib/esm/types/user-session.js +2 -0
- package/lib/esm/types/user-session.js.map +1 -0
- package/lib/esm/utils/debug.d.ts +1 -1
- package/lib/esm/utils/debug.d.ts.map +1 -1
- package/lib/esm/utils/debug.js +1 -5
- package/lib/esm/utils/debug.js.map +1 -1
- package/lib/esm/utils/event-builder.d.ts +5 -2
- package/lib/esm/utils/event-builder.d.ts.map +1 -1
- package/lib/esm/utils/event-builder.js +1 -1
- package/lib/esm/utils/event-builder.js.map +1 -1
- package/lib/esm/utils/result-builder.d.ts +2 -1
- package/lib/esm/utils/result-builder.d.ts.map +1 -1
- package/lib/esm/utils/result-builder.js +1 -1
- package/lib/esm/utils/result-builder.js.map +1 -1
- package/lib/esm/utils/return-wrapper.d.ts +3 -1
- package/lib/esm/utils/return-wrapper.d.ts.map +1 -1
- package/lib/esm/utils/return-wrapper.js.map +1 -1
- package/package.json +2 -3
- package/lib/cjs/constants.d.ts.map +0 -1
- package/lib/cjs/constants.js.map +0 -1
- package/lib/cjs/messages.d.ts.map +0 -1
- package/lib/cjs/messages.js.map +0 -1
- package/lib/esm/constants.d.ts.map +0 -1
- package/lib/esm/constants.js.map +0 -1
- package/lib/esm/messages.d.ts.map +0 -1
- package/lib/esm/messages.js.map +0 -1
- /package/lib/cjs/{constants.d.ts → types/constants.d.ts} +0 -0
- /package/lib/cjs/{constants.js → types/constants.js} +0 -0
- /package/lib/cjs/{messages.d.ts → types/messages.d.ts} +0 -0
- /package/lib/cjs/{messages.js → types/messages.js} +0 -0
- /package/lib/esm/{constants.d.ts → types/constants.d.ts} +0 -0
- /package/lib/esm/{constants.js → types/constants.js} +0 -0
- /package/lib/esm/{messages.d.ts → types/messages.d.ts} +0 -0
- /package/lib/esm/{messages.js → types/messages.js} +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { TransportType } from './transport';
|
|
2
|
+
import { CoreClient } from '../core-client';
|
|
3
|
+
import { Plugin } from './plugin';
|
|
4
|
+
import { AmplitudeReturn } from '../utils/return-wrapper';
|
|
5
|
+
import { BrowserConfig, BrowserOptions } from './browser-config';
|
|
6
|
+
interface Client extends CoreClient {
|
|
7
|
+
/**
|
|
8
|
+
* Returns current user ID.
|
|
9
|
+
*
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const userId = getUserId();
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
getUserId(): string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Sets a new user ID.
|
|
17
|
+
*
|
|
18
|
+
* ```typescript
|
|
19
|
+
* setUserId('userId');
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
setUserId(userId: string | undefined): void;
|
|
23
|
+
/**
|
|
24
|
+
* Returns current device ID.
|
|
25
|
+
*
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const deviceId = getDeviceId();
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
getDeviceId(): string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Sets a new device ID.
|
|
33
|
+
* When setting a custom device ID, make sure the value is sufficiently unique.
|
|
34
|
+
* A uuid is recommended.
|
|
35
|
+
*
|
|
36
|
+
* ```typescript
|
|
37
|
+
* setDeviceId('deviceId');
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
setDeviceId(deviceId: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Returns current session ID.
|
|
43
|
+
*
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const sessionId = getSessionId();
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
getSessionId(): number | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Sets a new session ID.
|
|
51
|
+
* When setting a custom session ID, make sure the value is in milliseconds since epoch (Unix Timestamp).
|
|
52
|
+
*
|
|
53
|
+
* ```typescript
|
|
54
|
+
* setSessionId(Date.now());
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
setSessionId(sessionId: number): void;
|
|
58
|
+
/**
|
|
59
|
+
* Extends the current session (advanced)
|
|
60
|
+
*
|
|
61
|
+
* Normally sessions are extended automatically by track()'ing events. If you want to extend the session without
|
|
62
|
+
* tracking and event, this will set the last user interaction to the current time.
|
|
63
|
+
*
|
|
64
|
+
* ```typescript
|
|
65
|
+
* extendSession();
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
extendSession(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Anonymizes users after they log out, by:
|
|
71
|
+
*
|
|
72
|
+
* * setting userId to undefined
|
|
73
|
+
* * setting deviceId to a new uuid value
|
|
74
|
+
*
|
|
75
|
+
* With an undefined userId and a completely new deviceId, the current user would appear as a brand new user in dashboard.
|
|
76
|
+
*
|
|
77
|
+
* ```typescript
|
|
78
|
+
* import { reset } from '@amplitude/analytics-browser';
|
|
79
|
+
*
|
|
80
|
+
* reset();
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
reset(): void;
|
|
84
|
+
}
|
|
85
|
+
export interface BrowserClient extends Client {
|
|
86
|
+
/**
|
|
87
|
+
* Initializes the Amplitude SDK with your apiKey, optional configurations.
|
|
88
|
+
* This method must be called before any other operations.
|
|
89
|
+
*
|
|
90
|
+
* ```typescript
|
|
91
|
+
* await init(API_KEY, options).promise;
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
init(apiKey: string, options?: BrowserOptions): AmplitudeReturn<void>;
|
|
95
|
+
init(apiKey: string, userId?: string, options?: BrowserOptions): AmplitudeReturn<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Sets the network transport type for events.
|
|
98
|
+
*
|
|
99
|
+
* ```typescript
|
|
100
|
+
* // Use Fetch API
|
|
101
|
+
* setTransport('fetch');
|
|
102
|
+
*
|
|
103
|
+
* // Use XMLHttpRequest API
|
|
104
|
+
* setTransport('xhr');
|
|
105
|
+
*
|
|
106
|
+
* // Use navigator.sendBeacon API
|
|
107
|
+
* setTransport('beacon');
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
setTransport(transport: TransportType): void;
|
|
111
|
+
/**
|
|
112
|
+
* Adds a new plugin.
|
|
113
|
+
*
|
|
114
|
+
* ```typescript
|
|
115
|
+
* const plugin = {
|
|
116
|
+
* name: 'my-plugin',
|
|
117
|
+
* type: 'enrichment',
|
|
118
|
+
* async setup(config: BrowserConfig, amplitude: BrowserClient) {
|
|
119
|
+
* return;
|
|
120
|
+
* },
|
|
121
|
+
* async execute(event: Event) {
|
|
122
|
+
* return event;
|
|
123
|
+
* },
|
|
124
|
+
* };
|
|
125
|
+
* amplitude.add(plugin);
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
add(plugin: Plugin<BrowserClient, BrowserConfig>): AmplitudeReturn<void>;
|
|
129
|
+
}
|
|
130
|
+
export {};
|
|
131
|
+
//# sourceMappingURL=browser-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-client.d.ts","sourceRoot":"","sources":["../../../src/types/browser-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEjE,UAAU,MAAO,SAAQ,UAAU;IACjC;;;;;;OAMG;IACH,SAAS,IAAI,MAAM,GAAG,SAAS,CAAC;IAEhC;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAE5C;;;;;;OAMG;IACH,WAAW,IAAI,MAAM,GAAG,SAAS,CAAC;IAElC;;;;;;;;OAQG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC;;;;;;OAMG;IACH,YAAY,IAAI,MAAM,GAAG,SAAS,CAAC;IAEnC;;;;;;;OAOG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtC;;;;;;;;;OASG;IACH,aAAa,IAAI,IAAI,CAAC;IAEtB;;;;;;;;;;;;;OAaG;IACH,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,aAAc,SAAQ,MAAM;IAC3C;;;;;;;OAOG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAEtE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAEvF;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;IAE7C;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;CAC1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-client.js","sourceRoot":"","sources":["../../../src/types/browser-client.ts"],"names":[],"mappings":"","sourcesContent":["import { TransportType } from './transport';\nimport { CoreClient } from '../core-client';\nimport { Plugin } from './plugin';\nimport { AmplitudeReturn } from '../utils/return-wrapper';\nimport { BrowserConfig, BrowserOptions } from './browser-config';\n\ninterface Client extends CoreClient {\n /**\n * Returns current user ID.\n *\n * ```typescript\n * const userId = getUserId();\n * ```\n */\n getUserId(): string | undefined;\n\n /**\n * Sets a new user ID.\n *\n * ```typescript\n * setUserId('userId');\n * ```\n */\n setUserId(userId: string | undefined): void;\n\n /**\n * Returns current device ID.\n *\n * ```typescript\n * const deviceId = getDeviceId();\n * ```\n */\n getDeviceId(): string | undefined;\n\n /**\n * Sets a new device ID.\n * When setting a custom device ID, make sure the value is sufficiently unique.\n * A uuid is recommended.\n *\n * ```typescript\n * setDeviceId('deviceId');\n * ```\n */\n setDeviceId(deviceId: string): void;\n\n /**\n * Returns current session ID.\n *\n * ```typescript\n * const sessionId = getSessionId();\n * ```\n */\n getSessionId(): number | undefined;\n\n /**\n * Sets a new session ID.\n * When setting a custom session ID, make sure the value is in milliseconds since epoch (Unix Timestamp).\n *\n * ```typescript\n * setSessionId(Date.now());\n * ```\n */\n setSessionId(sessionId: number): void;\n\n /**\n * Extends the current session (advanced)\n *\n * Normally sessions are extended automatically by track()'ing events. If you want to extend the session without\n * tracking and event, this will set the last user interaction to the current time.\n *\n * ```typescript\n * extendSession();\n * ```\n */\n extendSession(): void;\n\n /**\n * Anonymizes users after they log out, by:\n *\n * * setting userId to undefined\n * * setting deviceId to a new uuid value\n *\n * With an undefined userId and a completely new deviceId, the current user would appear as a brand new user in dashboard.\n *\n * ```typescript\n * import { reset } from '@amplitude/analytics-browser';\n *\n * reset();\n * ```\n */\n reset(): void;\n}\n\nexport interface BrowserClient extends Client {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, options?: BrowserOptions): AmplitudeReturn<void>;\n\n init(apiKey: string, userId?: string, options?: BrowserOptions): AmplitudeReturn<void>;\n\n /**\n * Sets the network transport type for events.\n *\n * ```typescript\n * // Use Fetch API\n * setTransport('fetch');\n *\n * // Use XMLHttpRequest API\n * setTransport('xhr');\n *\n * // Use navigator.sendBeacon API\n * setTransport('beacon');\n * ```\n */\n setTransport(transport: TransportType): void;\n\n /**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {\n * name: 'my-plugin',\n * type: 'enrichment',\n * async setup(config: BrowserConfig, amplitude: BrowserClient) {\n * return;\n * },\n * async execute(event: Event) {\n * return event;\n * },\n * };\n * amplitude.add(plugin);\n * ```\n */\n add(plugin: Plugin<BrowserClient, BrowserConfig>): AmplitudeReturn<void>;\n}\n"]}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { UserSession } from './user-session';
|
|
2
|
+
import { IdentityStorageType, Storage } from './storage';
|
|
3
|
+
import { Transport } from './transport';
|
|
4
|
+
import { IConfig } from '../config';
|
|
5
|
+
import { ElementInteractionsOptions } from './element-interactions';
|
|
6
|
+
import { PageTrackingOptions } from './page-view-tracking';
|
|
7
|
+
export interface BrowserConfig extends ExternalBrowserConfig, InternalBrowserConfig {
|
|
8
|
+
}
|
|
9
|
+
export interface ExternalBrowserConfig extends IConfig {
|
|
10
|
+
/**
|
|
11
|
+
* An app version for events tracked. This can be the version of your application.
|
|
12
|
+
* @defaultValue `undefined`
|
|
13
|
+
*/
|
|
14
|
+
appVersion?: string;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated This property is deprecated and will be removed in future versions. Please migrate to using `autocapture` instead.
|
|
17
|
+
* The default event tracking configuration.
|
|
18
|
+
* See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events}.
|
|
19
|
+
* @defaultValue `true`
|
|
20
|
+
*/
|
|
21
|
+
defaultTracking?: boolean | DefaultTrackingOptions;
|
|
22
|
+
/**
|
|
23
|
+
* The configurations for auto-captured events.
|
|
24
|
+
* See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/autocapture/}.
|
|
25
|
+
*/
|
|
26
|
+
autocapture?: boolean | AutocaptureOptions;
|
|
27
|
+
/**
|
|
28
|
+
* The identifier for the device running your application.
|
|
29
|
+
* @defaultValue `UUID()`
|
|
30
|
+
*/
|
|
31
|
+
deviceId?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Configuration for cookie.
|
|
34
|
+
*/
|
|
35
|
+
cookieOptions?: CookieOptions;
|
|
36
|
+
/**
|
|
37
|
+
* The storage for user identify.
|
|
38
|
+
* @defaultValue `"cookie"`
|
|
39
|
+
*/
|
|
40
|
+
identityStorage?: IdentityStorageType;
|
|
41
|
+
/**
|
|
42
|
+
* The partner identifier.
|
|
43
|
+
* Amplitude requires the customer who built an event ingestion integration to add the partner identifier to partner_id.
|
|
44
|
+
* @defaultValue `undefined`
|
|
45
|
+
*/
|
|
46
|
+
partnerId?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The custom Session ID for the current session.
|
|
49
|
+
* @defaultValue `timestamp`
|
|
50
|
+
*/
|
|
51
|
+
sessionId?: number;
|
|
52
|
+
/**
|
|
53
|
+
* The period of inactivity from the last tracked event before a session expires in milliseconds.
|
|
54
|
+
* @defaultValue `1,800,000` (30 minutes)
|
|
55
|
+
*/
|
|
56
|
+
sessionTimeout: number;
|
|
57
|
+
/**
|
|
58
|
+
* The configurations for tracking additional properties.
|
|
59
|
+
* See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/#optional-tracking}.
|
|
60
|
+
*/
|
|
61
|
+
trackingOptions: TrackingOptions;
|
|
62
|
+
/**
|
|
63
|
+
* Network transport mechanism used to send events.
|
|
64
|
+
* @defaultValue `"fetch"`
|
|
65
|
+
*/
|
|
66
|
+
transport?: 'fetch' | 'xhr' | 'beacon';
|
|
67
|
+
/**
|
|
68
|
+
* The identifier for the user being tracked.
|
|
69
|
+
* @defaultValue `undefined`
|
|
70
|
+
*/
|
|
71
|
+
userId?: string;
|
|
72
|
+
/**
|
|
73
|
+
* User's Nth instance of performing a default Page Viewed event within a session.
|
|
74
|
+
* Used for landing page analysis.
|
|
75
|
+
*/
|
|
76
|
+
pageCounter?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Whether to fetch remote configuration.
|
|
79
|
+
* @defaultValue `false`
|
|
80
|
+
*/
|
|
81
|
+
fetchRemoteConfig?: boolean;
|
|
82
|
+
}
|
|
83
|
+
interface InternalBrowserConfig {
|
|
84
|
+
cookieStorage: Storage<UserSession>;
|
|
85
|
+
lastEventTime?: number;
|
|
86
|
+
lastEventId?: number;
|
|
87
|
+
transportProvider: Transport;
|
|
88
|
+
version?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated This interface is deprecated and will be removed in future versions. Please migrate to using `AutocaptureOptions` instead.
|
|
92
|
+
*/
|
|
93
|
+
export interface DefaultTrackingOptions {
|
|
94
|
+
/**
|
|
95
|
+
* Enables/disables marketing attribution tracking or config with detailed attribution options.
|
|
96
|
+
* @defaultValue `true`
|
|
97
|
+
*/
|
|
98
|
+
attribution?: boolean | AttributionOptions;
|
|
99
|
+
/**
|
|
100
|
+
* Enables/disables form downloads tracking.
|
|
101
|
+
* @defaultValue `true`
|
|
102
|
+
*/
|
|
103
|
+
fileDownloads?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Enables/disables form interaction tracking.
|
|
106
|
+
* @defaultValue `true`
|
|
107
|
+
*/
|
|
108
|
+
formInteractions?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Enables/disables default page view tracking.
|
|
111
|
+
* @defaultValue `true`
|
|
112
|
+
*/
|
|
113
|
+
pageViews?: boolean | PageTrackingOptions;
|
|
114
|
+
/**
|
|
115
|
+
* Enables/disables session tracking.
|
|
116
|
+
* @defaultValue `true`
|
|
117
|
+
*/
|
|
118
|
+
sessions?: boolean;
|
|
119
|
+
}
|
|
120
|
+
export interface AutocaptureOptions {
|
|
121
|
+
/**
|
|
122
|
+
* Enables/disables marketing attribution tracking or config with detailed attribution options.
|
|
123
|
+
* @defaultValue `true`
|
|
124
|
+
*/
|
|
125
|
+
attribution?: boolean | AttributionOptions;
|
|
126
|
+
/**
|
|
127
|
+
* Enables/disables form downloads tracking.
|
|
128
|
+
* @defaultValue `true`
|
|
129
|
+
*/
|
|
130
|
+
fileDownloads?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Enables/disables form interaction tracking.
|
|
133
|
+
* @defaultValue `true`
|
|
134
|
+
*/
|
|
135
|
+
formInteractions?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Enables/disables default page view tracking.
|
|
138
|
+
* @defaultValue `true`
|
|
139
|
+
*/
|
|
140
|
+
pageViews?: boolean | PageTrackingOptions;
|
|
141
|
+
/**
|
|
142
|
+
* Enables/disables session tracking.
|
|
143
|
+
* @defaultValue `true`
|
|
144
|
+
*/
|
|
145
|
+
sessions?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Enables/disables user interactions tracking.
|
|
148
|
+
* @defaultValue `false`
|
|
149
|
+
*/
|
|
150
|
+
elementInteractions?: boolean | ElementInteractionsOptions;
|
|
151
|
+
}
|
|
152
|
+
export interface TrackingOptions {
|
|
153
|
+
/**
|
|
154
|
+
* Enables/disables ip address tracking.
|
|
155
|
+
* @defaultValue `true`
|
|
156
|
+
*/
|
|
157
|
+
ipAddress?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Enables/disables language tracking.
|
|
160
|
+
* @defaultValue `true`
|
|
161
|
+
*/
|
|
162
|
+
language?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Enables/disables plantform tracking.
|
|
165
|
+
* @defaultValue `true`
|
|
166
|
+
*/
|
|
167
|
+
platform?: boolean;
|
|
168
|
+
}
|
|
169
|
+
export interface AttributionOptions {
|
|
170
|
+
/**
|
|
171
|
+
* The rules to determine which referrers are excluded from being tracked as traffic source.
|
|
172
|
+
* @defaultValue `[/your-domain\.com$/]`
|
|
173
|
+
*/
|
|
174
|
+
excludeReferrers?: (string | RegExp)[];
|
|
175
|
+
/**
|
|
176
|
+
* The value to represent undefined/no initial campaign parameter for first-touch attribution.
|
|
177
|
+
* @defaultValue `"EMPTY"`
|
|
178
|
+
*/
|
|
179
|
+
initialEmptyValue?: string;
|
|
180
|
+
/**
|
|
181
|
+
* The flag of if Amplitude to start a new session if any campaign parameter changes.
|
|
182
|
+
* @defaultValue `false`
|
|
183
|
+
*/
|
|
184
|
+
resetSessionOnNewCampaign?: boolean;
|
|
185
|
+
}
|
|
186
|
+
export interface CookieOptions {
|
|
187
|
+
/**
|
|
188
|
+
* The domain property of cookies created.
|
|
189
|
+
* @defaultValue `Your top level domain`
|
|
190
|
+
*/
|
|
191
|
+
domain?: string;
|
|
192
|
+
/**
|
|
193
|
+
* The expiration of cookies created in days.
|
|
194
|
+
* @defaultValue `365`
|
|
195
|
+
*/
|
|
196
|
+
expiration?: number;
|
|
197
|
+
/**
|
|
198
|
+
* How cookies are sent with cross-site requests.
|
|
199
|
+
* @defaultValue `"Lax"`
|
|
200
|
+
*/
|
|
201
|
+
sameSite?: 'Strict' | 'Lax' | 'None';
|
|
202
|
+
/**
|
|
203
|
+
* The flag of if send cookies over secure protocols.
|
|
204
|
+
* @defaultValue `false`
|
|
205
|
+
*/
|
|
206
|
+
secure?: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* The flag of if upgrade the cookies created by maintenance Browser SDK.
|
|
209
|
+
* @defaultValue `true`
|
|
210
|
+
*/
|
|
211
|
+
upgrade?: boolean;
|
|
212
|
+
}
|
|
213
|
+
type HiddenOptions = 'apiKey' | 'transportProvider' | 'requestMetadata';
|
|
214
|
+
export interface BrowserOptions extends Omit<Partial<ExternalBrowserConfig>, HiddenOptions> {
|
|
215
|
+
}
|
|
216
|
+
export {};
|
|
217
|
+
//# sourceMappingURL=browser-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-config.d.ts","sourceRoot":"","sources":["../../../src/types/browser-config.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-config.js","sourceRoot":"","sources":["../../../src/types/browser-config.ts"],"names":[],"mappings":"","sourcesContent":["import { UserSession } from './user-session';\nimport { IdentityStorageType, Storage } from './storage';\nimport { Transport } from './transport';\nimport { IConfig } from '../config';\nimport { ElementInteractionsOptions } from './element-interactions';\nimport { PageTrackingOptions } from './page-view-tracking';\n\nexport interface BrowserConfig extends ExternalBrowserConfig, InternalBrowserConfig {}\n\nexport interface ExternalBrowserConfig extends IConfig {\n /**\n * An app version for events tracked. This can be the version of your application.\n * @defaultValue `undefined`\n */\n appVersion?: string;\n /**\n * @deprecated This property is deprecated and will be removed in future versions. Please migrate to using `autocapture` instead.\n * The default event tracking configuration.\n * See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events}.\n * @defaultValue `true`\n */\n defaultTracking?: boolean | DefaultTrackingOptions;\n /**\n * The configurations for auto-captured events.\n * See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/autocapture/}.\n */\n autocapture?: boolean | AutocaptureOptions;\n /**\n * The identifier for the device running your application.\n * @defaultValue `UUID()`\n */\n deviceId?: string;\n /**\n * Configuration for cookie.\n */\n cookieOptions?: CookieOptions;\n /**\n * The storage for user identify.\n * @defaultValue `\"cookie\"`\n */\n identityStorage?: IdentityStorageType;\n /**\n * The partner identifier.\n * Amplitude requires the customer who built an event ingestion integration to add the partner identifier to partner_id.\n * @defaultValue `undefined`\n */\n partnerId?: string;\n /**\n * The custom Session ID for the current session.\n * @defaultValue `timestamp`\n */\n sessionId?: number;\n /**\n * The period of inactivity from the last tracked event before a session expires in milliseconds.\n * @defaultValue `1,800,000` (30 minutes)\n */\n sessionTimeout: number;\n /**\n * The configurations for tracking additional properties.\n * See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/#optional-tracking}.\n */\n trackingOptions: TrackingOptions;\n /**\n * Network transport mechanism used to send events.\n * @defaultValue `\"fetch\"`\n */\n transport?: 'fetch' | 'xhr' | 'beacon';\n /**\n * The identifier for the user being tracked.\n * @defaultValue `undefined`\n */\n userId?: string;\n /**\n * User's Nth instance of performing a default Page Viewed event within a session.\n * Used for landing page analysis.\n */\n pageCounter?: number;\n /**\n * Whether to fetch remote configuration.\n * @defaultValue `false`\n */\n fetchRemoteConfig?: boolean;\n}\n\ninterface InternalBrowserConfig {\n cookieStorage: Storage<UserSession>;\n lastEventTime?: number;\n lastEventId?: number;\n transportProvider: Transport;\n version?: string;\n}\n\n/**\n * @deprecated This interface is deprecated and will be removed in future versions. Please migrate to using `AutocaptureOptions` instead.\n */\nexport interface DefaultTrackingOptions {\n /**\n * Enables/disables marketing attribution tracking or config with detailed attribution options.\n * @defaultValue `true`\n */\n attribution?: boolean | AttributionOptions;\n /**\n * Enables/disables form downloads tracking.\n * @defaultValue `true`\n */\n fileDownloads?: boolean;\n /**\n * Enables/disables form interaction tracking.\n * @defaultValue `true`\n */\n formInteractions?: boolean;\n /**\n * Enables/disables default page view tracking.\n * @defaultValue `true`\n */\n pageViews?: boolean | PageTrackingOptions;\n /**\n * Enables/disables session tracking.\n * @defaultValue `true`\n */\n sessions?: boolean;\n}\n\nexport interface AutocaptureOptions {\n /**\n * Enables/disables marketing attribution tracking or config with detailed attribution options.\n * @defaultValue `true`\n */\n attribution?: boolean | AttributionOptions;\n /**\n * Enables/disables form downloads tracking.\n * @defaultValue `true`\n */\n fileDownloads?: boolean;\n /**\n * Enables/disables form interaction tracking.\n * @defaultValue `true`\n */\n formInteractions?: boolean;\n /**\n * Enables/disables default page view tracking.\n * @defaultValue `true`\n */\n pageViews?: boolean | PageTrackingOptions;\n /**\n * Enables/disables session tracking.\n * @defaultValue `true`\n */\n sessions?: boolean;\n /**\n * Enables/disables user interactions tracking.\n * @defaultValue `false`\n */\n elementInteractions?: boolean | ElementInteractionsOptions;\n}\n\nexport interface TrackingOptions {\n /**\n * Enables/disables ip address tracking.\n * @defaultValue `true`\n */\n ipAddress?: boolean;\n /**\n * Enables/disables language tracking.\n * @defaultValue `true`\n */\n language?: boolean;\n /**\n * Enables/disables plantform tracking.\n * @defaultValue `true`\n */\n platform?: boolean;\n}\n\nexport interface AttributionOptions {\n /**\n * The rules to determine which referrers are excluded from being tracked as traffic source.\n * @defaultValue `[/your-domain\\.com$/]`\n */\n excludeReferrers?: (string | RegExp)[];\n /**\n * The value to represent undefined/no initial campaign parameter for first-touch attribution.\n * @defaultValue `\"EMPTY\"`\n */\n initialEmptyValue?: string;\n /**\n * The flag of if Amplitude to start a new session if any campaign parameter changes.\n * @defaultValue `false`\n */\n resetSessionOnNewCampaign?: boolean;\n}\n\nexport interface CookieOptions {\n /**\n * The domain property of cookies created.\n * @defaultValue `Your top level domain`\n */\n domain?: string;\n /**\n * The expiration of cookies created in days.\n * @defaultValue `365`\n */\n expiration?: number;\n /**\n * How cookies are sent with cross-site requests.\n * @defaultValue `\"Lax\"`\n */\n sameSite?: 'Strict' | 'Lax' | 'None';\n /**\n * The flag of if send cookies over secure protocols.\n * @defaultValue `false`\n */\n secure?: boolean;\n /**\n * The flag of if upgrade the cookies created by maintenance Browser SDK.\n * @defaultValue `true`\n */\n upgrade?: boolean;\n}\n\ntype HiddenOptions = 'apiKey' | 'transportProvider' | 'requestMetadata';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface BrowserOptions extends Omit<Partial<ExternalBrowserConfig>, HiddenOptions> {}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/types/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,MAAM,CAAC;AAC/B,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AACtC,eAAO,MAAM,cAAc,QAA+B,CAAC;AAC3D,eAAO,MAAM,oBAAoB,yCAAyC,CAAC;AAC3E,eAAO,MAAM,uBAAuB,2CAA2C,CAAC;AAChF,eAAO,MAAM,0BAA0B,qCAAqC,CAAC;AAC7E,eAAO,MAAM,6BAA6B,uCAAuC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/types/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,GAAG,CAAC;AAClB,QAAA,gBAAgB,GAAG,KAAK,CAAC;AACzB,QAAA,cAAc,GAAG,UAAG,wBAAgB,YAAS,CAAC;AAC9C,QAAA,oBAAoB,GAAG,sCAAsC,CAAC;AAC9D,QAAA,uBAAuB,GAAG,wCAAwC,CAAC;AACnE,QAAA,0BAA0B,GAAG,kCAAkC,CAAC;AAChE,QAAA,6BAA6B,GAAG,oCAAoC,CAAC","sourcesContent":["export const UNSET_VALUE = '-';\nexport const AMPLITUDE_PREFIX = 'AMP';\nexport const STORAGE_PREFIX = `${AMPLITUDE_PREFIX}_unsent`;\nexport const AMPLITUDE_SERVER_URL = 'https://api2.amplitude.com/2/httpapi';\nexport const EU_AMPLITUDE_SERVER_URL = 'https://api.eu.amplitude.com/2/httpapi';\nexport const AMPLITUDE_BATCH_SERVER_URL = 'https://api2.amplitude.com/batch';\nexport const EU_AMPLITUDE_BATCH_SERVER_URL = 'https://api.eu.amplitude.com/batch';\n"]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ILogger } from '../logger';
|
|
2
|
+
export type ActionType = 'click' | 'change';
|
|
3
|
+
/**
|
|
4
|
+
* Default CSS selectors to define which elements on the page to track.
|
|
5
|
+
* Extend this list to include additional elements to track. For example:
|
|
6
|
+
* ```
|
|
7
|
+
* autocapturePlugin({
|
|
8
|
+
* cssSelectorAllowlist: [...DEFAULT_CSS_SELECTOR_ALLOWLIST, ".my-class"],
|
|
9
|
+
* })
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare const DEFAULT_CSS_SELECTOR_ALLOWLIST: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Default prefix to allow the plugin to capture data attributes as an event property.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DEFAULT_DATA_ATTRIBUTE_PREFIX = "data-amp-track-";
|
|
17
|
+
/**
|
|
18
|
+
* Default list of elements on the page should be tracked when the page changes.
|
|
19
|
+
*/
|
|
20
|
+
export declare const DEFAULT_ACTION_CLICK_ALLOWLIST: string[];
|
|
21
|
+
export interface ElementInteractionsOptions {
|
|
22
|
+
/**
|
|
23
|
+
* List of CSS selectors to allow auto tracking on.
|
|
24
|
+
* When provided, allow elements matching any selector to be tracked.
|
|
25
|
+
* Default is ['a', 'button', 'input', 'select', 'textarea', 'label', '[data-amp-default-track]', '.amp-default-track'].
|
|
26
|
+
*/
|
|
27
|
+
cssSelectorAllowlist?: string[];
|
|
28
|
+
/**
|
|
29
|
+
* List of page URLs to allow auto tracking on.
|
|
30
|
+
* When provided, only allow tracking on these URLs.
|
|
31
|
+
* Both full URLs and regex are supported.
|
|
32
|
+
*/
|
|
33
|
+
pageUrlAllowlist?: (string | RegExp)[];
|
|
34
|
+
/**
|
|
35
|
+
* Function to determine whether an event should be tracked.
|
|
36
|
+
* When provided, this function overwrites all other allowlists and configurations.
|
|
37
|
+
* If the function returns true, the event will be tracked.
|
|
38
|
+
* If the function returns false, the event will not be tracked.
|
|
39
|
+
* @param actionType - The type of action that triggered the event.
|
|
40
|
+
* @param element - The [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) that triggered the event.
|
|
41
|
+
*/
|
|
42
|
+
shouldTrackEventResolver?: (actionType: ActionType, element: DomElement) => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Prefix for data attributes to allow auto collecting.
|
|
45
|
+
* Default is 'data-amp-track-'.
|
|
46
|
+
*/
|
|
47
|
+
dataAttributePrefix?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Options for integrating visual tagging selector.
|
|
50
|
+
*/
|
|
51
|
+
visualTaggingOptions?: {
|
|
52
|
+
enabled?: boolean;
|
|
53
|
+
messenger?: Messenger;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Debounce time in milliseconds for tracking events.
|
|
57
|
+
* This is used to detect rage clicks.
|
|
58
|
+
*/
|
|
59
|
+
debounceTime?: number;
|
|
60
|
+
/**
|
|
61
|
+
* CSS selector allowlist for tracking clicks that result in a DOM change/navigation on elements not already allowed by the cssSelectorAllowlist
|
|
62
|
+
*/
|
|
63
|
+
actionClickAllowlist?: string[];
|
|
64
|
+
}
|
|
65
|
+
export interface Messenger {
|
|
66
|
+
logger?: ILogger;
|
|
67
|
+
setup: () => void;
|
|
68
|
+
}
|
|
69
|
+
type DomElement = typeof globalThis extends {
|
|
70
|
+
Element: new (...args: any) => infer T;
|
|
71
|
+
} ? T : never;
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=element-interactions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-interactions.d.ts","sourceRoot":"","sources":["../../../src/types/element-interactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE5C;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,UAY1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B,oBAAoB,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,8BAA8B,UAAsD,CAAC;AAElG,MAAM,WAAW,0BAA0B;IACzC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAEvC;;;;;;;OAOG;IACH,wBAAwB,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC;IAEpF;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,oBAAoB,CAAC,EAAE;QACrB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,SAAS,CAAC;KACvB,CAAC;IAEF;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAKD,KAAK,UAAU,GAAG,OAAO,UAAU,SAAS;IAC1C,OAAO,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,CAAC,CAAC;CACxC,GACG,CAAC,GACD,KAAK,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_ACTION_CLICK_ALLOWLIST = exports.DEFAULT_DATA_ATTRIBUTE_PREFIX = exports.DEFAULT_CSS_SELECTOR_ALLOWLIST = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Default CSS selectors to define which elements on the page to track.
|
|
6
|
+
* Extend this list to include additional elements to track. For example:
|
|
7
|
+
* ```
|
|
8
|
+
* autocapturePlugin({
|
|
9
|
+
* cssSelectorAllowlist: [...DEFAULT_CSS_SELECTOR_ALLOWLIST, ".my-class"],
|
|
10
|
+
* })
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
exports.DEFAULT_CSS_SELECTOR_ALLOWLIST = [
|
|
14
|
+
'a',
|
|
15
|
+
'button',
|
|
16
|
+
'input',
|
|
17
|
+
'select',
|
|
18
|
+
'textarea',
|
|
19
|
+
'label',
|
|
20
|
+
'video',
|
|
21
|
+
'audio',
|
|
22
|
+
'[contenteditable="true" i]',
|
|
23
|
+
'[data-amp-default-track]',
|
|
24
|
+
'.amp-default-track',
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* Default prefix to allow the plugin to capture data attributes as an event property.
|
|
28
|
+
*/
|
|
29
|
+
exports.DEFAULT_DATA_ATTRIBUTE_PREFIX = 'data-amp-track-';
|
|
30
|
+
/**
|
|
31
|
+
* Default list of elements on the page should be tracked when the page changes.
|
|
32
|
+
*/
|
|
33
|
+
exports.DEFAULT_ACTION_CLICK_ALLOWLIST = ['div', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
34
|
+
//# sourceMappingURL=element-interactions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-interactions.js","sourceRoot":"","sources":["../../../src/types/element-interactions.ts"],"names":[],"mappings":";;;AAIA;;;;;;;;GAQG;AACU,QAAA,8BAA8B,GAAG;IAC5C,GAAG;IACH,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,UAAU;IACV,OAAO;IACP,OAAO;IACP,OAAO;IACP,4BAA4B;IAC5B,0BAA0B;IAC1B,oBAAoB;CACrB,CAAC;AAEF;;GAEG;AACU,QAAA,6BAA6B,GAAG,iBAAiB,CAAC;AAE/D;;GAEG;AACU,QAAA,8BAA8B,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC","sourcesContent":["import { ILogger } from '../logger';\n\nexport type ActionType = 'click' | 'change';\n\n/**\n * Default CSS selectors to define which elements on the page to track.\n * Extend this list to include additional elements to track. For example:\n * ```\n * autocapturePlugin({\n * cssSelectorAllowlist: [...DEFAULT_CSS_SELECTOR_ALLOWLIST, \".my-class\"],\n * })\n * ```\n */\nexport const DEFAULT_CSS_SELECTOR_ALLOWLIST = [\n 'a',\n 'button',\n 'input',\n 'select',\n 'textarea',\n 'label',\n 'video',\n 'audio',\n '[contenteditable=\"true\" i]',\n '[data-amp-default-track]',\n '.amp-default-track',\n];\n\n/**\n * Default prefix to allow the plugin to capture data attributes as an event property.\n */\nexport const DEFAULT_DATA_ATTRIBUTE_PREFIX = 'data-amp-track-';\n\n/**\n * Default list of elements on the page should be tracked when the page changes.\n */\nexport const DEFAULT_ACTION_CLICK_ALLOWLIST = ['div', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];\n\nexport interface ElementInteractionsOptions {\n /**\n * List of CSS selectors to allow auto tracking on.\n * When provided, allow elements matching any selector to be tracked.\n * Default is ['a', 'button', 'input', 'select', 'textarea', 'label', '[data-amp-default-track]', '.amp-default-track'].\n */\n cssSelectorAllowlist?: string[];\n\n /**\n * List of page URLs to allow auto tracking on.\n * When provided, only allow tracking on these URLs.\n * Both full URLs and regex are supported.\n */\n pageUrlAllowlist?: (string | RegExp)[];\n\n /**\n * Function to determine whether an event should be tracked.\n * When provided, this function overwrites all other allowlists and configurations.\n * If the function returns true, the event will be tracked.\n * If the function returns false, the event will not be tracked.\n * @param actionType - The type of action that triggered the event.\n * @param element - The [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) that triggered the event.\n */\n shouldTrackEventResolver?: (actionType: ActionType, element: DomElement) => boolean;\n\n /**\n * Prefix for data attributes to allow auto collecting.\n * Default is 'data-amp-track-'.\n */\n dataAttributePrefix?: string;\n\n /**\n * Options for integrating visual tagging selector.\n */\n visualTaggingOptions?: {\n enabled?: boolean;\n messenger?: Messenger;\n };\n\n /**\n * Debounce time in milliseconds for tracking events.\n * This is used to detect rage clicks.\n */\n debounceTime?: number;\n\n /**\n * CSS selector allowlist for tracking clicks that result in a DOM change/navigation on elements not already allowed by the cssSelectorAllowlist\n */\n actionClickAllowlist?: string[];\n}\n\nexport interface Messenger {\n logger?: ILogger;\n setup: () => void;\n}\n\n// DomElement is [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) if the dom library is included in tsconfig.json\n// and never if it is not included\n// eslint-disable-next-line no-restricted-globals\ntype DomElement = typeof globalThis extends {\n Element: new (...args: any) => infer T;\n}\n ? T\n : never;\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Plan } from './plan';
|
|
2
|
+
import { IngestionMetadataEventProperty } from './ingestion-metadata';
|
|
3
|
+
export interface BaseEvent extends EventOptions {
|
|
4
|
+
event_type: string;
|
|
5
|
+
event_properties?: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
} | undefined;
|
|
8
|
+
user_properties?: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
} | undefined;
|
|
11
|
+
group_properties?: {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
} | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface EventOptions {
|
|
16
|
+
user_id?: string;
|
|
17
|
+
device_id?: string;
|
|
18
|
+
time?: number;
|
|
19
|
+
location_lat?: number;
|
|
20
|
+
location_lng?: number;
|
|
21
|
+
app_version?: string;
|
|
22
|
+
version_name?: string;
|
|
23
|
+
library?: string;
|
|
24
|
+
platform?: string;
|
|
25
|
+
os_name?: string;
|
|
26
|
+
os_version?: string;
|
|
27
|
+
device_brand?: string;
|
|
28
|
+
device_manufacturer?: string;
|
|
29
|
+
device_model?: string;
|
|
30
|
+
carrier?: string;
|
|
31
|
+
country?: string;
|
|
32
|
+
region?: string;
|
|
33
|
+
city?: string;
|
|
34
|
+
dma?: string;
|
|
35
|
+
idfa?: string;
|
|
36
|
+
idfv?: string;
|
|
37
|
+
adid?: string;
|
|
38
|
+
android_id?: string;
|
|
39
|
+
language?: string;
|
|
40
|
+
ip?: string;
|
|
41
|
+
price?: number;
|
|
42
|
+
quantity?: number;
|
|
43
|
+
revenue?: number;
|
|
44
|
+
receipt?: string;
|
|
45
|
+
receiptSig?: string;
|
|
46
|
+
productId?: string;
|
|
47
|
+
revenueType?: string;
|
|
48
|
+
currency?: string;
|
|
49
|
+
event_id?: number;
|
|
50
|
+
session_id?: number;
|
|
51
|
+
insert_id?: string;
|
|
52
|
+
plan?: Plan;
|
|
53
|
+
ingestion_metadata?: IngestionMetadataEventProperty;
|
|
54
|
+
partner_id?: string;
|
|
55
|
+
user_agent?: string;
|
|
56
|
+
android_app_set_id?: string;
|
|
57
|
+
extra?: {
|
|
58
|
+
[key: string]: any;
|
|
59
|
+
};
|
|
60
|
+
groups?: {
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
} | undefined;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=base-event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-event.d.ts","sourceRoot":"","sources":["../../../../src/types/event/base-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAEtE,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,SAAS,CAAC;IACtD,eAAe,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,SAAS,CAAC;IACrD,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,SAAS,CAAC;CACvD;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,kBAAkB,CAAC,EAAE,8BAA8B,CAAC;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IAC/B,MAAM,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,SAAS,CAAC;CAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-event.js","sourceRoot":"","sources":["../../../../src/types/event/base-event.ts"],"names":[],"mappings":"","sourcesContent":["import { Plan } from './plan';\nimport { IngestionMetadataEventProperty } from './ingestion-metadata';\n\nexport interface BaseEvent extends EventOptions {\n event_type: string;\n event_properties?: { [key: string]: any } | undefined;\n user_properties?: { [key: string]: any } | undefined;\n group_properties?: { [key: string]: any } | undefined;\n}\n\nexport interface EventOptions {\n user_id?: string;\n device_id?: string;\n time?: number;\n location_lat?: number;\n location_lng?: number;\n app_version?: string;\n version_name?: string;\n library?: string;\n platform?: string;\n os_name?: string;\n os_version?: string;\n device_brand?: string;\n device_manufacturer?: string;\n device_model?: string;\n carrier?: string;\n country?: string;\n region?: string;\n city?: string;\n dma?: string;\n idfa?: string;\n idfv?: string;\n adid?: string;\n android_id?: string;\n language?: string;\n ip?: string;\n price?: number;\n quantity?: number;\n revenue?: number;\n receipt?: string;\n receiptSig?: string;\n productId?: string;\n revenueType?: string;\n currency?: string;\n event_id?: number;\n session_id?: number;\n insert_id?: string;\n plan?: Plan;\n ingestion_metadata?: IngestionMetadataEventProperty;\n partner_id?: string;\n user_agent?: string;\n android_app_set_id?: string;\n extra?: { [key: string]: any };\n groups?: { [key: string]: any } | undefined;\n}\n"]}
|