@amplitude/analytics-core 2.5.6 → 2.6.0
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 +39 -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 +216 -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 +16 -2
- 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 +216 -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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-bridge.d.ts","sourceRoot":"","sources":["../../../src/event-bridge/event-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"event-bridge.d.ts","sourceRoot":"","sources":["../../../src/event-bridge/event-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC/C,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACpE;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAC9C;AAED,qBAAa,WAAY,YAAW,YAAY;IAC9C,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,SAAS,CAAC,CAAM;IAEzE,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;IAOvC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB;CAM5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-bridge.js","sourceRoot":"","sources":["../../../src/event-bridge/event-bridge.ts"],"names":[],"mappings":";;;AACA,+DAA4D;
|
|
1
|
+
{"version":3,"file":"event-bridge.js","sourceRoot":"","sources":["../../../src/event-bridge/event-bridge.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAW5D;IAAA;QACE,wBAAmB,GAAmD,EAAE,CAAC;IAe3E,CAAC;IAbC,+BAAS,GAAT,UAAU,OAAe,EAAE,KAAY;QACrC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE;YACtC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,GAAG,IAAI,yCAAkB,CAAC,OAAO,CAAC,CAAC;SACrE;QACA,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAwB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC7E,CAAC;IAED,iCAAW,GAAX,UAAY,OAAe,EAAE,QAA8B;QACzD,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE;YACtC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,GAAG,IAAI,yCAAkB,CAAC,OAAO,CAAC,CAAC;SACrE;QACA,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAwB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAClF,CAAC;IACH,kBAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,kCAAW","sourcesContent":["import { Event } from '../types/event/event';\nimport { EventBridgeChannel } from './event-bridge-channel';\n\nexport interface IEventBridge {\n sendEvent(channel: string, event: Event): void;\n setReceiver(channel: string, receiver: IEventBridgeReceiver): void;\n}\n\nexport interface IEventBridgeReceiver {\n receive(channel: string, event: Event): void;\n}\n\nexport class EventBridge implements IEventBridge {\n eventBridgeChannels: Record<string, EventBridgeChannel | undefined> = {};\n\n sendEvent(channel: string, event: Event) {\n if (!this.eventBridgeChannels[channel]) {\n this.eventBridgeChannels[channel] = new EventBridgeChannel(channel);\n }\n (this.eventBridgeChannels[channel] as EventBridgeChannel).sendEvent(event);\n }\n\n setReceiver(channel: string, receiver: IEventBridgeReceiver) {\n if (!this.eventBridgeChannels[channel]) {\n this.eventBridgeChannels[channel] = new EventBridgeChannel(channel);\n }\n (this.eventBridgeChannels[channel] as EventBridgeChannel).setReceiver(receiver);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-scope.d.ts","sourceRoot":"","sources":["../../src/global-scope.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,QAAO,iBAAiB,GAAG,SAoBrD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable no-restricted-globals */
|
|
3
|
+
/* Only file allowed to access to globalThis, window, self */
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.getGlobalScope = void 0;
|
|
6
|
+
var getGlobalScope = function () {
|
|
7
|
+
// This should only be used for integrations with Amplitude that are not running in a browser environment
|
|
8
|
+
// We need to specify the name of the global variable as a string to prevent it from being minified
|
|
9
|
+
var ampIntegrationContextName = 'ampIntegrationContext';
|
|
10
|
+
if (typeof globalThis !== 'undefined' && typeof globalThis[ampIntegrationContextName] !== 'undefined') {
|
|
11
|
+
return globalThis[ampIntegrationContextName];
|
|
12
|
+
}
|
|
13
|
+
if (typeof globalThis !== 'undefined') {
|
|
14
|
+
return globalThis;
|
|
15
|
+
}
|
|
16
|
+
if (typeof window !== 'undefined') {
|
|
17
|
+
return window;
|
|
18
|
+
}
|
|
19
|
+
if (typeof self !== 'undefined') {
|
|
20
|
+
return self;
|
|
21
|
+
}
|
|
22
|
+
if (typeof global !== 'undefined') {
|
|
23
|
+
return global;
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
};
|
|
27
|
+
exports.getGlobalScope = getGlobalScope;
|
|
28
|
+
//# sourceMappingURL=global-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-scope.js","sourceRoot":"","sources":["../../src/global-scope.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,6DAA6D;;;AAEtD,IAAM,cAAc,GAAG;IAC5B,yGAAyG;IACzG,qGAAqG;IACrG,IAAM,yBAAyB,GAAG,uBAAkD,CAAC;IACrF,IAAI,OAAO,UAAU,KAAK,WAAW,IAAI,OAAO,UAAU,CAAC,yBAAyB,CAAC,KAAK,WAAW,EAAE;QACrG,OAAO,UAAU,CAAC,yBAAyB,CAAsB,CAAC;KACnE;IACD,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE;QACrC,OAAO,UAAU,CAAC;KACnB;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAC;KACf;IACD,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAC/B,OAAO,IAAI,CAAC;KACb;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAC;KACf;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AApBW,QAAA,cAAc,kBAoBzB","sourcesContent":["/* eslint-disable no-restricted-globals */\n/* Only file allowed to access to globalThis, window, self */\n\nexport const getGlobalScope = (): typeof globalThis | undefined => {\n // This should only be used for integrations with Amplitude that are not running in a browser environment\n // We need to specify the name of the global variable as a string to prevent it from being minified\n const ampIntegrationContextName = 'ampIntegrationContext' as keyof typeof globalThis;\n if (typeof globalThis !== 'undefined' && typeof globalThis[ampIntegrationContextName] !== 'undefined') {\n return globalThis[ampIntegrationContextName] as typeof globalThis;\n }\n if (typeof globalThis !== 'undefined') {\n return globalThis;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n};\n"]}
|
package/lib/cjs/identify.d.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
export interface IIdentify {
|
|
2
|
+
getUserProperties(): IdentifyUserProperties;
|
|
3
|
+
set(property: string, value: ValidPropertyType): IIdentify;
|
|
4
|
+
setOnce(property: string, value: ValidPropertyType): IIdentify;
|
|
5
|
+
append(property: string, value: ValidPropertyType): IIdentify;
|
|
6
|
+
prepend(property: string, value: ValidPropertyType): IIdentify;
|
|
7
|
+
postInsert(property: string, value: ValidPropertyType): IIdentify;
|
|
8
|
+
preInsert(property: string, value: ValidPropertyType): IIdentify;
|
|
9
|
+
remove(property: string, value: ValidPropertyType): IIdentify;
|
|
10
|
+
add(property: string, value: number): IIdentify;
|
|
11
|
+
unset(property: string): IIdentify;
|
|
12
|
+
clearAll(): IIdentify;
|
|
13
|
+
}
|
|
2
14
|
export declare class Identify implements IIdentify {
|
|
3
15
|
protected readonly _propertySet: Set<string>;
|
|
4
16
|
protected _properties: IdentifyUserProperties;
|
|
@@ -16,4 +28,39 @@ export declare class Identify implements IIdentify {
|
|
|
16
28
|
private _safeSet;
|
|
17
29
|
private _validate;
|
|
18
30
|
}
|
|
31
|
+
export type ValidPropertyType = number | string | boolean | Array<string | number> | {
|
|
32
|
+
[key: string]: ValidPropertyType;
|
|
33
|
+
} | Array<{
|
|
34
|
+
[key: string]: ValidPropertyType;
|
|
35
|
+
}>;
|
|
36
|
+
interface BaseOperationConfig {
|
|
37
|
+
[key: string]: ValidPropertyType;
|
|
38
|
+
}
|
|
39
|
+
export interface IdentifyUserProperties {
|
|
40
|
+
[IdentifyOperation.ADD]?: {
|
|
41
|
+
[key: string]: number;
|
|
42
|
+
};
|
|
43
|
+
[IdentifyOperation.UNSET]?: BaseOperationConfig;
|
|
44
|
+
[IdentifyOperation.CLEAR_ALL]?: any;
|
|
45
|
+
[IdentifyOperation.SET]?: BaseOperationConfig;
|
|
46
|
+
[IdentifyOperation.SET_ONCE]?: BaseOperationConfig;
|
|
47
|
+
[IdentifyOperation.APPEND]?: BaseOperationConfig;
|
|
48
|
+
[IdentifyOperation.PREPEND]?: BaseOperationConfig;
|
|
49
|
+
[IdentifyOperation.POSTINSERT]?: BaseOperationConfig;
|
|
50
|
+
[IdentifyOperation.PREINSERT]?: BaseOperationConfig;
|
|
51
|
+
[IdentifyOperation.REMOVE]?: BaseOperationConfig;
|
|
52
|
+
}
|
|
53
|
+
export declare enum IdentifyOperation {
|
|
54
|
+
SET = "$set",
|
|
55
|
+
SET_ONCE = "$setOnce",
|
|
56
|
+
ADD = "$add",
|
|
57
|
+
APPEND = "$append",
|
|
58
|
+
PREPEND = "$prepend",
|
|
59
|
+
REMOVE = "$remove",
|
|
60
|
+
PREINSERT = "$preInsert",
|
|
61
|
+
POSTINSERT = "$postInsert",
|
|
62
|
+
UNSET = "$unset",
|
|
63
|
+
CLEAR_ALL = "$clearAll"
|
|
64
|
+
}
|
|
65
|
+
export {};
|
|
19
66
|
//# sourceMappingURL=identify.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identify.d.ts","sourceRoot":"","sources":["../../src/identify.ts"],"names":[],"mappings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AC,CAAC,EAAE,mBAAmB,CAAC;IAC9C,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,EAAE,mBAAmB,CAAC;IACnD,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,EAAE,mBAAmB,CAAC;IACjD,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,EAAE,mBAAmB,CAAC;IAClD,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,EAAE,mBAAmB,CAAC;IACrD,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,EAAE,mBAAmB,CAAC;IACpD,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,EAAE,mBAAmB,CAAC;CAClD;AAED,oBAAY,iBAAiB;IAE3B,GAAG,SAAS;IACZ,QAAQ,aAAa;IAGrB,GAAG,SAAS;IACZ,MAAM,YAAY;IAClB,OAAO,aAAa;IACpB,MAAM,YAAY;IAGlB,SAAS,eAAe;IACxB,UAAU,gBAAgB;IAG1B,KAAK,WAAW;IAChB,SAAS,cAAc;CACxB"}
|
package/lib/cjs/identify.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Identify = void 0;
|
|
3
|
+
exports.IdentifyOperation = exports.Identify = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
var
|
|
6
|
-
var constants_1 = require("./constants");
|
|
5
|
+
var constants_1 = require("./types/constants");
|
|
7
6
|
var valid_properties_1 = require("./utils/valid-properties");
|
|
8
7
|
var Identify = /** @class */ (function () {
|
|
9
8
|
function Identify() {
|
|
@@ -14,45 +13,45 @@ var Identify = /** @class */ (function () {
|
|
|
14
13
|
return tslib_1.__assign({}, this._properties);
|
|
15
14
|
};
|
|
16
15
|
Identify.prototype.set = function (property, value) {
|
|
17
|
-
this._safeSet(
|
|
16
|
+
this._safeSet(IdentifyOperation.SET, property, value);
|
|
18
17
|
return this;
|
|
19
18
|
};
|
|
20
19
|
Identify.prototype.setOnce = function (property, value) {
|
|
21
|
-
this._safeSet(
|
|
20
|
+
this._safeSet(IdentifyOperation.SET_ONCE, property, value);
|
|
22
21
|
return this;
|
|
23
22
|
};
|
|
24
23
|
Identify.prototype.append = function (property, value) {
|
|
25
|
-
this._safeSet(
|
|
24
|
+
this._safeSet(IdentifyOperation.APPEND, property, value);
|
|
26
25
|
return this;
|
|
27
26
|
};
|
|
28
27
|
Identify.prototype.prepend = function (property, value) {
|
|
29
|
-
this._safeSet(
|
|
28
|
+
this._safeSet(IdentifyOperation.PREPEND, property, value);
|
|
30
29
|
return this;
|
|
31
30
|
};
|
|
32
31
|
Identify.prototype.postInsert = function (property, value) {
|
|
33
|
-
this._safeSet(
|
|
32
|
+
this._safeSet(IdentifyOperation.POSTINSERT, property, value);
|
|
34
33
|
return this;
|
|
35
34
|
};
|
|
36
35
|
Identify.prototype.preInsert = function (property, value) {
|
|
37
|
-
this._safeSet(
|
|
36
|
+
this._safeSet(IdentifyOperation.PREINSERT, property, value);
|
|
38
37
|
return this;
|
|
39
38
|
};
|
|
40
39
|
Identify.prototype.remove = function (property, value) {
|
|
41
|
-
this._safeSet(
|
|
40
|
+
this._safeSet(IdentifyOperation.REMOVE, property, value);
|
|
42
41
|
return this;
|
|
43
42
|
};
|
|
44
43
|
Identify.prototype.add = function (property, value) {
|
|
45
|
-
this._safeSet(
|
|
44
|
+
this._safeSet(IdentifyOperation.ADD, property, value);
|
|
46
45
|
return this;
|
|
47
46
|
};
|
|
48
47
|
Identify.prototype.unset = function (property) {
|
|
49
|
-
this._safeSet(
|
|
48
|
+
this._safeSet(IdentifyOperation.UNSET, property, constants_1.UNSET_VALUE);
|
|
50
49
|
return this;
|
|
51
50
|
};
|
|
52
51
|
Identify.prototype.clearAll = function () {
|
|
53
52
|
// When clear all happens, all properties are unset. Reset the entire object.
|
|
54
53
|
this._properties = {};
|
|
55
|
-
this._properties[
|
|
54
|
+
this._properties[IdentifyOperation.CLEAR_ALL] = constants_1.UNSET_VALUE;
|
|
56
55
|
return this;
|
|
57
56
|
};
|
|
58
57
|
// Returns whether or not this set actually worked.
|
|
@@ -73,7 +72,7 @@ var Identify = /** @class */ (function () {
|
|
|
73
72
|
return false;
|
|
74
73
|
};
|
|
75
74
|
Identify.prototype._validate = function (operation, property, value) {
|
|
76
|
-
if (this._properties[
|
|
75
|
+
if (this._properties[IdentifyOperation.CLEAR_ALL] !== undefined) {
|
|
77
76
|
// clear all already set. Skipping operation;
|
|
78
77
|
return false;
|
|
79
78
|
}
|
|
@@ -81,10 +80,10 @@ var Identify = /** @class */ (function () {
|
|
|
81
80
|
// Property already used. Skipping operation
|
|
82
81
|
return false;
|
|
83
82
|
}
|
|
84
|
-
if (operation ===
|
|
83
|
+
if (operation === IdentifyOperation.ADD) {
|
|
85
84
|
return typeof value === 'number';
|
|
86
85
|
}
|
|
87
|
-
if (operation !==
|
|
86
|
+
if (operation !== IdentifyOperation.UNSET && operation !== IdentifyOperation.REMOVE) {
|
|
88
87
|
return (0, valid_properties_1.isValidProperties)(property, value);
|
|
89
88
|
}
|
|
90
89
|
return true;
|
|
@@ -92,4 +91,21 @@ var Identify = /** @class */ (function () {
|
|
|
92
91
|
return Identify;
|
|
93
92
|
}());
|
|
94
93
|
exports.Identify = Identify;
|
|
94
|
+
var IdentifyOperation;
|
|
95
|
+
(function (IdentifyOperation) {
|
|
96
|
+
// Base Operations to set values
|
|
97
|
+
IdentifyOperation["SET"] = "$set";
|
|
98
|
+
IdentifyOperation["SET_ONCE"] = "$setOnce";
|
|
99
|
+
// Operations around modifying existing values
|
|
100
|
+
IdentifyOperation["ADD"] = "$add";
|
|
101
|
+
IdentifyOperation["APPEND"] = "$append";
|
|
102
|
+
IdentifyOperation["PREPEND"] = "$prepend";
|
|
103
|
+
IdentifyOperation["REMOVE"] = "$remove";
|
|
104
|
+
// Operations around appending values *if* they aren't present
|
|
105
|
+
IdentifyOperation["PREINSERT"] = "$preInsert";
|
|
106
|
+
IdentifyOperation["POSTINSERT"] = "$postInsert";
|
|
107
|
+
// Operations around removing properties/values
|
|
108
|
+
IdentifyOperation["UNSET"] = "$unset";
|
|
109
|
+
IdentifyOperation["CLEAR_ALL"] = "$clearAll";
|
|
110
|
+
})(IdentifyOperation = exports.IdentifyOperation || (exports.IdentifyOperation = {}));
|
|
95
111
|
//# sourceMappingURL=identify.js.map
|
package/lib/cjs/identify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identify.js","sourceRoot":"","sources":["../../src/identify.ts"],"names":[],"mappings":";;;;AAAA
|
|
1
|
+
{"version":3,"file":"identify.js","sourceRoot":"","sources":["../../src/identify.ts"],"names":[],"mappings":";;;;AAAA,+CAAgD;AAChD,6DAA6D;AAgB7D;IAAA;QACqB,iBAAY,GAAgB,IAAI,GAAG,EAAU,CAAC;QACvD,gBAAW,GAA2B,EAAE,CAAC;IAmGrD,CAAC;IAjGQ,oCAAiB,GAAxB;QACE,4BAAY,IAAI,CAAC,WAAW,EAAG;IACjC,CAAC;IAEM,sBAAG,GAAV,UAAW,QAAgB,EAAE,KAAwB;QACnD,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,0BAAO,GAAd,UAAe,QAAgB,EAAE,KAAwB;QACvD,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,yBAAM,GAAb,UAAc,QAAgB,EAAE,KAAwB;QACtD,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,0BAAO,GAAd,UAAe,QAAgB,EAAE,KAAwB;QACvD,IAAI,CAAC,Q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,8CAA8C;IAC9C,iCAAY,CAAA;IACZ,uCAAkB,CAAA;IAClB,yCAAoB,CAAA;IACpB,uCAAkB,CAAA;IAElB,8DAA8D;IAC9D,6CAAwB,CAAA;IACxB,+CAA0B,CAAA;IAE1B,+CAA+C;IAC/C,qCAAgB,CAAA;IAChB,4CAAuB,CAAA;AACzB,CAAC,EAlBW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAkB5B","sourcesContent":["import { UNSET_VALUE } from './types/constants';\nimport { isValidProperties } from './utils/valid-properties';\n\nexport interface IIdentify {\n getUserProperties(): IdentifyUserProperties;\n set(property: string, value: ValidPropertyType): IIdentify;\n setOnce(property: string, value: ValidPropertyType): IIdentify;\n append(property: string, value: ValidPropertyType): IIdentify;\n prepend(property: string, value: ValidPropertyType): IIdentify;\n postInsert(property: string, value: ValidPropertyType): IIdentify;\n preInsert(property: string, value: ValidPropertyType): IIdentify;\n remove(property: string, value: ValidPropertyType): IIdentify;\n add(property: string, value: number): IIdentify;\n unset(property: string): IIdentify;\n clearAll(): IIdentify;\n}\n\nexport class Identify implements IIdentify {\n protected readonly _propertySet: Set<string> = new Set<string>();\n protected _properties: IdentifyUserProperties = {};\n\n public getUserProperties(): IdentifyUserProperties {\n return { ...this._properties };\n }\n\n public set(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.SET, property, value);\n return this;\n }\n\n public setOnce(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.SET_ONCE, property, value);\n return this;\n }\n\n public append(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.APPEND, property, value);\n return this;\n }\n\n public prepend(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.PREPEND, property, value);\n return this;\n }\n\n public postInsert(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.POSTINSERT, property, value);\n return this;\n }\n\n public preInsert(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.PREINSERT, property, value);\n return this;\n }\n\n public remove(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.REMOVE, property, value);\n return this;\n }\n\n public add(property: string, value: number): Identify {\n this._safeSet(IdentifyOperation.ADD, property, value);\n return this;\n }\n\n public unset(property: string): Identify {\n this._safeSet(IdentifyOperation.UNSET, property, UNSET_VALUE);\n return this;\n }\n\n public clearAll(): Identify {\n // When clear all happens, all properties are unset. Reset the entire object.\n this._properties = {};\n this._properties[IdentifyOperation.CLEAR_ALL] = UNSET_VALUE;\n\n return this;\n }\n\n // Returns whether or not this set actually worked.\n private _safeSet(operation: IdentifyOperation, property: string, value: ValidPropertyType): boolean {\n if (this._validate(operation, property, value)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let userPropertyMap: any = this._properties[operation];\n if (userPropertyMap === undefined) {\n userPropertyMap = {};\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n this._properties[operation] = userPropertyMap;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n userPropertyMap[property] = value;\n this._propertySet.add(property);\n return true;\n }\n\n return false;\n }\n\n private _validate(operation: IdentifyOperation, property: string, value: ValidPropertyType): boolean {\n if (this._properties[IdentifyOperation.CLEAR_ALL] !== undefined) {\n // clear all already set. Skipping operation;\n return false;\n }\n\n if (this._propertySet.has(property)) {\n // Property already used. Skipping operation\n return false;\n }\n\n if (operation === IdentifyOperation.ADD) {\n return typeof value === 'number';\n }\n\n if (operation !== IdentifyOperation.UNSET && operation !== IdentifyOperation.REMOVE) {\n return isValidProperties(property, value);\n }\n return true;\n }\n}\n\nexport type ValidPropertyType =\n | number\n | string\n | boolean\n | Array<string | number>\n | { [key: string]: ValidPropertyType }\n | Array<{ [key: string]: ValidPropertyType }>;\n\ninterface BaseOperationConfig {\n [key: string]: ValidPropertyType;\n}\n\nexport interface IdentifyUserProperties {\n // Add operations can only take numbers\n [IdentifyOperation.ADD]?: { [key: string]: number };\n\n // This reads the keys of the passed object, but the values are not used\n [IdentifyOperation.UNSET]?: BaseOperationConfig;\n // This option does not read the key as it unsets all user properties\n [IdentifyOperation.CLEAR_ALL]?: any;\n\n // These operations can take numbers, strings, or arrays of both.\n [IdentifyOperation.SET]?: BaseOperationConfig;\n [IdentifyOperation.SET_ONCE]?: BaseOperationConfig;\n [IdentifyOperation.APPEND]?: BaseOperationConfig;\n [IdentifyOperation.PREPEND]?: BaseOperationConfig;\n [IdentifyOperation.POSTINSERT]?: BaseOperationConfig;\n [IdentifyOperation.PREINSERT]?: BaseOperationConfig;\n [IdentifyOperation.REMOVE]?: BaseOperationConfig;\n}\n\nexport enum IdentifyOperation {\n // Base Operations to set values\n SET = '$set',\n SET_ONCE = '$setOnce',\n\n // Operations around modifying existing values\n ADD = '$add',\n APPEND = '$append',\n PREPEND = '$prepend',\n REMOVE = '$remove',\n\n // Operations around appending values *if* they aren't present\n PREINSERT = '$preInsert',\n POSTINSERT = '$postInsert',\n\n // Operations around removing properties/values\n UNSET = '$unset',\n CLEAR_ALL = '$clearAll',\n}\n"]}
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,14 +1,43 @@
|
|
|
1
|
-
export { AmplitudeCore } from './core-client';
|
|
2
|
-
export { Identify } from './identify';
|
|
3
|
-
export { Revenue } from './revenue';
|
|
1
|
+
export { AmplitudeCore, CoreClient } from './core-client';
|
|
2
|
+
export { Identify, IIdentify } from './identify';
|
|
3
|
+
export { Revenue, IRevenue } from './revenue';
|
|
4
4
|
export { Destination } from './plugins/destination';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
5
|
+
export { IdentityEventSender } from './plugins/identity';
|
|
6
|
+
export { IConfig, Config, RequestMetadata } from './config';
|
|
7
|
+
export { Logger, ILogger } from './logger';
|
|
8
|
+
export { getGlobalScope } from './global-scope';
|
|
9
|
+
export { getAnalyticsConnector, setConnectorDeviceId, setConnectorUserId } from './analytics-connector';
|
|
10
|
+
export { isNewSession } from './session';
|
|
11
|
+
export { getCookieName, getOldCookieName } from './cookie-name';
|
|
12
|
+
export { getLanguage } from './language';
|
|
13
|
+
export { getQueryParams } from './query-params';
|
|
14
|
+
export { returnWrapper, AmplitudeReturn } from './utils/return-wrapper';
|
|
9
15
|
export { debugWrapper, getClientLogConfig, getClientStates } from './utils/debug';
|
|
10
16
|
export { UUID } from './utils/uuid';
|
|
17
|
+
export { createIdentifyEvent } from './utils/event-builder';
|
|
11
18
|
export { MemoryStorage } from './storage/memory';
|
|
19
|
+
export { CookieStorage } from './storage/cookie';
|
|
20
|
+
export { getStorageKey } from './storage/helpers';
|
|
12
21
|
export { BaseTransport } from './transports/base';
|
|
13
|
-
export {
|
|
22
|
+
export { FetchTransport } from './transports/fetch';
|
|
23
|
+
export { LogLevel } from './types/loglevel';
|
|
24
|
+
export { AMPLITUDE_PREFIX, STORAGE_PREFIX } from './types/constants';
|
|
25
|
+
export { Storage, IdentityStorageType } from './types/storage';
|
|
26
|
+
export { Event } from './types/event/event';
|
|
27
|
+
export { EventOptions } from './types/event/base-event';
|
|
28
|
+
export { IngestionMetadata } from './types/event/ingestion-metadata';
|
|
29
|
+
export { ServerZoneType } from './types/server-zone';
|
|
30
|
+
export { OfflineDisabled } from './types/offline';
|
|
31
|
+
export { Plan } from './types/event/plan';
|
|
32
|
+
export { TransportType, Transport } from './types/transport';
|
|
33
|
+
export { Payload } from './types/payload';
|
|
34
|
+
export { Response } from './types/response';
|
|
35
|
+
export { UserSession } from './types/user-session';
|
|
36
|
+
export { Plugin, BeforePlugin, DestinationPlugin, EnrichmentPlugin, PluginType } from './types/plugin';
|
|
37
|
+
export { Result } from './types/result';
|
|
38
|
+
export { ElementInteractionsOptions, Messenger, ActionType, DEFAULT_CSS_SELECTOR_ALLOWLIST, DEFAULT_DATA_ATTRIBUTE_PREFIX, DEFAULT_ACTION_CLICK_ALLOWLIST, } from './types/element-interactions';
|
|
39
|
+
export { PageTrackingOptions, PageTrackingTrackOn, PageTrackingHistoryChanges } from './types/page-view-tracking';
|
|
40
|
+
export { Status } from './types/status';
|
|
41
|
+
export { BrowserConfig, BrowserOptions, DefaultTrackingOptions, TrackingOptions, AutocaptureOptions, CookieOptions, AttributionOptions, } from './types/browser-config';
|
|
42
|
+
export { BrowserClient } from './types/browser-client';
|
|
14
43
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACxG,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD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AY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACvG,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EACL,0BAA0B,EAC1B,SAAS,EACT,UAAU,EACV,8BAA8B,EAC9B,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAClH,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EACL,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Status = exports.DEFAULT_ACTION_CLICK_ALLOWLIST = exports.DEFAULT_DATA_ATTRIBUTE_PREFIX = exports.DEFAULT_CSS_SELECTOR_ALLOWLIST = exports.OfflineDisabled = exports.STORAGE_PREFIX = exports.AMPLITUDE_PREFIX = exports.LogLevel = exports.FetchTransport = exports.BaseTransport = exports.getStorageKey = exports.CookieStorage = exports.MemoryStorage = exports.createIdentifyEvent = exports.UUID = exports.getClientStates = exports.getClientLogConfig = exports.debugWrapper = exports.returnWrapper = exports.getQueryParams = exports.getLanguage = exports.getOldCookieName = exports.getCookieName = exports.isNewSession = exports.setConnectorUserId = exports.setConnectorDeviceId = exports.getAnalyticsConnector = exports.getGlobalScope = exports.Logger = exports.RequestMetadata = exports.Config = exports.IdentityEventSender = exports.Destination = exports.Revenue = exports.Identify = exports.AmplitudeCore = void 0;
|
|
4
4
|
var core_client_1 = require("./core-client");
|
|
5
5
|
Object.defineProperty(exports, "AmplitudeCore", { enumerable: true, get: function () { return core_client_1.AmplitudeCore; } });
|
|
6
6
|
var identify_1 = require("./identify");
|
|
@@ -9,14 +9,28 @@ var revenue_1 = require("./revenue");
|
|
|
9
9
|
Object.defineProperty(exports, "Revenue", { enumerable: true, get: function () { return revenue_1.Revenue; } });
|
|
10
10
|
var destination_1 = require("./plugins/destination");
|
|
11
11
|
Object.defineProperty(exports, "Destination", { enumerable: true, get: function () { return destination_1.Destination; } });
|
|
12
|
+
var identity_1 = require("./plugins/identity");
|
|
13
|
+
Object.defineProperty(exports, "IdentityEventSender", { enumerable: true, get: function () { return identity_1.IdentityEventSender; } });
|
|
12
14
|
var config_1 = require("./config");
|
|
13
15
|
Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return config_1.Config; } });
|
|
14
16
|
Object.defineProperty(exports, "RequestMetadata", { enumerable: true, get: function () { return config_1.RequestMetadata; } });
|
|
15
17
|
var logger_1 = require("./logger");
|
|
16
18
|
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } });
|
|
17
|
-
var
|
|
18
|
-
Object.defineProperty(exports, "
|
|
19
|
-
|
|
19
|
+
var global_scope_1 = require("./global-scope");
|
|
20
|
+
Object.defineProperty(exports, "getGlobalScope", { enumerable: true, get: function () { return global_scope_1.getGlobalScope; } });
|
|
21
|
+
var analytics_connector_1 = require("./analytics-connector");
|
|
22
|
+
Object.defineProperty(exports, "getAnalyticsConnector", { enumerable: true, get: function () { return analytics_connector_1.getAnalyticsConnector; } });
|
|
23
|
+
Object.defineProperty(exports, "setConnectorDeviceId", { enumerable: true, get: function () { return analytics_connector_1.setConnectorDeviceId; } });
|
|
24
|
+
Object.defineProperty(exports, "setConnectorUserId", { enumerable: true, get: function () { return analytics_connector_1.setConnectorUserId; } });
|
|
25
|
+
var session_1 = require("./session");
|
|
26
|
+
Object.defineProperty(exports, "isNewSession", { enumerable: true, get: function () { return session_1.isNewSession; } });
|
|
27
|
+
var cookie_name_1 = require("./cookie-name");
|
|
28
|
+
Object.defineProperty(exports, "getCookieName", { enumerable: true, get: function () { return cookie_name_1.getCookieName; } });
|
|
29
|
+
Object.defineProperty(exports, "getOldCookieName", { enumerable: true, get: function () { return cookie_name_1.getOldCookieName; } });
|
|
30
|
+
var language_1 = require("./language");
|
|
31
|
+
Object.defineProperty(exports, "getLanguage", { enumerable: true, get: function () { return language_1.getLanguage; } });
|
|
32
|
+
var query_params_1 = require("./query-params");
|
|
33
|
+
Object.defineProperty(exports, "getQueryParams", { enumerable: true, get: function () { return query_params_1.getQueryParams; } });
|
|
20
34
|
var return_wrapper_1 = require("./utils/return-wrapper");
|
|
21
35
|
Object.defineProperty(exports, "returnWrapper", { enumerable: true, get: function () { return return_wrapper_1.returnWrapper; } });
|
|
22
36
|
var debug_1 = require("./utils/debug");
|
|
@@ -25,10 +39,29 @@ Object.defineProperty(exports, "getClientLogConfig", { enumerable: true, get: fu
|
|
|
25
39
|
Object.defineProperty(exports, "getClientStates", { enumerable: true, get: function () { return debug_1.getClientStates; } });
|
|
26
40
|
var uuid_1 = require("./utils/uuid");
|
|
27
41
|
Object.defineProperty(exports, "UUID", { enumerable: true, get: function () { return uuid_1.UUID; } });
|
|
42
|
+
var event_builder_1 = require("./utils/event-builder");
|
|
43
|
+
Object.defineProperty(exports, "createIdentifyEvent", { enumerable: true, get: function () { return event_builder_1.createIdentifyEvent; } });
|
|
28
44
|
var memory_1 = require("./storage/memory");
|
|
29
45
|
Object.defineProperty(exports, "MemoryStorage", { enumerable: true, get: function () { return memory_1.MemoryStorage; } });
|
|
46
|
+
var cookie_1 = require("./storage/cookie");
|
|
47
|
+
Object.defineProperty(exports, "CookieStorage", { enumerable: true, get: function () { return cookie_1.CookieStorage; } });
|
|
48
|
+
var helpers_1 = require("./storage/helpers");
|
|
49
|
+
Object.defineProperty(exports, "getStorageKey", { enumerable: true, get: function () { return helpers_1.getStorageKey; } });
|
|
30
50
|
var base_1 = require("./transports/base");
|
|
31
51
|
Object.defineProperty(exports, "BaseTransport", { enumerable: true, get: function () { return base_1.BaseTransport; } });
|
|
32
|
-
var
|
|
33
|
-
Object.defineProperty(exports, "
|
|
52
|
+
var fetch_1 = require("./transports/fetch");
|
|
53
|
+
Object.defineProperty(exports, "FetchTransport", { enumerable: true, get: function () { return fetch_1.FetchTransport; } });
|
|
54
|
+
var loglevel_1 = require("./types/loglevel");
|
|
55
|
+
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return loglevel_1.LogLevel; } });
|
|
56
|
+
var constants_1 = require("./types/constants");
|
|
57
|
+
Object.defineProperty(exports, "AMPLITUDE_PREFIX", { enumerable: true, get: function () { return constants_1.AMPLITUDE_PREFIX; } });
|
|
58
|
+
Object.defineProperty(exports, "STORAGE_PREFIX", { enumerable: true, get: function () { return constants_1.STORAGE_PREFIX; } });
|
|
59
|
+
var offline_1 = require("./types/offline");
|
|
60
|
+
Object.defineProperty(exports, "OfflineDisabled", { enumerable: true, get: function () { return offline_1.OfflineDisabled; } });
|
|
61
|
+
var element_interactions_1 = require("./types/element-interactions");
|
|
62
|
+
Object.defineProperty(exports, "DEFAULT_CSS_SELECTOR_ALLOWLIST", { enumerable: true, get: function () { return element_interactions_1.DEFAULT_CSS_SELECTOR_ALLOWLIST; } });
|
|
63
|
+
Object.defineProperty(exports, "DEFAULT_DATA_ATTRIBUTE_PREFIX", { enumerable: true, get: function () { return element_interactions_1.DEFAULT_DATA_ATTRIBUTE_PREFIX; } });
|
|
64
|
+
Object.defineProperty(exports, "DEFAULT_ACTION_CLICK_ALLOWLIST", { enumerable: true, get: function () { return element_interactions_1.DEFAULT_ACTION_CLICK_ALLOWLIST; } });
|
|
65
|
+
var status_1 = require("./types/status");
|
|
66
|
+
Object.defineProperty(exports, "Status", { enumerable: true, get: function () { return status_1.Status; } });
|
|
34
67
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;AAAjD,4GAAA,aAAa,OAAA;AACtB,uCAAiD;AAAxC,oGAAA,QAAQ,OAAA;AACjB,qCAA8C;AAArC,kGAAA,OAAO,OAAA;AAChB,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,+CAAyD;AAAhD,+GAAA,mBAAmB,OAAA;AAC5B,mCAA4D;AAA1C,gGAAA,MAAM,OAAA;AAAE,yGAAA,eAAe,OAAA;AACzC,mCAA2C;AAAlC,gGAAA,MAAM,OAAA;AACf,+CAAgD;AAAvC,8GAAA,cAAc,OAAA;AACvB,6DAAwG;AAA/F,4HAAA,qBAAqB,OAAA;AAAE,2HAAA,oBAAoB,OAAA;AAAE,yHAAA,kBAAkB,OAAA;AACxE,qCAAyC;AAAhC,uGAAA,YAAY,OAAA;AACrB,6CAAgE;AAAvD,4GAAA,aAAa,OAAA;AAAE,+GAAA,gBAAgB,OAAA;AACxC,uCAAyC;AAAhC,uGAAA,WAAW,OAAA;AACpB,+CAAgD;AAAvC,8GAAA,cAAc,OAAA;AAEvB,yDAAwE;AAA/D,+GAAA,aAAa,OAAA;AACtB,uCAAkF;AAAzE,qGAAA,YAAY,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAAE,wGAAA,eAAe,OAAA;AAC1D,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AACb,uDAA4D;AAAnD,oHAAA,mBAAmB,OAAA;AAE5B,2CAAiD;AAAxC,uGAAA,aAAa,OAAA;AACtB,2CAAiD;AAAxC,uGAAA,aAAa,OAAA;AACtB,6CAAkD;AAAzC,wGAAA,aAAa,OAAA;AAEtB,0CAAkD;AAAzC,qGAAA,aAAa,OAAA;AACtB,4CAAoD;AAA3C,uGAAA,cAAc,OAAA;AAEvB,6CAA4C;AAAnC,oGAAA,QAAQ,OAAA;AACjB,+CAAqE;AAA5D,6GAAA,gBAAgB,OAAA;AAAE,2GAAA,cAAc,OAAA;AAMzC,2CAAkD;AAAzC,0GAAA,eAAe,OAAA;AAQxB,qEAOsC;AAHpC,sIAAA,8BAA8B,OAAA;AAC9B,qIAAA,6BAA6B,OAAA;AAC7B,sIAAA,8BAA8B,OAAA;AAGhC,yCAAwC;AAA/B,gGAAA,MAAM,OAAA","sourcesContent":["export { AmplitudeCore, CoreClient } from './core-client';\nexport { Identify, IIdentify } from './identify';\nexport { Revenue, IRevenue } from './revenue';\nexport { Destination } from './plugins/destination';\nexport { IdentityEventSender } from './plugins/identity';\nexport { IConfig, Config, RequestMetadata } from './config';\nexport { Logger, ILogger } from './logger';\nexport { getGlobalScope } from './global-scope';\nexport { getAnalyticsConnector, setConnectorDeviceId, setConnectorUserId } from './analytics-connector';\nexport { isNewSession } from './session';\nexport { getCookieName, getOldCookieName } from './cookie-name';\nexport { getLanguage } from './language';\nexport { getQueryParams } from './query-params';\n\nexport { returnWrapper, AmplitudeReturn } from './utils/return-wrapper';\nexport { debugWrapper, getClientLogConfig, getClientStates } from './utils/debug';\nexport { UUID } from './utils/uuid';\nexport { createIdentifyEvent } from './utils/event-builder';\n\nexport { MemoryStorage } from './storage/memory';\nexport { CookieStorage } from './storage/cookie';\nexport { getStorageKey } from './storage/helpers';\n\nexport { BaseTransport } from './transports/base';\nexport { FetchTransport } from './transports/fetch';\n\nexport { LogLevel } from './types/loglevel';\nexport { AMPLITUDE_PREFIX, STORAGE_PREFIX } from './types/constants';\nexport { Storage, IdentityStorageType } from './types/storage';\nexport { Event } from './types/event/event';\nexport { EventOptions } from './types/event/base-event';\nexport { IngestionMetadata } from './types/event/ingestion-metadata';\nexport { ServerZoneType } from './types/server-zone';\nexport { OfflineDisabled } from './types/offline';\nexport { Plan } from './types/event/plan';\nexport { TransportType, Transport } from './types/transport';\nexport { Payload } from './types/payload';\nexport { Response } from './types/response';\nexport { UserSession } from './types/user-session';\nexport { Plugin, BeforePlugin, DestinationPlugin, EnrichmentPlugin, PluginType } from './types/plugin';\nexport { Result } from './types/result';\nexport {\n ElementInteractionsOptions,\n Messenger,\n ActionType,\n DEFAULT_CSS_SELECTOR_ALLOWLIST,\n DEFAULT_DATA_ATTRIBUTE_PREFIX,\n DEFAULT_ACTION_CLICK_ALLOWLIST,\n} from './types/element-interactions';\nexport { PageTrackingOptions, PageTrackingTrackOn, PageTrackingHistoryChanges } from './types/page-view-tracking';\nexport { Status } from './types/status';\nexport {\n BrowserConfig,\n BrowserOptions,\n DefaultTrackingOptions,\n TrackingOptions,\n AutocaptureOptions,\n CookieOptions,\n AttributionOptions,\n} from './types/browser-config';\nexport { BrowserClient } from './types/browser-client';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../../src/language.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,QAAO,MAM9B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLanguage = void 0;
|
|
4
|
+
var getLanguage = function () {
|
|
5
|
+
var _a, _b, _c, _d;
|
|
6
|
+
if (typeof navigator === 'undefined')
|
|
7
|
+
return '';
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
9
|
+
var userLanguage = navigator.userLanguage;
|
|
10
|
+
return (_d = (_c = (_b = (_a = navigator.languages) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : navigator.language) !== null && _c !== void 0 ? _c : userLanguage) !== null && _d !== void 0 ? _d : '';
|
|
11
|
+
};
|
|
12
|
+
exports.getLanguage = getLanguage;
|
|
13
|
+
//# sourceMappingURL=language.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language.js","sourceRoot":"","sources":["../../src/language.ts"],"names":[],"mappings":";;;AAAO,IAAM,WAAW,GAAG;;IACzB,IAAI,OAAO,SAAS,KAAK,WAAW;QAAE,OAAO,EAAE,CAAC;IAChD,sEAAsE;IACtE,IAAM,YAAY,GAAI,SAAiB,CAAC,YAAkC,CAAC;IAE3E,OAAO,MAAA,MAAA,MAAA,MAAA,SAAS,CAAC,SAAS,0CAAG,CAAC,CAAC,mCAAI,SAAS,CAAC,QAAQ,mCAAI,YAAY,mCAAI,EAAE,CAAC;AAC9E,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB","sourcesContent":["export const getLanguage = (): string => {\n if (typeof navigator === 'undefined') return '';\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const userLanguage = (navigator as any).userLanguage as string | undefined;\n\n return navigator.languages?.[0] ?? navigator.language ?? userLanguage ?? '';\n};\n"]}
|
package/lib/cjs/logger.d.ts
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
|
-
import { LogLevel
|
|
1
|
+
import { LogLevel } from './types/loglevel';
|
|
2
|
+
export interface ILogger {
|
|
3
|
+
disable(): void;
|
|
4
|
+
enable(logLevel: LogLevel): void;
|
|
5
|
+
log(...args: any[]): void;
|
|
6
|
+
warn(...args: any[]): void;
|
|
7
|
+
error(...args: any[]): void;
|
|
8
|
+
debug(...args: any[]): void;
|
|
9
|
+
}
|
|
10
|
+
export interface LogConfig {
|
|
11
|
+
logger: ILogger;
|
|
12
|
+
logLevel: LogLevel;
|
|
13
|
+
}
|
|
14
|
+
type TimeKey = 'start' | 'end';
|
|
15
|
+
export interface DebugContext {
|
|
16
|
+
type: string;
|
|
17
|
+
name: string;
|
|
18
|
+
args: string[] | string;
|
|
19
|
+
stacktrace?: string[] | string;
|
|
20
|
+
time?: {
|
|
21
|
+
[key in TimeKey]?: string;
|
|
22
|
+
};
|
|
23
|
+
states?: {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
2
27
|
export declare class Logger implements ILogger {
|
|
3
28
|
logLevel: LogLevel;
|
|
4
29
|
constructor();
|
|
@@ -9,4 +34,5 @@ export declare class Logger implements ILogger {
|
|
|
9
34
|
error(...args: any[]): void;
|
|
10
35
|
debug(...args: any[]): void;
|
|
11
36
|
}
|
|
37
|
+
export {};
|
|
12
38
|
//# sourceMappingURL=logger.d.ts.map
|
package/lib/cjs/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C,MAAM,WAAW,OAAO;IACtB,OAAO,IAAI,IAAI,CAAC;IAChB,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IACjC,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC1B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,KAAK,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;AAE/B,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAC/B,IAAI,CAAC,EAAE;SAAG,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,MAAM;KAAE,CAAC;IACrC,MAAM,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CACjC;AAED,qBAAa,MAAO,YAAW,OAAO;IACpC,QAAQ,EAAE,QAAQ,CAAC;;IAMnB,OAAO,IAAI,IAAI;IAIf,MAAM,CAAC,QAAQ,GAAE,QAAwB,GAAG,IAAI;IAIhD,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAOzB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAO1B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAO3B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;CAO5B"}
|
package/lib/cjs/logger.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Logger = void 0;
|
|
4
|
-
var
|
|
4
|
+
var loglevel_1 = require("./types/loglevel");
|
|
5
5
|
var PREFIX = 'Amplitude Logger ';
|
|
6
6
|
var Logger = /** @class */ (function () {
|
|
7
7
|
function Logger() {
|
|
8
|
-
this.logLevel =
|
|
8
|
+
this.logLevel = loglevel_1.LogLevel.None;
|
|
9
9
|
}
|
|
10
10
|
Logger.prototype.disable = function () {
|
|
11
|
-
this.logLevel =
|
|
11
|
+
this.logLevel = loglevel_1.LogLevel.None;
|
|
12
12
|
};
|
|
13
13
|
Logger.prototype.enable = function (logLevel) {
|
|
14
|
-
if (logLevel === void 0) { logLevel =
|
|
14
|
+
if (logLevel === void 0) { logLevel = loglevel_1.LogLevel.Warn; }
|
|
15
15
|
this.logLevel = logLevel;
|
|
16
16
|
};
|
|
17
17
|
Logger.prototype.log = function () {
|
|
@@ -19,7 +19,7 @@ var Logger = /** @class */ (function () {
|
|
|
19
19
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
20
20
|
args[_i] = arguments[_i];
|
|
21
21
|
}
|
|
22
|
-
if (this.logLevel <
|
|
22
|
+
if (this.logLevel < loglevel_1.LogLevel.Verbose) {
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
console.log("".concat(PREFIX, "[Log]: ").concat(args.join(' ')));
|
|
@@ -29,7 +29,7 @@ var Logger = /** @class */ (function () {
|
|
|
29
29
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
30
30
|
args[_i] = arguments[_i];
|
|
31
31
|
}
|
|
32
|
-
if (this.logLevel <
|
|
32
|
+
if (this.logLevel < loglevel_1.LogLevel.Warn) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
console.warn("".concat(PREFIX, "[Warn]: ").concat(args.join(' ')));
|
|
@@ -39,7 +39,7 @@ var Logger = /** @class */ (function () {
|
|
|
39
39
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
40
40
|
args[_i] = arguments[_i];
|
|
41
41
|
}
|
|
42
|
-
if (this.logLevel <
|
|
42
|
+
if (this.logLevel < loglevel_1.LogLevel.Error) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
console.error("".concat(PREFIX, "[Error]: ").concat(args.join(' ')));
|
|
@@ -49,7 +49,7 @@ var Logger = /** @class */ (function () {
|
|
|
49
49
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
50
50
|
args[_i] = arguments[_i];
|
|
51
51
|
}
|
|
52
|
-
if (this.logLevel <
|
|
52
|
+
if (this.logLevel < loglevel_1.LogLevel.Debug) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
// console.debug output is hidden by default in chrome
|
package/lib/cjs/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":";;;AAAA,
|
|
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CAAE,CAAC,CAAC;IACvD,CAAC;IAED,sBAAK,GAAL;QAAM,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QAClB,IAAI,IAAI,CAAC,QAAQ,GAAG,mBAAQ,CAAC,KAAK,EAAE;YAClC,OAAO;SACR;QACD,sDAAsD;QACtD,OAAO,CAAC,GAAG,CAAC,UAAG,MAAM,sBAAY,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAE,CAAC,CAAC;IACrD,CAAC;IACH,aAAC;AAAD,CAAC,AA3CD,IA2CC;AA3CY,wBAAM","sourcesContent":["import { LogLevel } from './types/loglevel';\n\nconst PREFIX = 'Amplitude Logger ';\n\nexport interface ILogger {\n disable(): void;\n enable(logLevel: LogLevel): void;\n log(...args: any[]): void;\n warn(...args: any[]): void;\n error(...args: any[]): void;\n debug(...args: any[]): void;\n}\n\nexport interface LogConfig {\n logger: ILogger;\n logLevel: LogLevel;\n}\n\ntype TimeKey = 'start' | 'end';\n\nexport interface DebugContext {\n type: string;\n name: string;\n args: string[] | string;\n stacktrace?: string[] | string;\n time?: { [key in TimeKey]?: string };\n states?: { [key: string]: any };\n}\n\nexport class Logger implements ILogger {\n logLevel: LogLevel;\n\n constructor() {\n this.logLevel = LogLevel.None;\n }\n\n disable(): void {\n this.logLevel = LogLevel.None;\n }\n\n enable(logLevel: LogLevel = LogLevel.Warn): void {\n this.logLevel = logLevel;\n }\n\n log(...args: any[]): void {\n if (this.logLevel < LogLevel.Verbose) {\n return;\n }\n console.log(`${PREFIX}[Log]: ${args.join(' ')}`);\n }\n\n warn(...args: any[]): void {\n if (this.logLevel < LogLevel.Warn) {\n return;\n }\n console.warn(`${PREFIX}[Warn]: ${args.join(' ')}`);\n }\n\n error(...args: any[]): void {\n if (this.logLevel < LogLevel.Error) {\n return;\n }\n console.error(`${PREFIX}[Error]: ${args.join(' ')}`);\n }\n\n debug(...args: any[]): void {\n if (this.logLevel < LogLevel.Debug) {\n return;\n }\n // console.debug output is hidden by default in chrome\n console.log(`${PREFIX}[Debug]: ${args.join(' ')}`);\n }\n}\n"]}
|