@amplitude/analytics-browser 2.0.0 → 2.0.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/README.md +1 -1
- package/lib/cjs/__mocks__/det-notification.d.ts +3 -0
- package/lib/cjs/__mocks__/det-notification.d.ts.map +1 -0
- package/lib/cjs/__mocks__/det-notification.js +7 -0
- package/lib/cjs/__mocks__/det-notification.js.map +1 -0
- package/lib/cjs/browser-client.d.ts.map +1 -1
- package/lib/cjs/browser-client.js +3 -0
- package/lib/cjs/browser-client.js.map +1 -1
- package/lib/cjs/det-notification.d.ts +8 -0
- package/lib/cjs/det-notification.d.ts.map +1 -0
- package/lib/cjs/det-notification.js +36 -0
- package/lib/cjs/det-notification.js.map +1 -0
- package/lib/cjs/index.d.ts +1 -1
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/version.js.map +1 -1
- package/lib/esm/__mocks__/det-notification.d.ts +3 -0
- package/lib/esm/__mocks__/det-notification.d.ts.map +1 -0
- package/lib/esm/__mocks__/det-notification.js +3 -0
- package/lib/esm/__mocks__/det-notification.js.map +1 -0
- package/lib/esm/browser-client.d.ts.map +1 -1
- package/lib/esm/browser-client.js +3 -0
- package/lib/esm/browser-client.js.map +1 -1
- package/lib/esm/det-notification.d.ts +8 -0
- package/lib/esm/det-notification.d.ts.map +1 -0
- package/lib/esm/det-notification.js +32 -0
- package/lib/esm/det-notification.js.map +1 -0
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/esm/version.js.map +1 -1
- package/lib/scripts/__mocks__/det-notification.d.ts +3 -0
- package/lib/scripts/__mocks__/det-notification.d.ts.map +1 -0
- package/lib/scripts/amplitude-min.js +1 -1
- package/lib/scripts/amplitude-min.js.gz +0 -0
- package/lib/scripts/amplitude-min.umd.js +1 -1
- package/lib/scripts/amplitude-min.umd.js.gz +0 -0
- package/lib/scripts/amplitude-snippet-instructions.html +1 -1
- package/lib/scripts/amplitude-snippet-min.js +1 -1
- package/lib/scripts/browser-client.d.ts.map +1 -1
- package/lib/scripts/det-notification.d.ts +8 -0
- package/lib/scripts/det-notification.d.ts.map +1 -0
- package/lib/scripts/index.d.ts +1 -1
- package/lib/scripts/index.d.ts.map +1 -1
- package/lib/scripts/version.d.ts +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ This SDK is also available through CDN. Copy the script loader below and paste b
|
|
|
51
51
|
<!-- README_SNIPPET_BLOCK -->
|
|
52
52
|
```html
|
|
53
53
|
<script type="text/javascript">
|
|
54
|
-
!function(){"use strict";!function(e,t){var n=e.amplitude||{_q:[],_iq:{}};if(n.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var r=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,n){return function(r){e._q.push({name:t,args:Array.prototype.slice.call(n,0),resolve:r})}},o=function(e,t,n){e[t]=function(){if(n)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<
|
|
54
|
+
!function(){"use strict";!function(e,t){var n=e.amplitude||{_q:[],_iq:{}};if(n.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var r=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,n){return function(r){e._q.push({name:t,args:Array.prototype.slice.call(n,0),resolve:r})}},o=function(e,t,n){e[t]=function(){if(n)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<g.length;t++)o(e,g[t],!1);for(var n=0;n<m.length;n++)o(e,m[n],!0)};n.invoked=!0;var c=t.createElement("script");c.type="text/javascript",c.integrity="sha384-8CaobklqZpnKMCN5+Q7pFJe8EmuAgXW7EEpqcvOvMpY1+hYicT2sXEwyLIcF7FG2",c.crossOrigin="anonymous",c.async=!0,c.src="https://cdn.amplitude.com/libs/analytics-browser-2.0.1-min.js.gz",c.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var a=t.getElementsByTagName("script")[0];a.parentNode.insertBefore(c,a);for(var u=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],l=0;l<p.length;l++)r(u,p[l]);n.Identify=u;for(var d=function(){return this._q=[],this},v=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],f=0;f<v.length;f++)r(d,v[f]);n.Revenue=d;var g=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],m=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(n),n.createInstance=function(e){return n._iq[e]={_q:[]},i(n._iq[e]),n._iq[e]},e.amplitude=n}}(window,document)}();
|
|
55
55
|
|
|
56
56
|
amplitude.init("<YOUR_API_KEY>");
|
|
57
57
|
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"det-notification.d.ts","sourceRoot":"","sources":["../../../src/__mocks__/det-notification.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,iBAAkB,CAAC;AAEzC,eAAO,MAAM,WAAW,iBAAkB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.resetNotify = exports.detNotify = void 0;
|
|
3
|
+
var detNotify = function () { return undefined; };
|
|
4
|
+
exports.detNotify = detNotify;
|
|
5
|
+
var resetNotify = function () { return undefined; };
|
|
6
|
+
exports.resetNotify = resetNotify;
|
|
7
|
+
//# sourceMappingURL=det-notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"det-notification.js","sourceRoot":"","sources":["../../../src/__mocks__/det-notification.ts"],"names":[],"mappings":";;AAAO,IAAM,SAAS,GAAG,cAAM,OAAA,SAAS,EAAT,CAAS,CAAC;AAA5B,QAAA,SAAS,aAAmB;AAElC,IAAM,WAAW,GAAG,cAAM,OAAA,SAAS,EAAT,CAAS,CAAC;AAA9B,QAAA,WAAW,eAAmB","sourcesContent":["export const detNotify = () => undefined;\n\nexport const resetNotify = () => undefined;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-client.d.ts","sourceRoot":"","sources":["../../src/browser-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuD,MAAM,2BAA2B,CAAC;AAa/G,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,EACd,KAAK,EACL,YAAY,EACZ,QAAQ,IAAI,SAAS,EACrB,OAAO,IAAI,QAAQ,EACnB,aAAa,EACd,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"browser-client.d.ts","sourceRoot":"","sources":["../../src/browser-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuD,MAAM,2BAA2B,CAAC;AAa/G,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,EACd,KAAK,EACL,YAAY,EACZ,QAAQ,IAAI,SAAS,EACrB,OAAO,IAAI,QAAQ,EACnB,aAAa,EACd,MAAM,4BAA4B,CAAC;AAWpC,qBAAa,gBAAiB,SAAQ,aAAc,YAAW,aAAa;IAG1E,MAAM,EAAE,aAAa,CAAC;IACtB,uBAAuB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1C,IAAI,CAAC,MAAM,SAAK,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,cAAc,EAAE,YAAY,CAAC,EAAE,cAAc;cAkB1E,KAAK,CAAC,OAAO,EAAE,cAAc,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;IAiElE,SAAS;IAIT,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS;IAWpC,WAAW;IAIX,WAAW,CAAC,QAAQ,EAAE,MAAM;IAS5B,KAAK;IAKL,YAAY;IAIZ,YAAY,CAAC,SAAS,EAAE,MAAM;IAyC9B,aAAa;IAQb,YAAY,CAAC,SAAS,EAAE,aAAa;IAQrC,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE,YAAY,CAAC,EAAE,YAAY;IAezD,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,CAAC,EAAE,YAAY;IAS/G,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAE,YAAY;IAShD,OAAO,CAAC,KAAK,EAAE,KAAK;CAgB3B"}
|
|
@@ -11,6 +11,7 @@ var plugin_page_view_tracking_browser_1 = require("@amplitude/plugin-page-view-t
|
|
|
11
11
|
var form_interaction_tracking_1 = require("./plugins/form-interaction-tracking");
|
|
12
12
|
var file_download_tracking_1 = require("./plugins/file-download-tracking");
|
|
13
13
|
var constants_1 = require("./constants");
|
|
14
|
+
var det_notification_1 = require("./det-notification");
|
|
14
15
|
var AmplitudeBrowser = /** @class */ (function (_super) {
|
|
15
16
|
tslib_1.__extends(AmplitudeBrowser, _super);
|
|
16
17
|
function AmplitudeBrowser() {
|
|
@@ -79,6 +80,8 @@ var AmplitudeBrowser = /** @class */ (function (_super) {
|
|
|
79
80
|
return [4 /*yield*/, this.add(new analytics_client_common_1.IdentityEventSender()).promise];
|
|
80
81
|
case 5:
|
|
81
82
|
_c.sent();
|
|
83
|
+
// Notify if DET is enabled
|
|
84
|
+
(0, det_notification_1.detNotify)(this.config);
|
|
82
85
|
if (!(0, analytics_client_common_1.isFileDownloadTrackingEnabled)(this.config.defaultTracking)) return [3 /*break*/, 7];
|
|
83
86
|
return [4 /*yield*/, this.add((0, file_download_tracking_1.fileDownloadTracking)()).promise];
|
|
84
87
|
case 6:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-client.js","sourceRoot":"","sources":["../../src/browser-client.ts"],"names":[],"mappings":";;;AAAA,4DAA+G;AAC/G,8EAW4C;AAW5C,yDAAyF;AACzF,6CAA4C;AAC5C,mCAA6D;AAC7D,4FAAiF;AACjF,kGAAsF;AACtF,iFAA8E;AAC9E,2EAAwE;AACxE,yCAAqF;AAErF;IAAsC,4CAAa;IAAnD;;IAsOA,CAAC;IA/NC,+BAAI,GAAJ,UAAK,MAAW,EAAE,eAAyC,EAAE,YAA6B;QAArF,uBAAA,EAAA,WAAW;QACd,IAAI,MAA0B,CAAC;QAC/B,IAAI,OAAmC,CAAC;QAExC,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACxB,MAAM,GAAG,eAAqC,CAAC;YAC/C,OAAO,GAAG,YAAY,CAAC;SACxB;aAAM;YACL,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE;gBACvC,MAAM,GAAG,eAAe,CAAC;gBACzB,OAAO,GAAG,SAAS,CAAC;aACrB;iBAAM;gBACL,MAAM,GAAG,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,CAAC;gBACjC,OAAO,GAAG,eAAe,CAAC;aAC3B;SACF;QACD,OAAO,IAAA,8BAAa,EAAC,IAAI,CAAC,KAAK,uCAAM,OAAO,KAAE,MAAM,QAAA,EAAE,MAAM,QAAA,IAAG,CAAC,CAAC;IACnE,CAAC;IACe,gCAAK,GAArB,UAAsB,OAA4C;;;;;;;;wBAChE,0CAA0C;wBAC1C,IAAI,IAAI,CAAC,YAAY,EAAE;4BACrB,sBAAO;yBACR;wBACD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;wBAGF,qBAAM,IAAA,yBAAgB,EAAC,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAA;;wBAAtE,cAAc,GAAG,SAAqD;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Wrapper, Revenue, UUID } from '@amplitude/analytics-core';\nimport {\n getAnalyticsConnector,\n getAttributionTrackingConfig,\n getPageViewTrackingConfig,\n IdentityEventSender,\n isAttributionTrackingEnabled,\n isSessionTrackingEnabled,\n isFileDownloadTrackingEnabled,\n isFormInteractionTrackingEnabled,\n setConnectorDeviceId,\n setConnectorUserId,\n} from '@amplitude/analytics-client-common';\nimport {\n BrowserClient,\n BrowserConfig,\n BrowserOptions,\n Event,\n EventOptions,\n Identify as IIdentify,\n Revenue as IRevenue,\n TransportType,\n} from '@amplitude/analytics-types';\nimport { convertProxyObjectToRealObject, isInstanceProxy } from './utils/snippet-helper';\nimport { Context } from './plugins/context';\nimport { useBrowserConfig, createTransport } from './config';\nimport { webAttributionPlugin } from '@amplitude/plugin-web-attribution-browser';\nimport { pageViewTrackingPlugin } from '@amplitude/plugin-page-view-tracking-browser';\nimport { formInteractionTracking } from './plugins/form-interaction-tracking';\nimport { fileDownloadTracking } from './plugins/file-download-tracking';\nimport { DEFAULT_SESSION_END_EVENT, DEFAULT_SESSION_START_EVENT } from './constants';\n\nexport class AmplitudeBrowser extends AmplitudeCore implements BrowserClient {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: BrowserConfig;\n previousSessionDeviceId: string | undefined;\n previousSessionUserId: string | undefined;\n\n init(apiKey = '', userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions) {\n let userId: string | undefined;\n let options: BrowserOptions | undefined;\n\n if (arguments.length > 2) {\n userId = userIdOrOptions as string | undefined;\n options = maybeOptions;\n } else {\n if (typeof userIdOrOptions === 'string') {\n userId = userIdOrOptions;\n options = undefined;\n } else {\n userId = userIdOrOptions?.userId;\n options = userIdOrOptions;\n }\n }\n return returnWrapper(this._init({ ...options, userId, apiKey }));\n }\n protected async _init(options: BrowserOptions & { apiKey: string }) {\n // Step 1: Block concurrent initialization\n if (this.initializing) {\n return;\n }\n this.initializing = true;\n\n // Step 2: Create browser config\n const browserOptions = await useBrowserConfig(options.apiKey, options, this);\n await super._init(browserOptions);\n\n // Step 3: Set session ID\n // Priority 1: `options.sessionId`\n // Priority 2: last known sessionId from user identity storage\n // Default: `Date.now()`\n // Session ID is handled differently than device ID and user ID due to session events\n this.setSessionId(options.sessionId ?? this.config.sessionId ?? Date.now());\n\n // Set up the analytics connector to integrate with the experiment SDK.\n // Send events from the experiment SDK and forward identifies to the\n // identity store.\n const connector = getAnalyticsConnector(options.instanceName);\n connector.identityStore.setIdentity({\n userId: this.config.userId,\n deviceId: this.config.deviceId,\n });\n\n // Step 4: Install plugins\n // Do not track any events before this\n await this.add(new Destination()).promise;\n await this.add(new Context()).promise;\n await this.add(new IdentityEventSender()).promise;\n\n if (isFileDownloadTrackingEnabled(this.config.defaultTracking)) {\n await this.add(fileDownloadTracking()).promise;\n }\n\n if (isFormInteractionTrackingEnabled(this.config.defaultTracking)) {\n await this.add(formInteractionTracking()).promise;\n }\n\n // Add web attribution plugin\n if (isAttributionTrackingEnabled(this.config.defaultTracking)) {\n const attributionTrackingOptions = getAttributionTrackingConfig(this.config);\n const webAttribution = webAttributionPlugin(attributionTrackingOptions);\n await this.add(webAttribution).promise;\n }\n\n // Add page view plugin\n await this.add(pageViewTrackingPlugin(getPageViewTrackingConfig(this.config))).promise;\n\n this.initializing = false;\n\n // Step 6: Run queued dispatch functions\n await this.runQueuedFunctions('dispatchQ');\n\n // Step 7: Add the event receiver after running remaining queued functions.\n connector.eventBridge.setEventReceiver((event) => {\n void this.track(event.eventType, event.eventProperties);\n });\n }\n\n getUserId() {\n return this.config?.userId;\n }\n\n setUserId(userId: string | undefined) {\n if (!this.config) {\n this.q.push(this.setUserId.bind(this, userId));\n return;\n }\n if (userId !== this.config.userId || userId === undefined) {\n this.config.userId = userId;\n setConnectorUserId(userId, this.config.instanceName);\n }\n }\n\n getDeviceId() {\n return this.config?.deviceId;\n }\n\n setDeviceId(deviceId: string) {\n if (!this.config) {\n this.q.push(this.setDeviceId.bind(this, deviceId));\n return;\n }\n this.config.deviceId = deviceId;\n setConnectorDeviceId(deviceId, this.config.instanceName);\n }\n\n reset() {\n this.setDeviceId(UUID());\n this.setUserId(undefined);\n }\n\n getSessionId() {\n return this.config?.sessionId;\n }\n\n setSessionId(sessionId: number) {\n if (!this.config) {\n this.q.push(this.setSessionId.bind(this, sessionId));\n return;\n }\n\n // Prevents starting a new session with the same session ID\n if (sessionId === this.config.sessionId) {\n return;\n }\n\n const previousSessionId = this.getSessionId();\n const lastEventTime = this.config.lastEventTime;\n let lastEventId = this.config.lastEventId ?? -1;\n\n this.config.sessionId = sessionId;\n this.config.lastEventTime = undefined;\n\n if (isSessionTrackingEnabled(this.config.defaultTracking)) {\n if (previousSessionId && lastEventTime) {\n this.track(DEFAULT_SESSION_END_EVENT, undefined, {\n device_id: this.previousSessionDeviceId,\n event_id: ++lastEventId,\n session_id: previousSessionId,\n time: lastEventTime + 1,\n user_id: this.previousSessionUserId,\n });\n }\n\n this.config.lastEventTime = this.config.sessionId;\n this.track(DEFAULT_SESSION_START_EVENT, undefined, {\n event_id: ++lastEventId,\n session_id: this.config.sessionId,\n time: this.config.lastEventTime,\n });\n }\n\n this.previousSessionDeviceId = this.config.deviceId;\n this.previousSessionUserId = this.config.userId;\n }\n\n extendSession() {\n if (!this.config) {\n this.q.push(this.extendSession.bind(this));\n return;\n }\n this.config.lastEventTime = Date.now();\n }\n\n setTransport(transport: TransportType) {\n if (!this.config) {\n this.q.push(this.setTransport.bind(this, transport));\n return;\n }\n this.config.transportProvider = createTransport(transport);\n }\n\n identify(identify: IIdentify, eventOptions?: EventOptions) {\n if (isInstanceProxy(identify)) {\n const queue = identify._q;\n identify._q = [];\n identify = convertProxyObjectToRealObject(new Identify(), queue);\n }\n if (eventOptions?.user_id) {\n this.setUserId(eventOptions.user_id);\n }\n if (eventOptions?.device_id) {\n this.setDeviceId(eventOptions.device_id);\n }\n return super.identify(identify, eventOptions);\n }\n\n groupIdentify(groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions) {\n if (isInstanceProxy(identify)) {\n const queue = identify._q;\n identify._q = [];\n identify = convertProxyObjectToRealObject(new Identify(), queue);\n }\n return super.groupIdentify(groupType, groupName, identify, eventOptions);\n }\n\n revenue(revenue: IRevenue, eventOptions?: EventOptions) {\n if (isInstanceProxy(revenue)) {\n const queue = revenue._q;\n revenue._q = [];\n revenue = convertProxyObjectToRealObject(new Revenue(), queue);\n }\n return super.revenue(revenue, eventOptions);\n }\n\n async process(event: Event) {\n const currentTime = Date.now();\n const lastEventTime = this.config.lastEventTime || Date.now();\n const timeSinceLastEvent = currentTime - lastEventTime;\n\n if (\n event.event_type !== DEFAULT_SESSION_START_EVENT &&\n event.event_type !== DEFAULT_SESSION_END_EVENT &&\n (!event.session_id || event.session_id === this.getSessionId()) &&\n timeSinceLastEvent > this.config.sessionTimeout\n ) {\n this.setSessionId(currentTime);\n }\n\n return super.process(event);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"browser-client.js","sourceRoot":"","sources":["../../src/browser-client.ts"],"names":[],"mappings":";;;AAAA,4DAA+G;AAC/G,8EAW4C;AAW5C,yDAAyF;AACzF,6CAA4C;AAC5C,mCAA6D;AAC7D,4FAAiF;AACjF,kGAAsF;AACtF,iFAA8E;AAC9E,2EAAwE;AACxE,yCAAqF;AACrF,uDAA+C;AAE/C;IAAsC,4CAAa;IAAnD;;IAyOA,CAAC;IAlOC,+BAAI,GAAJ,UAAK,MAAW,EAAE,eAAyC,EAAE,YAA6B;QAArF,uBAAA,EAAA,WAAW;QACd,IAAI,MAA0B,CAAC;QAC/B,IAAI,OAAmC,CAAC;QAExC,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACxB,MAAM,GAAG,eAAqC,CAAC;YAC/C,OAAO,GAAG,YAAY,CAAC;SACxB;aAAM;YACL,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE;gBACvC,MAAM,GAAG,eAAe,CAAC;gBACzB,OAAO,GAAG,SAAS,CAAC;aACrB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gBACzB,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;gBACxD,kBAAkB,GAAG,WAAW,GAAG,aAAa,CAAC;gBAEvD,IACE,KAAK,CAAC,UAAU,KAAK,uCAA2B;oBAChD,KAAK,CAAC,UAAU,KAAK,qCAAyB;oBAC9C,CAAC,CAAC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC,YAAY,EAAE,CAAC;oBAC/D,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,EAC/C;oBACA,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;iBAChC;gBAED,sBAAO,iBAAM,OAAO,YAAC,KAAK,CAAC,EAAC;;;KAC7B;IACH,uBAAC;AAAD,CAAC,AAzOD,CAAsC,8BAAa,GAyOlD;AAzOY,4CAAgB","sourcesContent":["import { AmplitudeCore, Destination, Identify, returnWrapper, Revenue, UUID } from '@amplitude/analytics-core';\nimport {\n getAnalyticsConnector,\n getAttributionTrackingConfig,\n getPageViewTrackingConfig,\n IdentityEventSender,\n isAttributionTrackingEnabled,\n isSessionTrackingEnabled,\n isFileDownloadTrackingEnabled,\n isFormInteractionTrackingEnabled,\n setConnectorDeviceId,\n setConnectorUserId,\n} from '@amplitude/analytics-client-common';\nimport {\n BrowserClient,\n BrowserConfig,\n BrowserOptions,\n Event,\n EventOptions,\n Identify as IIdentify,\n Revenue as IRevenue,\n TransportType,\n} from '@amplitude/analytics-types';\nimport { convertProxyObjectToRealObject, isInstanceProxy } from './utils/snippet-helper';\nimport { Context } from './plugins/context';\nimport { useBrowserConfig, createTransport } from './config';\nimport { webAttributionPlugin } from '@amplitude/plugin-web-attribution-browser';\nimport { pageViewTrackingPlugin } from '@amplitude/plugin-page-view-tracking-browser';\nimport { formInteractionTracking } from './plugins/form-interaction-tracking';\nimport { fileDownloadTracking } from './plugins/file-download-tracking';\nimport { DEFAULT_SESSION_END_EVENT, DEFAULT_SESSION_START_EVENT } from './constants';\nimport { detNotify } from './det-notification';\n\nexport class AmplitudeBrowser extends AmplitudeCore implements BrowserClient {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: BrowserConfig;\n previousSessionDeviceId: string | undefined;\n previousSessionUserId: string | undefined;\n\n init(apiKey = '', userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions) {\n let userId: string | undefined;\n let options: BrowserOptions | undefined;\n\n if (arguments.length > 2) {\n userId = userIdOrOptions as string | undefined;\n options = maybeOptions;\n } else {\n if (typeof userIdOrOptions === 'string') {\n userId = userIdOrOptions;\n options = undefined;\n } else {\n userId = userIdOrOptions?.userId;\n options = userIdOrOptions;\n }\n }\n return returnWrapper(this._init({ ...options, userId, apiKey }));\n }\n protected async _init(options: BrowserOptions & { apiKey: string }) {\n // Step 1: Block concurrent initialization\n if (this.initializing) {\n return;\n }\n this.initializing = true;\n\n // Step 2: Create browser config\n const browserOptions = await useBrowserConfig(options.apiKey, options, this);\n await super._init(browserOptions);\n\n // Step 3: Set session ID\n // Priority 1: `options.sessionId`\n // Priority 2: last known sessionId from user identity storage\n // Default: `Date.now()`\n // Session ID is handled differently than device ID and user ID due to session events\n this.setSessionId(options.sessionId ?? this.config.sessionId ?? Date.now());\n\n // Set up the analytics connector to integrate with the experiment SDK.\n // Send events from the experiment SDK and forward identifies to the\n // identity store.\n const connector = getAnalyticsConnector(options.instanceName);\n connector.identityStore.setIdentity({\n userId: this.config.userId,\n deviceId: this.config.deviceId,\n });\n\n // Step 4: Install plugins\n // Do not track any events before this\n await this.add(new Destination()).promise;\n await this.add(new Context()).promise;\n await this.add(new IdentityEventSender()).promise;\n\n // Notify if DET is enabled\n detNotify(this.config);\n\n if (isFileDownloadTrackingEnabled(this.config.defaultTracking)) {\n await this.add(fileDownloadTracking()).promise;\n }\n\n if (isFormInteractionTrackingEnabled(this.config.defaultTracking)) {\n await this.add(formInteractionTracking()).promise;\n }\n\n // Add web attribution plugin\n if (isAttributionTrackingEnabled(this.config.defaultTracking)) {\n const attributionTrackingOptions = getAttributionTrackingConfig(this.config);\n const webAttribution = webAttributionPlugin(attributionTrackingOptions);\n await this.add(webAttribution).promise;\n }\n\n // Add page view plugin\n await this.add(pageViewTrackingPlugin(getPageViewTrackingConfig(this.config))).promise;\n\n this.initializing = false;\n\n // Step 6: Run queued dispatch functions\n await this.runQueuedFunctions('dispatchQ');\n\n // Step 7: Add the event receiver after running remaining queued functions.\n connector.eventBridge.setEventReceiver((event) => {\n void this.track(event.eventType, event.eventProperties);\n });\n }\n\n getUserId() {\n return this.config?.userId;\n }\n\n setUserId(userId: string | undefined) {\n if (!this.config) {\n this.q.push(this.setUserId.bind(this, userId));\n return;\n }\n if (userId !== this.config.userId || userId === undefined) {\n this.config.userId = userId;\n setConnectorUserId(userId, this.config.instanceName);\n }\n }\n\n getDeviceId() {\n return this.config?.deviceId;\n }\n\n setDeviceId(deviceId: string) {\n if (!this.config) {\n this.q.push(this.setDeviceId.bind(this, deviceId));\n return;\n }\n this.config.deviceId = deviceId;\n setConnectorDeviceId(deviceId, this.config.instanceName);\n }\n\n reset() {\n this.setDeviceId(UUID());\n this.setUserId(undefined);\n }\n\n getSessionId() {\n return this.config?.sessionId;\n }\n\n setSessionId(sessionId: number) {\n if (!this.config) {\n this.q.push(this.setSessionId.bind(this, sessionId));\n return;\n }\n\n // Prevents starting a new session with the same session ID\n if (sessionId === this.config.sessionId) {\n return;\n }\n\n const previousSessionId = this.getSessionId();\n const lastEventTime = this.config.lastEventTime;\n let lastEventId = this.config.lastEventId ?? -1;\n\n this.config.sessionId = sessionId;\n this.config.lastEventTime = undefined;\n\n if (isSessionTrackingEnabled(this.config.defaultTracking)) {\n if (previousSessionId && lastEventTime) {\n this.track(DEFAULT_SESSION_END_EVENT, undefined, {\n device_id: this.previousSessionDeviceId,\n event_id: ++lastEventId,\n session_id: previousSessionId,\n time: lastEventTime + 1,\n user_id: this.previousSessionUserId,\n });\n }\n\n this.config.lastEventTime = this.config.sessionId;\n this.track(DEFAULT_SESSION_START_EVENT, undefined, {\n event_id: ++lastEventId,\n session_id: this.config.sessionId,\n time: this.config.lastEventTime,\n });\n }\n\n this.previousSessionDeviceId = this.config.deviceId;\n this.previousSessionUserId = this.config.userId;\n }\n\n extendSession() {\n if (!this.config) {\n this.q.push(this.extendSession.bind(this));\n return;\n }\n this.config.lastEventTime = Date.now();\n }\n\n setTransport(transport: TransportType) {\n if (!this.config) {\n this.q.push(this.setTransport.bind(this, transport));\n return;\n }\n this.config.transportProvider = createTransport(transport);\n }\n\n identify(identify: IIdentify, eventOptions?: EventOptions) {\n if (isInstanceProxy(identify)) {\n const queue = identify._q;\n identify._q = [];\n identify = convertProxyObjectToRealObject(new Identify(), queue);\n }\n if (eventOptions?.user_id) {\n this.setUserId(eventOptions.user_id);\n }\n if (eventOptions?.device_id) {\n this.setDeviceId(eventOptions.device_id);\n }\n return super.identify(identify, eventOptions);\n }\n\n groupIdentify(groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions) {\n if (isInstanceProxy(identify)) {\n const queue = identify._q;\n identify._q = [];\n identify = convertProxyObjectToRealObject(new Identify(), queue);\n }\n return super.groupIdentify(groupType, groupName, identify, eventOptions);\n }\n\n revenue(revenue: IRevenue, eventOptions?: EventOptions) {\n if (isInstanceProxy(revenue)) {\n const queue = revenue._q;\n revenue._q = [];\n revenue = convertProxyObjectToRealObject(new Revenue(), queue);\n }\n return super.revenue(revenue, eventOptions);\n }\n\n async process(event: Event) {\n const currentTime = Date.now();\n const lastEventTime = this.config.lastEventTime || Date.now();\n const timeSinceLastEvent = currentTime - lastEventTime;\n\n if (\n event.event_type !== DEFAULT_SESSION_START_EVENT &&\n event.event_type !== DEFAULT_SESSION_END_EVENT &&\n (!event.session_id || event.session_id === this.getSessionId()) &&\n timeSinceLastEvent > this.config.sessionTimeout\n ) {\n this.setSessionId(currentTime);\n }\n\n return super.process(event);\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BrowserConfig } from '@amplitude/analytics-types';
|
|
2
|
+
export declare const detNotify: (config: BrowserConfig) => void;
|
|
3
|
+
/**
|
|
4
|
+
* @private
|
|
5
|
+
* This function is meant for testing purposes only
|
|
6
|
+
*/
|
|
7
|
+
export declare const resetNotify: () => void;
|
|
8
|
+
//# sourceMappingURL=det-notification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"det-notification.d.ts","sourceRoot":"","sources":["../../src/det-notification.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAY,MAAM,4BAA4B,CAAC;AAIrE,eAAO,MAAM,SAAS,WAAY,aAAa,KAAG,IAsBjD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,YAEvB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.resetNotify = exports.detNotify = void 0;
|
|
3
|
+
var analytics_client_common_1 = require("@amplitude/analytics-client-common");
|
|
4
|
+
var analytics_types_1 = require("@amplitude/analytics-types");
|
|
5
|
+
var notified = false;
|
|
6
|
+
var detNotify = function (config) {
|
|
7
|
+
if (notified) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
var enabledTracking = [
|
|
11
|
+
(0, analytics_client_common_1.isPageViewTrackingEnabled)(config.defaultTracking) ? 'Page Views' : '',
|
|
12
|
+
(0, analytics_client_common_1.isSessionTrackingEnabled)(config.defaultTracking) ? 'Sessions' : '',
|
|
13
|
+
(0, analytics_client_common_1.isFileDownloadTrackingEnabled)(config.defaultTracking) ? 'File Downloads' : '',
|
|
14
|
+
(0, analytics_client_common_1.isFormInteractionTrackingEnabled)(config.defaultTracking) ? 'Form Interactions' : '',
|
|
15
|
+
].filter(Boolean);
|
|
16
|
+
var enabledTrackingString = enabledTracking.join(', ');
|
|
17
|
+
if (enabledTracking.length) {
|
|
18
|
+
var message = "Your Amplitude instance is configured to track ".concat(enabledTrackingString, ". Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.");
|
|
19
|
+
config.loggerProvider.log(message);
|
|
20
|
+
/* istanbul ignore if */
|
|
21
|
+
if (config.logLevel < analytics_types_1.LogLevel.Verbose) {
|
|
22
|
+
console.log(message);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
notified = true;
|
|
26
|
+
};
|
|
27
|
+
exports.detNotify = detNotify;
|
|
28
|
+
/**
|
|
29
|
+
* @private
|
|
30
|
+
* This function is meant for testing purposes only
|
|
31
|
+
*/
|
|
32
|
+
var resetNotify = function () {
|
|
33
|
+
notified = false;
|
|
34
|
+
};
|
|
35
|
+
exports.resetNotify = resetNotify;
|
|
36
|
+
//# sourceMappingURL=det-notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"det-notification.js","sourceRoot":"","sources":["../../src/det-notification.ts"],"names":[],"mappings":";;AAAA,8EAK4C;AAC5C,8DAAqE;AAErE,IAAI,QAAQ,GAAG,KAAK,CAAC;AAEd,IAAM,SAAS,GAAG,UAAC,MAAqB;IAC7C,IAAI,QAAQ,EAAE;QACZ,OAAO;KACR;IAED,IAAM,eAAe,GAAG;QACtB,IAAA,mDAAyB,EAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE;QACrE,IAAA,kDAAwB,EAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;QAClE,IAAA,uDAA6B,EAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE;QAC7E,IAAA,0DAAgC,EAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE;KACpF,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAClB,IAAM,qBAAqB,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEzD,IAAI,eAAe,CAAC,MAAM,EAAE;QAC1B,IAAM,OAAO,GAAG,yDAAkD,qBAAqB,qHAAkH,CAAC;QAC1M,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACnC,wBAAwB;QACxB,IAAI,MAAM,CAAC,QAAQ,GAAG,0BAAQ,CAAC,OAAO,EAAE;YACtC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;SACtB;KACF;IACD,QAAQ,GAAG,IAAI,CAAC;AAClB,CAAC,CAAC;AAtBW,QAAA,SAAS,aAsBpB;AAEF;;;GAGG;AACI,IAAM,WAAW,GAAG;IACzB,QAAQ,GAAG,KAAK,CAAC;AACnB,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB","sourcesContent":["import {\n isSessionTrackingEnabled,\n isFileDownloadTrackingEnabled,\n isFormInteractionTrackingEnabled,\n isPageViewTrackingEnabled,\n} from '@amplitude/analytics-client-common';\nimport { BrowserConfig, LogLevel } from '@amplitude/analytics-types';\n\nlet notified = false;\n\nexport const detNotify = (config: BrowserConfig): void => {\n if (notified) {\n return;\n }\n\n const enabledTracking = [\n isPageViewTrackingEnabled(config.defaultTracking) ? 'Page Views' : '',\n isSessionTrackingEnabled(config.defaultTracking) ? 'Sessions' : '',\n isFileDownloadTrackingEnabled(config.defaultTracking) ? 'File Downloads' : '',\n isFormInteractionTrackingEnabled(config.defaultTracking) ? 'Form Interactions' : '',\n ].filter(Boolean);\n const enabledTrackingString = enabledTracking.join(', ');\n\n if (enabledTracking.length) {\n const message = `Your Amplitude instance is configured to track ${enabledTrackingString}. Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.`;\n config.loggerProvider.log(message);\n /* istanbul ignore if */\n if (config.logLevel < LogLevel.Verbose) {\n console.log(message);\n }\n }\n notified = true;\n};\n\n/**\n * @private\n * This function is meant for testing purposes only\n */\nexport const resetNotify = () => {\n notified = false;\n};\n"]}
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createInstance } from './browser-client-factory';
|
|
2
|
-
export declare const add: (plugin: import("@amplitude/analytics-types").Plugin) => import("@amplitude/analytics-types").AmplitudeReturn<void>, extendSession: () => void, flush: () => import("@amplitude/analytics-types").AmplitudeReturn<void>, getDeviceId: () => string | undefined, getSessionId: () => number | undefined, getUserId: () => string | undefined, groupIdentify: (groupType: string, groupName: string | string[], identify: import("@amplitude/analytics-types").Identify, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, identify: (identify: import("@amplitude/analytics-types").Identify, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, init: {
|
|
2
|
+
export declare const add: (plugin: import("@amplitude/analytics-types").Plugin<import("@amplitude/analytics-types").BrowserClient, import("@amplitude/analytics-types").BrowserConfig>) => import("@amplitude/analytics-types").AmplitudeReturn<void>, extendSession: () => void, flush: () => import("@amplitude/analytics-types").AmplitudeReturn<void>, getDeviceId: () => string | undefined, getSessionId: () => number | undefined, getUserId: () => string | undefined, groupIdentify: (groupType: string, groupName: string | string[], identify: import("@amplitude/analytics-types").Identify, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, identify: (identify: import("@amplitude/analytics-types").Identify, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, init: {
|
|
3
3
|
(apiKey: string, options?: import("@amplitude/analytics-types").BrowserOptions | undefined): import("@amplitude/analytics-types").AmplitudeReturn<void>;
|
|
4
4
|
(apiKey: string, userId?: string | undefined, options?: import("@amplitude/analytics-types").BrowserOptions | undefined): import("@amplitude/analytics-types").AmplitudeReturn<void>;
|
|
5
5
|
}, logEvent: (eventInput: string | import("@amplitude/analytics-types").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, remove: (pluginName: string) => import("@amplitude/analytics-types").AmplitudeReturn<void>, reset: () => void, revenue: (revenue: import("@amplitude/analytics-types").Revenue, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, setDeviceId: (deviceId: string) => void, setGroup: (groupType: string, groupName: string | string[], eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, setOptOut: (optOut: boolean) => void, setSessionId: (sessionId: number) => void, setTransport: (transport: import("@amplitude/analytics-types").TransportType) => void, setUserId: (userId: string | undefined) => void, track: (eventInput: string | import("@amplitude/analytics-types").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>;
|
package/lib/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,eAAO,MACL,GAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,eAAO,MACL,GAAG,+NACH,aAAa,cACb,KAAK,oEACL,WAAW,4BACX,YAAY,4BACZ,SAAS,4BACT,aAAa,iSACb,QAAQ,gPACR,IAAI;;;GACJ,QAAQ,+SACR,MAAM,sFACN,KAAK,cACL,OAAO,8OACP,WAAW,8BACX,QAAQ,wOACR,SAAS,6BACT,YAAY,+BACZ,YAAY,2EACZ,SAAS,wCACT,KAAK,6SACG,CAAC;AACX,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC"}
|
package/lib/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.
|
|
1
|
+
export declare const VERSION = "2.0.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/cjs/version.js
CHANGED
package/lib/cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;AAAa,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '2.0.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;AAAa,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '2.0.1';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"det-notification.d.ts","sourceRoot":"","sources":["../../../src/__mocks__/det-notification.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,iBAAkB,CAAC;AAEzC,eAAO,MAAM,WAAW,iBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"det-notification.js","sourceRoot":"","sources":["../../../src/__mocks__/det-notification.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,SAAS,GAAG,cAAM,OAAA,SAAS,EAAT,CAAS,CAAC;AAEzC,MAAM,CAAC,IAAM,WAAW,GAAG,cAAM,OAAA,SAAS,EAAT,CAAS,CAAC","sourcesContent":["export const detNotify = () => undefined;\n\nexport const resetNotify = () => undefined;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-client.d.ts","sourceRoot":"","sources":["../../src/browser-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuD,MAAM,2BAA2B,CAAC;AAa/G,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,EACd,KAAK,EACL,YAAY,EACZ,QAAQ,IAAI,SAAS,EACrB,OAAO,IAAI,QAAQ,EACnB,aAAa,EACd,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"browser-client.d.ts","sourceRoot":"","sources":["../../src/browser-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuD,MAAM,2BAA2B,CAAC;AAa/G,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,EACd,KAAK,EACL,YAAY,EACZ,QAAQ,IAAI,SAAS,EACrB,OAAO,IAAI,QAAQ,EACnB,aAAa,EACd,MAAM,4BAA4B,CAAC;AAWpC,qBAAa,gBAAiB,SAAQ,aAAc,YAAW,aAAa;IAG1E,MAAM,EAAE,aAAa,CAAC;IACtB,uBAAuB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1C,IAAI,CAAC,MAAM,SAAK,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,cAAc,EAAE,YAAY,CAAC,EAAE,cAAc;cAkB1E,KAAK,CAAC,OAAO,EAAE,cAAc,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;IAiElE,SAAS;IAIT,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS;IAWpC,WAAW;IAIX,WAAW,CAAC,QAAQ,EAAE,MAAM;IAS5B,KAAK;IAKL,YAAY;IAIZ,YAAY,CAAC,SAAS,EAAE,MAAM;IAyC9B,aAAa;IAQb,YAAY,CAAC,SAAS,EAAE,aAAa;IAQrC,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE,YAAY,CAAC,EAAE,YAAY;IAezD,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,CAAC,EAAE,YAAY;IAS/G,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAE,YAAY;IAShD,OAAO,CAAC,KAAK,EAAE,KAAK;CAgB3B"}
|
|
@@ -9,6 +9,7 @@ import { pageViewTrackingPlugin } from '@amplitude/plugin-page-view-tracking-bro
|
|
|
9
9
|
import { formInteractionTracking } from './plugins/form-interaction-tracking';
|
|
10
10
|
import { fileDownloadTracking } from './plugins/file-download-tracking';
|
|
11
11
|
import { DEFAULT_SESSION_END_EVENT, DEFAULT_SESSION_START_EVENT } from './constants';
|
|
12
|
+
import { detNotify } from './det-notification';
|
|
12
13
|
var AmplitudeBrowser = /** @class */ (function (_super) {
|
|
13
14
|
__extends(AmplitudeBrowser, _super);
|
|
14
15
|
function AmplitudeBrowser() {
|
|
@@ -77,6 +78,8 @@ var AmplitudeBrowser = /** @class */ (function (_super) {
|
|
|
77
78
|
return [4 /*yield*/, this.add(new IdentityEventSender()).promise];
|
|
78
79
|
case 5:
|
|
79
80
|
_c.sent();
|
|
81
|
+
// Notify if DET is enabled
|
|
82
|
+
detNotify(this.config);
|
|
80
83
|
if (!isFileDownloadTrackingEnabled(this.config.defaultTracking)) return [3 /*break*/, 7];
|
|
81
84
|
return [4 /*yield*/, this.add(fileDownloadTracking()).promise];
|
|
82
85
|
case 6:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-client.js","sourceRoot":"","sources":["../../src/browser-client.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,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AAY,CAAC,WAAW,CAAC,CAAC;iBAChC;gBAED,sBAAO,iBAAM,OAAO,YAAC,KAAK,CAAC,EAAC;;;KAC7B;IACH,uBAAC;AAAD,CAAC,AAtOD,CAAsC,aAAa,GAsOlD","sourcesContent":["import { AmplitudeCore, Destination, Identify, returnWrapper, Revenue, UUID } from '@amplitude/analytics-core';\nimport {\n getAnalyticsConnector,\n getAttributionTrackingConfig,\n getPageViewTrackingConfig,\n IdentityEventSender,\n isAttributionTrackingEnabled,\n isSessionTrackingEnabled,\n isFileDownloadTrackingEnabled,\n isFormInteractionTrackingEnabled,\n setConnectorDeviceId,\n setConnectorUserId,\n} from '@amplitude/analytics-client-common';\nimport {\n BrowserClient,\n BrowserConfig,\n BrowserOptions,\n Event,\n EventOptions,\n Identify as IIdentify,\n Revenue as IRevenue,\n TransportType,\n} from '@amplitude/analytics-types';\nimport { convertProxyObjectToRealObject, isInstanceProxy } from './utils/snippet-helper';\nimport { Context } from './plugins/context';\nimport { useBrowserConfig, createTransport } from './config';\nimport { webAttributionPlugin } from '@amplitude/plugin-web-attribution-browser';\nimport { pageViewTrackingPlugin } from '@amplitude/plugin-page-view-tracking-browser';\nimport { formInteractionTracking } from './plugins/form-interaction-tracking';\nimport { fileDownloadTracking } from './plugins/file-download-tracking';\nimport { DEFAULT_SESSION_END_EVENT, DEFAULT_SESSION_START_EVENT } from './constants';\n\nexport class AmplitudeBrowser extends AmplitudeCore implements BrowserClient {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: BrowserConfig;\n previousSessionDeviceId: string | undefined;\n previousSessionUserId: string | undefined;\n\n init(apiKey = '', userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions) {\n let userId: string | undefined;\n let options: BrowserOptions | undefined;\n\n if (arguments.length > 2) {\n userId = userIdOrOptions as string | undefined;\n options = maybeOptions;\n } else {\n if (typeof userIdOrOptions === 'string') {\n userId = userIdOrOptions;\n options = undefined;\n } else {\n userId = userIdOrOptions?.userId;\n options = userIdOrOptions;\n }\n }\n return returnWrapper(this._init({ ...options, userId, apiKey }));\n }\n protected async _init(options: BrowserOptions & { apiKey: string }) {\n // Step 1: Block concurrent initialization\n if (this.initializing) {\n return;\n }\n this.initializing = true;\n\n // Step 2: Create browser config\n const browserOptions = await useBrowserConfig(options.apiKey, options, this);\n await super._init(browserOptions);\n\n // Step 3: Set session ID\n // Priority 1: `options.sessionId`\n // Priority 2: last known sessionId from user identity storage\n // Default: `Date.now()`\n // Session ID is handled differently than device ID and user ID due to session events\n this.setSessionId(options.sessionId ?? this.config.sessionId ?? Date.now());\n\n // Set up the analytics connector to integrate with the experiment SDK.\n // Send events from the experiment SDK and forward identifies to the\n // identity store.\n const connector = getAnalyticsConnector(options.instanceName);\n connector.identityStore.setIdentity({\n userId: this.config.userId,\n deviceId: this.config.deviceId,\n });\n\n // Step 4: Install plugins\n // Do not track any events before this\n await this.add(new Destination()).promise;\n await this.add(new Context()).promise;\n await this.add(new IdentityEventSender()).promise;\n\n if (isFileDownloadTrackingEnabled(this.config.defaultTracking)) {\n await this.add(fileDownloadTracking()).promise;\n }\n\n if (isFormInteractionTrackingEnabled(this.config.defaultTracking)) {\n await this.add(formInteractionTracking()).promise;\n }\n\n // Add web attribution plugin\n if (isAttributionTrackingEnabled(this.config.defaultTracking)) {\n const attributionTrackingOptions = getAttributionTrackingConfig(this.config);\n const webAttribution = webAttributionPlugin(attributionTrackingOptions);\n await this.add(webAttribution).promise;\n }\n\n // Add page view plugin\n await this.add(pageViewTrackingPlugin(getPageViewTrackingConfig(this.config))).promise;\n\n this.initializing = false;\n\n // Step 6: Run queued dispatch functions\n await this.runQueuedFunctions('dispatchQ');\n\n // Step 7: Add the event receiver after running remaining queued functions.\n connector.eventBridge.setEventReceiver((event) => {\n void this.track(event.eventType, event.eventProperties);\n });\n }\n\n getUserId() {\n return this.config?.userId;\n }\n\n setUserId(userId: string | undefined) {\n if (!this.config) {\n this.q.push(this.setUserId.bind(this, userId));\n return;\n }\n if (userId !== this.config.userId || userId === undefined) {\n this.config.userId = userId;\n setConnectorUserId(userId, this.config.instanceName);\n }\n }\n\n getDeviceId() {\n return this.config?.deviceId;\n }\n\n setDeviceId(deviceId: string) {\n if (!this.config) {\n this.q.push(this.setDeviceId.bind(this, deviceId));\n return;\n }\n this.config.deviceId = deviceId;\n setConnectorDeviceId(deviceId, this.config.instanceName);\n }\n\n reset() {\n this.setDeviceId(UUID());\n this.setUserId(undefined);\n }\n\n getSessionId() {\n return this.config?.sessionId;\n }\n\n setSessionId(sessionId: number) {\n if (!this.config) {\n this.q.push(this.setSessionId.bind(this, sessionId));\n return;\n }\n\n // Prevents starting a new session with the same session ID\n if (sessionId === this.config.sessionId) {\n return;\n }\n\n const previousSessionId = this.getSessionId();\n const lastEventTime = this.config.lastEventTime;\n let lastEventId = this.config.lastEventId ?? -1;\n\n this.config.sessionId = sessionId;\n this.config.lastEventTime = undefined;\n\n if (isSessionTrackingEnabled(this.config.defaultTracking)) {\n if (previousSessionId && lastEventTime) {\n this.track(DEFAULT_SESSION_END_EVENT, undefined, {\n device_id: this.previousSessionDeviceId,\n event_id: ++lastEventId,\n session_id: previousSessionId,\n time: lastEventTime + 1,\n user_id: this.previousSessionUserId,\n });\n }\n\n this.config.lastEventTime = this.config.sessionId;\n this.track(DEFAULT_SESSION_START_EVENT, undefined, {\n event_id: ++lastEventId,\n session_id: this.config.sessionId,\n time: this.config.lastEventTime,\n });\n }\n\n this.previousSessionDeviceId = this.config.deviceId;\n this.previousSessionUserId = this.config.userId;\n }\n\n extendSession() {\n if (!this.config) {\n this.q.push(this.extendSession.bind(this));\n return;\n }\n this.config.lastEventTime = Date.now();\n }\n\n setTransport(transport: TransportType) {\n if (!this.config) {\n this.q.push(this.setTransport.bind(this, transport));\n return;\n }\n this.config.transportProvider = createTransport(transport);\n }\n\n identify(identify: IIdentify, eventOptions?: EventOptions) {\n if (isInstanceProxy(identify)) {\n const queue = identify._q;\n identify._q = [];\n identify = convertProxyObjectToRealObject(new Identify(), queue);\n }\n if (eventOptions?.user_id) {\n this.setUserId(eventOptions.user_id);\n }\n if (eventOptions?.device_id) {\n this.setDeviceId(eventOptions.device_id);\n }\n return super.identify(identify, eventOptions);\n }\n\n groupIdentify(groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions) {\n if (isInstanceProxy(identify)) {\n const queue = identify._q;\n identify._q = [];\n identify = convertProxyObjectToRealObject(new Identify(), queue);\n }\n return super.groupIdentify(groupType, groupName, identify, eventOptions);\n }\n\n revenue(revenue: IRevenue, eventOptions?: EventOptions) {\n if (isInstanceProxy(revenue)) {\n const queue = revenue._q;\n revenue._q = [];\n revenue = convertProxyObjectToRealObject(new Revenue(), queue);\n }\n return super.revenue(revenue, eventOptions);\n }\n\n async process(event: Event) {\n const currentTime = Date.now();\n const lastEventTime = this.config.lastEventTime || Date.now();\n const timeSinceLastEvent = currentTime - lastEventTime;\n\n if (\n event.event_type !== DEFAULT_SESSION_START_EVENT &&\n event.event_type !== DEFAULT_SESSION_END_EVENT &&\n (!event.session_id || event.session_id === this.getSessionId()) &&\n timeSinceLastEvent > this.config.sessionTimeout\n ) {\n this.setSessionId(currentTime);\n }\n\n return super.process(event);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"browser-client.js","sourceRoot":"","sources":["../../src/browser-client.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAC/G,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,yBAAyB,EACzB,mBAAmB,EACnB,4BAA4B,EAC5B,wBAAwB,EACxB,6BAA6B,EAC7B,gCAAgC,EAChC,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,oCAAoC,CAAC;AAW5C,OAAO,EAAE,8BAA8B,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,OAAO,EAAE,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, Destination, Identify, returnWrapper, Revenue, UUID } from '@amplitude/analytics-core';\nimport {\n getAnalyticsConnector,\n getAttributionTrackingConfig,\n getPageViewTrackingConfig,\n IdentityEventSender,\n isAttributionTrackingEnabled,\n isSessionTrackingEnabled,\n isFileDownloadTrackingEnabled,\n isFormInteractionTrackingEnabled,\n setConnectorDeviceId,\n setConnectorUserId,\n} from '@amplitude/analytics-client-common';\nimport {\n BrowserClient,\n BrowserConfig,\n BrowserOptions,\n Event,\n EventOptions,\n Identify as IIdentify,\n Revenue as IRevenue,\n TransportType,\n} from '@amplitude/analytics-types';\nimport { convertProxyObjectToRealObject, isInstanceProxy } from './utils/snippet-helper';\nimport { Context } from './plugins/context';\nimport { useBrowserConfig, createTransport } from './config';\nimport { webAttributionPlugin } from '@amplitude/plugin-web-attribution-browser';\nimport { pageViewTrackingPlugin } from '@amplitude/plugin-page-view-tracking-browser';\nimport { formInteractionTracking } from './plugins/form-interaction-tracking';\nimport { fileDownloadTracking } from './plugins/file-download-tracking';\nimport { DEFAULT_SESSION_END_EVENT, DEFAULT_SESSION_START_EVENT } from './constants';\nimport { detNotify } from './det-notification';\n\nexport class AmplitudeBrowser extends AmplitudeCore implements BrowserClient {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: BrowserConfig;\n previousSessionDeviceId: string | undefined;\n previousSessionUserId: string | undefined;\n\n init(apiKey = '', userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions) {\n let userId: string | undefined;\n let options: BrowserOptions | undefined;\n\n if (arguments.length > 2) {\n userId = userIdOrOptions as string | undefined;\n options = maybeOptions;\n } else {\n if (typeof userIdOrOptions === 'string') {\n userId = userIdOrOptions;\n options = undefined;\n } else {\n userId = userIdOrOptions?.userId;\n options = userIdOrOptions;\n }\n }\n return returnWrapper(this._init({ ...options, userId, apiKey }));\n }\n protected async _init(options: BrowserOptions & { apiKey: string }) {\n // Step 1: Block concurrent initialization\n if (this.initializing) {\n return;\n }\n this.initializing = true;\n\n // Step 2: Create browser config\n const browserOptions = await useBrowserConfig(options.apiKey, options, this);\n await super._init(browserOptions);\n\n // Step 3: Set session ID\n // Priority 1: `options.sessionId`\n // Priority 2: last known sessionId from user identity storage\n // Default: `Date.now()`\n // Session ID is handled differently than device ID and user ID due to session events\n this.setSessionId(options.sessionId ?? this.config.sessionId ?? Date.now());\n\n // Set up the analytics connector to integrate with the experiment SDK.\n // Send events from the experiment SDK and forward identifies to the\n // identity store.\n const connector = getAnalyticsConnector(options.instanceName);\n connector.identityStore.setIdentity({\n userId: this.config.userId,\n deviceId: this.config.deviceId,\n });\n\n // Step 4: Install plugins\n // Do not track any events before this\n await this.add(new Destination()).promise;\n await this.add(new Context()).promise;\n await this.add(new IdentityEventSender()).promise;\n\n // Notify if DET is enabled\n detNotify(this.config);\n\n if (isFileDownloadTrackingEnabled(this.config.defaultTracking)) {\n await this.add(fileDownloadTracking()).promise;\n }\n\n if (isFormInteractionTrackingEnabled(this.config.defaultTracking)) {\n await this.add(formInteractionTracking()).promise;\n }\n\n // Add web attribution plugin\n if (isAttributionTrackingEnabled(this.config.defaultTracking)) {\n const attributionTrackingOptions = getAttributionTrackingConfig(this.config);\n const webAttribution = webAttributionPlugin(attributionTrackingOptions);\n await this.add(webAttribution).promise;\n }\n\n // Add page view plugin\n await this.add(pageViewTrackingPlugin(getPageViewTrackingConfig(this.config))).promise;\n\n this.initializing = false;\n\n // Step 6: Run queued dispatch functions\n await this.runQueuedFunctions('dispatchQ');\n\n // Step 7: Add the event receiver after running remaining queued functions.\n connector.eventBridge.setEventReceiver((event) => {\n void this.track(event.eventType, event.eventProperties);\n });\n }\n\n getUserId() {\n return this.config?.userId;\n }\n\n setUserId(userId: string | undefined) {\n if (!this.config) {\n this.q.push(this.setUserId.bind(this, userId));\n return;\n }\n if (userId !== this.config.userId || userId === undefined) {\n this.config.userId = userId;\n setConnectorUserId(userId, this.config.instanceName);\n }\n }\n\n getDeviceId() {\n return this.config?.deviceId;\n }\n\n setDeviceId(deviceId: string) {\n if (!this.config) {\n this.q.push(this.setDeviceId.bind(this, deviceId));\n return;\n }\n this.config.deviceId = deviceId;\n setConnectorDeviceId(deviceId, this.config.instanceName);\n }\n\n reset() {\n this.setDeviceId(UUID());\n this.setUserId(undefined);\n }\n\n getSessionId() {\n return this.config?.sessionId;\n }\n\n setSessionId(sessionId: number) {\n if (!this.config) {\n this.q.push(this.setSessionId.bind(this, sessionId));\n return;\n }\n\n // Prevents starting a new session with the same session ID\n if (sessionId === this.config.sessionId) {\n return;\n }\n\n const previousSessionId = this.getSessionId();\n const lastEventTime = this.config.lastEventTime;\n let lastEventId = this.config.lastEventId ?? -1;\n\n this.config.sessionId = sessionId;\n this.config.lastEventTime = undefined;\n\n if (isSessionTrackingEnabled(this.config.defaultTracking)) {\n if (previousSessionId && lastEventTime) {\n this.track(DEFAULT_SESSION_END_EVENT, undefined, {\n device_id: this.previousSessionDeviceId,\n event_id: ++lastEventId,\n session_id: previousSessionId,\n time: lastEventTime + 1,\n user_id: this.previousSessionUserId,\n });\n }\n\n this.config.lastEventTime = this.config.sessionId;\n this.track(DEFAULT_SESSION_START_EVENT, undefined, {\n event_id: ++lastEventId,\n session_id: this.config.sessionId,\n time: this.config.lastEventTime,\n });\n }\n\n this.previousSessionDeviceId = this.config.deviceId;\n this.previousSessionUserId = this.config.userId;\n }\n\n extendSession() {\n if (!this.config) {\n this.q.push(this.extendSession.bind(this));\n return;\n }\n this.config.lastEventTime = Date.now();\n }\n\n setTransport(transport: TransportType) {\n if (!this.config) {\n this.q.push(this.setTransport.bind(this, transport));\n return;\n }\n this.config.transportProvider = createTransport(transport);\n }\n\n identify(identify: IIdentify, eventOptions?: EventOptions) {\n if (isInstanceProxy(identify)) {\n const queue = identify._q;\n identify._q = [];\n identify = convertProxyObjectToRealObject(new Identify(), queue);\n }\n if (eventOptions?.user_id) {\n this.setUserId(eventOptions.user_id);\n }\n if (eventOptions?.device_id) {\n this.setDeviceId(eventOptions.device_id);\n }\n return super.identify(identify, eventOptions);\n }\n\n groupIdentify(groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions) {\n if (isInstanceProxy(identify)) {\n const queue = identify._q;\n identify._q = [];\n identify = convertProxyObjectToRealObject(new Identify(), queue);\n }\n return super.groupIdentify(groupType, groupName, identify, eventOptions);\n }\n\n revenue(revenue: IRevenue, eventOptions?: EventOptions) {\n if (isInstanceProxy(revenue)) {\n const queue = revenue._q;\n revenue._q = [];\n revenue = convertProxyObjectToRealObject(new Revenue(), queue);\n }\n return super.revenue(revenue, eventOptions);\n }\n\n async process(event: Event) {\n const currentTime = Date.now();\n const lastEventTime = this.config.lastEventTime || Date.now();\n const timeSinceLastEvent = currentTime - lastEventTime;\n\n if (\n event.event_type !== DEFAULT_SESSION_START_EVENT &&\n event.event_type !== DEFAULT_SESSION_END_EVENT &&\n (!event.session_id || event.session_id === this.getSessionId()) &&\n timeSinceLastEvent > this.config.sessionTimeout\n ) {\n this.setSessionId(currentTime);\n }\n\n return super.process(event);\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BrowserConfig } from '@amplitude/analytics-types';
|
|
2
|
+
export declare const detNotify: (config: BrowserConfig) => void;
|
|
3
|
+
/**
|
|
4
|
+
* @private
|
|
5
|
+
* This function is meant for testing purposes only
|
|
6
|
+
*/
|
|
7
|
+
export declare const resetNotify: () => void;
|
|
8
|
+
//# sourceMappingURL=det-notification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"det-notification.d.ts","sourceRoot":"","sources":["../../src/det-notification.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAY,MAAM,4BAA4B,CAAC;AAIrE,eAAO,MAAM,SAAS,WAAY,aAAa,KAAG,IAsBjD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,YAEvB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { isSessionTrackingEnabled, isFileDownloadTrackingEnabled, isFormInteractionTrackingEnabled, isPageViewTrackingEnabled, } from '@amplitude/analytics-client-common';
|
|
2
|
+
import { LogLevel } from '@amplitude/analytics-types';
|
|
3
|
+
var notified = false;
|
|
4
|
+
export var detNotify = function (config) {
|
|
5
|
+
if (notified) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
var enabledTracking = [
|
|
9
|
+
isPageViewTrackingEnabled(config.defaultTracking) ? 'Page Views' : '',
|
|
10
|
+
isSessionTrackingEnabled(config.defaultTracking) ? 'Sessions' : '',
|
|
11
|
+
isFileDownloadTrackingEnabled(config.defaultTracking) ? 'File Downloads' : '',
|
|
12
|
+
isFormInteractionTrackingEnabled(config.defaultTracking) ? 'Form Interactions' : '',
|
|
13
|
+
].filter(Boolean);
|
|
14
|
+
var enabledTrackingString = enabledTracking.join(', ');
|
|
15
|
+
if (enabledTracking.length) {
|
|
16
|
+
var message = "Your Amplitude instance is configured to track ".concat(enabledTrackingString, ". Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.");
|
|
17
|
+
config.loggerProvider.log(message);
|
|
18
|
+
/* istanbul ignore if */
|
|
19
|
+
if (config.logLevel < LogLevel.Verbose) {
|
|
20
|
+
console.log(message);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
notified = true;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* @private
|
|
27
|
+
* This function is meant for testing purposes only
|
|
28
|
+
*/
|
|
29
|
+
export var resetNotify = function () {
|
|
30
|
+
notified = false;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=det-notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"det-notification.js","sourceRoot":"","sources":["../../src/det-notification.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,6BAA6B,EAC7B,gCAAgC,EAChC,yBAAyB,GAC1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAiB,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAErE,IAAI,QAAQ,GAAG,KAAK,CAAC;AAErB,MAAM,CAAC,IAAM,SAAS,GAAG,UAAC,MAAqB;IAC7C,IAAI,QAAQ,EAAE;QACZ,OAAO;KACR;IAED,IAAM,eAAe,GAAG;QACtB,yBAAyB,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE;QACrE,wBAAwB,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;QAClE,6BAA6B,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE;QAC7E,gCAAgC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE;KACpF,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAClB,IAAM,qBAAqB,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEzD,IAAI,eAAe,CAAC,MAAM,EAAE;QAC1B,IAAM,OAAO,GAAG,yDAAkD,qBAAqB,qHAAkH,CAAC;QAC1M,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACnC,wBAAwB;QACxB,IAAI,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,EAAE;YACtC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;SACtB;KACF;IACD,QAAQ,GAAG,IAAI,CAAC;AAClB,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,IAAM,WAAW,GAAG;IACzB,QAAQ,GAAG,KAAK,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import {\n isSessionTrackingEnabled,\n isFileDownloadTrackingEnabled,\n isFormInteractionTrackingEnabled,\n isPageViewTrackingEnabled,\n} from '@amplitude/analytics-client-common';\nimport { BrowserConfig, LogLevel } from '@amplitude/analytics-types';\n\nlet notified = false;\n\nexport const detNotify = (config: BrowserConfig): void => {\n if (notified) {\n return;\n }\n\n const enabledTracking = [\n isPageViewTrackingEnabled(config.defaultTracking) ? 'Page Views' : '',\n isSessionTrackingEnabled(config.defaultTracking) ? 'Sessions' : '',\n isFileDownloadTrackingEnabled(config.defaultTracking) ? 'File Downloads' : '',\n isFormInteractionTrackingEnabled(config.defaultTracking) ? 'Form Interactions' : '',\n ].filter(Boolean);\n const enabledTrackingString = enabledTracking.join(', ');\n\n if (enabledTracking.length) {\n const message = `Your Amplitude instance is configured to track ${enabledTrackingString}. Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.`;\n config.loggerProvider.log(message);\n /* istanbul ignore if */\n if (config.logLevel < LogLevel.Verbose) {\n console.log(message);\n }\n }\n notified = true;\n};\n\n/**\n * @private\n * This function is meant for testing purposes only\n */\nexport const resetNotify = () => {\n notified = false;\n};\n"]}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createInstance } from './browser-client-factory';
|
|
2
|
-
export declare const add: (plugin: import("@amplitude/analytics-types").Plugin) => import("@amplitude/analytics-types").AmplitudeReturn<void>, extendSession: () => void, flush: () => import("@amplitude/analytics-types").AmplitudeReturn<void>, getDeviceId: () => string | undefined, getSessionId: () => number | undefined, getUserId: () => string | undefined, groupIdentify: (groupType: string, groupName: string | string[], identify: import("@amplitude/analytics-types").Identify, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, identify: (identify: import("@amplitude/analytics-types").Identify, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, init: {
|
|
2
|
+
export declare const add: (plugin: import("@amplitude/analytics-types").Plugin<import("@amplitude/analytics-types").BrowserClient, import("@amplitude/analytics-types").BrowserConfig>) => import("@amplitude/analytics-types").AmplitudeReturn<void>, extendSession: () => void, flush: () => import("@amplitude/analytics-types").AmplitudeReturn<void>, getDeviceId: () => string | undefined, getSessionId: () => number | undefined, getUserId: () => string | undefined, groupIdentify: (groupType: string, groupName: string | string[], identify: import("@amplitude/analytics-types").Identify, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, identify: (identify: import("@amplitude/analytics-types").Identify, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, init: {
|
|
3
3
|
(apiKey: string, options?: import("@amplitude/analytics-types").BrowserOptions | undefined): import("@amplitude/analytics-types").AmplitudeReturn<void>;
|
|
4
4
|
(apiKey: string, userId?: string | undefined, options?: import("@amplitude/analytics-types").BrowserOptions | undefined): import("@amplitude/analytics-types").AmplitudeReturn<void>;
|
|
5
5
|
}, logEvent: (eventInput: string | import("@amplitude/analytics-types").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, remove: (pluginName: string) => import("@amplitude/analytics-types").AmplitudeReturn<void>, reset: () => void, revenue: (revenue: import("@amplitude/analytics-types").Revenue, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, setDeviceId: (deviceId: string) => void, setGroup: (groupType: string, groupName: string | string[], eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, setOptOut: (optOut: boolean) => void, setSessionId: (sessionId: number) => void, setTransport: (transport: import("@amplitude/analytics-types").TransportType) => void, setUserId: (userId: string | undefined) => void, track: (eventInput: string | import("@amplitude/analytics-types").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>;
|
package/lib/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,eAAO,MACL,GAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,eAAO,MACL,GAAG,+NACH,aAAa,cACb,KAAK,oEACL,WAAW,4BACX,YAAY,4BACZ,SAAS,4BACT,aAAa,iSACb,QAAQ,gPACR,IAAI;;;GACJ,QAAQ,+SACR,MAAM,sFACN,KAAK,cACL,OAAO,8OACP,WAAW,8BACX,QAAQ,wOACR,SAAS,6BACT,YAAY,+BACZ,YAAY,2EACZ,SAAS,wCACT,KAAK,6SACG,CAAC;AACX,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC"}
|
package/lib/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.
|
|
1
|
+
export declare const VERSION = "2.0.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var VERSION = '2.0.
|
|
1
|
+
export var VERSION = '2.0.1';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/lib/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '2.0.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '2.0.1';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"det-notification.d.ts","sourceRoot":"","sources":["../../../src/__mocks__/det-notification.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,iBAAkB,CAAC;AAEzC,eAAO,MAAM,WAAW,iBAAkB,CAAC"}
|