@aws-amplify/analytics 7.0.87 → 7.0.88-unstable.3ea1c8e.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.
@@ -30,8 +30,8 @@ class PageViewTracker {
30
30
  this.options = {
31
31
  appType: options?.appType ?? DEFAULT_APP_TYPE,
32
32
  attributes: options?.attributes ?? undefined,
33
- eventName: this.options?.eventName ?? DEFAULT_EVENT_NAME,
34
- urlProvider: this.options?.urlProvider ?? DEFAULT_URL_PROVIDER,
33
+ eventName: options?.eventName ?? DEFAULT_EVENT_NAME,
34
+ urlProvider: options?.urlProvider ?? DEFAULT_URL_PROVIDER,
35
35
  };
36
36
  // Configure SPA or MPA page view tracking
37
37
  if ((0, utils_1.isBrowser)()) {
@@ -1 +1 @@
1
- {"version":3,"file":"PageViewTracker.js","sources":["../../../src/trackers/PageViewTracker.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PageViewTracker = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst logger = new core_1.ConsoleLogger('PageViewTracker');\nconst DEFAULT_EVENT_NAME = 'pageView';\nconst DEFAULT_APP_TYPE = 'singlePage';\nconst DEFAULT_URL_PROVIDER = () => {\n return window.location.origin + window.location.pathname;\n};\nconst PREV_URL_STORAGE_KEY = 'aws-amplify-analytics-prevUrl';\nclass PageViewTracker {\n constructor(eventRecorder, options) {\n this.options = {};\n this.trackerActive = true;\n this.eventRecorder = eventRecorder;\n this.spaTrackingActive = false;\n this.handleLocationChange = this.handleLocationChange.bind(this);\n this.configure(eventRecorder, options);\n }\n configure(eventRecorder, options) {\n this.eventRecorder = eventRecorder;\n // Clean up any existing listeners\n this.cleanup();\n // Apply defaults\n this.options = {\n appType: options?.appType ?? DEFAULT_APP_TYPE,\n attributes: options?.attributes ?? undefined,\n eventName: this.options?.eventName ?? DEFAULT_EVENT_NAME,\n urlProvider: this.options?.urlProvider ?? DEFAULT_URL_PROVIDER,\n };\n // Configure SPA or MPA page view tracking\n if ((0, utils_1.isBrowser)()) {\n if (this.options.appType === 'singlePage') {\n this.setupSPATracking();\n }\n else {\n this.setupMPATracking();\n }\n this.trackerActive = true;\n }\n }\n cleanup() {\n // No-op if document listener is not active\n if (!this.trackerActive) {\n return;\n }\n // Clean up SPA page view listeners\n if (this.spaTrackingActive) {\n window.history.pushState = this.originalPushState;\n window.history.replaceState = this.originalReplaceState;\n this.pushStateProxy?.revoke();\n this.replaceStateProxy?.revoke();\n window.removeEventListener('popstate', this.handleLocationChange);\n this.spaTrackingActive = false;\n }\n }\n setupSPATracking() {\n if (!this.spaTrackingActive) {\n // Configure proxies on History APIs\n this.pushStateProxy = Proxy.revocable(window.history.pushState, {\n apply: (target, thisArg, args) => {\n target.apply(thisArg, args);\n this.handleLocationChange();\n },\n });\n this.replaceStateProxy = Proxy.revocable(window.history.replaceState, {\n apply: (target, thisArg, args) => {\n target.apply(thisArg, args);\n this.handleLocationChange();\n },\n });\n this.originalPushState = window.history.pushState;\n this.originalReplaceState = window.history.replaceState;\n window.history.pushState = this.pushStateProxy.proxy;\n window.history.replaceState = this.replaceStateProxy.proxy;\n window.addEventListener('popstate', this.handleLocationChange);\n sessionStorage.removeItem(PREV_URL_STORAGE_KEY);\n this.spaTrackingActive = true;\n }\n }\n setupMPATracking() {\n this.handleLocationChange();\n }\n handleLocationChange() {\n const currentUrl = this.options.urlProvider();\n const eventName = this.options.eventName || DEFAULT_EVENT_NAME;\n if (this.urlHasChanged()) {\n sessionStorage.setItem(PREV_URL_STORAGE_KEY, currentUrl);\n // Assemble attribute list\n const attributes = Object.assign({\n url: currentUrl,\n }, this.options.attributes);\n logger.debug('Recording automatically tracked page view event', {\n eventName,\n attributes,\n });\n this.eventRecorder(eventName, attributes);\n }\n }\n urlHasChanged() {\n const prevUrl = sessionStorage.getItem(PREV_URL_STORAGE_KEY);\n const currUrl = this.options.urlProvider();\n return currUrl !== prevUrl;\n }\n}\nexports.PageViewTracker = PageViewTracker;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,eAAe,GAAG,MAAM;AAChC,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,iBAAiB,CAAC;AAC1D,MAAM,kBAAkB,GAAG,UAAU;AACrC,MAAM,gBAAgB,GAAG,YAAY;AACrC,MAAM,oBAAoB,GAAG,MAAM;AACnC,IAAI,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ;AAC5D,CAAC;AACD,MAAM,oBAAoB,GAAG,+BAA+B;AAC5D,MAAM,eAAe,CAAC;AACtB,IAAI,WAAW,CAAC,aAAa,EAAE,OAAO,EAAE;AACxC,QAAQ,IAAI,CAAC,OAAO,GAAG,EAAE;AACzB,QAAQ,IAAI,CAAC,aAAa,GAAG,IAAI;AACjC,QAAQ,IAAI,CAAC,aAAa,GAAG,aAAa;AAC1C,QAAQ,IAAI,CAAC,iBAAiB,GAAG,KAAK;AACtC,QAAQ,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC;AACxE,QAAQ,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC;AAC9C,IAAI;AACJ,IAAI,SAAS,CAAC,aAAa,EAAE,OAAO,EAAE;AACtC,QAAQ,IAAI,CAAC,aAAa,GAAG,aAAa;AAC1C;AACA,QAAQ,IAAI,CAAC,OAAO,EAAE;AACtB;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MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;AACrD,QAAQ,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,kBAAkB;AACtE,QAAQ,IAAI,IAAI,CAAC,aAAa,EAAE,EAAE;AAClC,YAAY,cAAc,CAAC,OAAO,CAAC,oBAAoB,EAAE,UAAU,CAAC;AACpE;AACA,YAAY,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;AAC7C,gBAAgB,GAAG,EAAE,UAAU;AAC/B,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;AACvC,YAAY,MAAM,CAAC,KAAK,CAAC,iDAAiD,EAAE;AAC5E,gBAAgB,SAAS;AACzB,gBAAgB,UAAU;AAC1B,aAAa,CAAC;AACd,YAAY,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC;AACrD,QAAQ;AACR,IAAI;AACJ,IAAI,aAAa,GAAG;AACpB,QAAQ,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,oBAAoB,CAAC;AACpE,QAAQ,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;AAClD,QAAQ,OAAO,OAAO,KAAK,OAAO;AAClC,IAAI;AACJ;AACA,OAAO,CAAC,eAAe,GAAG,eAAe;;"}
1
+ {"version":3,"file":"PageViewTracker.js","sources":["../../../src/trackers/PageViewTracker.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PageViewTracker = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst logger = new core_1.ConsoleLogger('PageViewTracker');\nconst DEFAULT_EVENT_NAME = 'pageView';\nconst DEFAULT_APP_TYPE = 'singlePage';\nconst DEFAULT_URL_PROVIDER = () => {\n return window.location.origin + window.location.pathname;\n};\nconst PREV_URL_STORAGE_KEY = 'aws-amplify-analytics-prevUrl';\nclass PageViewTracker {\n constructor(eventRecorder, options) {\n this.options = {};\n this.trackerActive = true;\n this.eventRecorder = eventRecorder;\n this.spaTrackingActive = false;\n this.handleLocationChange = this.handleLocationChange.bind(this);\n this.configure(eventRecorder, options);\n }\n configure(eventRecorder, options) {\n this.eventRecorder = eventRecorder;\n // Clean up any existing listeners\n this.cleanup();\n // Apply defaults\n this.options = {\n appType: options?.appType ?? DEFAULT_APP_TYPE,\n attributes: options?.attributes ?? undefined,\n eventName: options?.eventName ?? DEFAULT_EVENT_NAME,\n urlProvider: options?.urlProvider ?? DEFAULT_URL_PROVIDER,\n };\n // Configure SPA or MPA page view tracking\n if ((0, utils_1.isBrowser)()) {\n if (this.options.appType === 'singlePage') {\n this.setupSPATracking();\n }\n else {\n this.setupMPATracking();\n }\n this.trackerActive = true;\n }\n }\n cleanup() {\n // No-op if document listener is not active\n if (!this.trackerActive) {\n return;\n }\n // Clean up SPA page view listeners\n if (this.spaTrackingActive) {\n window.history.pushState = this.originalPushState;\n window.history.replaceState = this.originalReplaceState;\n this.pushStateProxy?.revoke();\n this.replaceStateProxy?.revoke();\n window.removeEventListener('popstate', this.handleLocationChange);\n this.spaTrackingActive = false;\n }\n }\n setupSPATracking() {\n if (!this.spaTrackingActive) {\n // Configure proxies on History APIs\n this.pushStateProxy = Proxy.revocable(window.history.pushState, {\n apply: (target, thisArg, args) => {\n target.apply(thisArg, args);\n this.handleLocationChange();\n },\n });\n this.replaceStateProxy = Proxy.revocable(window.history.replaceState, {\n apply: (target, thisArg, args) => {\n target.apply(thisArg, args);\n this.handleLocationChange();\n },\n });\n this.originalPushState = window.history.pushState;\n this.originalReplaceState = window.history.replaceState;\n window.history.pushState = this.pushStateProxy.proxy;\n window.history.replaceState = this.replaceStateProxy.proxy;\n window.addEventListener('popstate', this.handleLocationChange);\n sessionStorage.removeItem(PREV_URL_STORAGE_KEY);\n this.spaTrackingActive = true;\n }\n }\n setupMPATracking() {\n this.handleLocationChange();\n }\n handleLocationChange() {\n const currentUrl = this.options.urlProvider();\n const eventName = this.options.eventName || DEFAULT_EVENT_NAME;\n if (this.urlHasChanged()) {\n sessionStorage.setItem(PREV_URL_STORAGE_KEY, currentUrl);\n // Assemble attribute list\n const attributes = Object.assign({\n url: currentUrl,\n }, this.options.attributes);\n logger.debug('Recording automatically tracked page view event', {\n eventName,\n attributes,\n });\n this.eventRecorder(eventName, attributes);\n }\n }\n urlHasChanged() {\n const prevUrl = sessionStorage.getItem(PREV_URL_STORAGE_KEY);\n const currUrl = this.options.urlProvider();\n return currUrl !== prevUrl;\n }\n}\nexports.PageViewTracker = PageViewTracker;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,eAAe,GAAG,MAAM;AAChC,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,iBAAiB,CAAC;AAC1D,MAAM,kBAAkB,GAAG,UAAU;AACrC,MAAM,gBAAgB,GAAG,YAAY;AACrC,MAAM,oBAAoB,GAAG,MAAM;AACnC,IAAI,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ;AAC5D,CAAC;AACD,MAAM,oBAAoB,GAAG,+BAA+B;AAC5D,MAAM,eAAe,CAAC;AACtB,IAAI,WAAW,CAAC,aAAa,EAAE,OAAO,EAAE;AACxC,QAAQ,IAAI,CAAC,OAAO,GAAG,EAAE;AACzB,QAAQ,IAAI,CAAC,aAAa,GAAG,IAAI;AACjC,QAAQ,IAAI,CAAC,aAAa,GAAG,aAAa;AAC1C,QAAQ,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YPE,
29
29
  attributes: options?.attributes ?? undefined,
30
- eventName: this.options?.eventName ?? DEFAULT_EVENT_NAME,
31
- urlProvider: this.options?.urlProvider ?? DEFAULT_URL_PROVIDER,
30
+ eventName: options?.eventName ?? DEFAULT_EVENT_NAME,
31
+ urlProvider: options?.urlProvider ?? DEFAULT_URL_PROVIDER,
32
32
  };
33
33
  // Configure SPA or MPA page view tracking
34
34
  if (isBrowser()) {
@@ -1 +1 @@
1
- {"version":3,"file":"PageViewTracker.mjs","sources":["../../../src/trackers/PageViewTracker.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from '@aws-amplify/core';\nimport { isBrowser } from '@aws-amplify/core/internals/utils';\nconst logger = new ConsoleLogger('PageViewTracker');\nconst DEFAULT_EVENT_NAME = 'pageView';\nconst DEFAULT_APP_TYPE = 'singlePage';\nconst DEFAULT_URL_PROVIDER = () => {\n return window.location.origin + window.location.pathname;\n};\nconst PREV_URL_STORAGE_KEY = 'aws-amplify-analytics-prevUrl';\nexport class PageViewTracker {\n constructor(eventRecorder, options) {\n this.options = {};\n this.trackerActive = true;\n this.eventRecorder = eventRecorder;\n this.spaTrackingActive = false;\n this.handleLocationChange = this.handleLocationChange.bind(this);\n this.configure(eventRecorder, options);\n }\n configure(eventRecorder, options) {\n this.eventRecorder = eventRecorder;\n // Clean up any existing listeners\n this.cleanup();\n // Apply defaults\n this.options = {\n appType: options?.appType ?? DEFAULT_APP_TYPE,\n attributes: options?.attributes ?? undefined,\n eventName: this.options?.eventName ?? DEFAULT_EVENT_NAME,\n urlProvider: this.options?.urlProvider ?? DEFAULT_URL_PROVIDER,\n };\n // Configure SPA or MPA page view tracking\n if (isBrowser()) {\n if (this.options.appType === 'singlePage') {\n this.setupSPATracking();\n }\n else {\n this.setupMPATracking();\n }\n this.trackerActive = true;\n }\n }\n cleanup() {\n // No-op if document listener is not active\n if (!this.trackerActive) {\n return;\n }\n // Clean up SPA page view listeners\n if (this.spaTrackingActive) {\n window.history.pushState = this.originalPushState;\n window.history.replaceState = this.originalReplaceState;\n this.pushStateProxy?.revoke();\n this.replaceStateProxy?.revoke();\n window.removeEventListener('popstate', this.handleLocationChange);\n this.spaTrackingActive = false;\n }\n }\n setupSPATracking() {\n if (!this.spaTrackingActive) {\n // Configure proxies on History APIs\n this.pushStateProxy = Proxy.revocable(window.history.pushState, {\n apply: (target, thisArg, args) => {\n target.apply(thisArg, args);\n this.handleLocationChange();\n },\n });\n this.replaceStateProxy = Proxy.revocable(window.history.replaceState, {\n apply: (target, thisArg, args) => {\n target.apply(thisArg, args);\n this.handleLocationChange();\n },\n });\n this.originalPushState = window.history.pushState;\n this.originalReplaceState = window.history.replaceState;\n window.history.pushState = this.pushStateProxy.proxy;\n window.history.replaceState = this.replaceStateProxy.proxy;\n window.addEventListener('popstate', this.handleLocationChange);\n sessionStorage.removeItem(PREV_URL_STORAGE_KEY);\n this.spaTrackingActive = true;\n }\n }\n setupMPATracking() {\n this.handleLocationChange();\n }\n handleLocationChange() {\n const currentUrl = this.options.urlProvider();\n const eventName = this.options.eventName || DEFAULT_EVENT_NAME;\n if (this.urlHasChanged()) {\n sessionStorage.setItem(PREV_URL_STORAGE_KEY, currentUrl);\n // Assemble attribute list\n const attributes = Object.assign({\n url: currentUrl,\n }, this.options.attributes);\n logger.debug('Recording automatically tracked page view event', {\n eventName,\n attributes,\n });\n this.eventRecorder(eventName, attributes);\n }\n }\n urlHasChanged() {\n const prevUrl = sessionStorage.getItem(PREV_URL_STORAGE_KEY);\n const currUrl = this.options.urlProvider();\n return currUrl !== prevUrl;\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,iBAAiB,CAAC;AACnD,MAAM,kBAAkB,GAAG,UAAU;AACrC,MAAM,gBAAgB,GAAG,YAAY;AACrC,MAAM,oBAAoB,GAAG,MAAM;AACnC,IAAI,OAAO,M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IAAI;AACJ,IAAI,aAAa,GAAG;AACpB,QAAQ,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,oBAAoB,CAAC;AACpE,QAAQ,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;AAClD,QAAQ,OAAO,OAAO,KAAK,OAAO;AAClC,IAAI;AACJ;;;;"}
1
+ {"version":3,"file":"PageViewTracker.mjs","sources":["../../../src/trackers/PageViewTracker.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from '@aws-amplify/core';\nimport { isBrowser } from '@aws-amplify/core/internals/utils';\nconst logger = new ConsoleLogger('PageViewTracker');\nconst DEFAULT_EVENT_NAME = 'pageView';\nconst DEFAULT_APP_TYPE = 'singlePage';\nconst DEFAULT_URL_PROVIDER = () => {\n return window.location.origin + window.location.pathname;\n};\nconst PREV_URL_STORAGE_KEY = 'aws-amplify-analytics-prevUrl';\nexport class PageViewTracker {\n constructor(eventRecorder, options) {\n this.options = {};\n this.trackerActive = true;\n this.eventRecorder = eventRecorder;\n this.spaTrackingActive = false;\n this.handleLocationChange = this.handleLocationChange.bind(this);\n this.configure(eventRecorder, options);\n }\n configure(eventRecorder, options) {\n this.eventRecorder = eventRecorder;\n // Clean up any existing listeners\n this.cleanup();\n // Apply defaults\n this.options = {\n appType: options?.appType ?? DEFAULT_APP_TYPE,\n attributes: options?.attributes ?? undefined,\n eventName: options?.eventName ?? DEFAULT_EVENT_NAME,\n urlProvider: options?.urlProvider ?? DEFAULT_URL_PROVIDER,\n };\n // Configure SPA or MPA page view tracking\n if (isBrowser()) {\n if (this.options.appType === 'singlePage') {\n this.setupSPATracking();\n }\n else {\n this.setupMPATracking();\n }\n this.trackerActive = true;\n }\n }\n cleanup() {\n // No-op if document listener is not active\n if (!this.trackerActive) {\n return;\n }\n // Clean up SPA page view listeners\n if (this.spaTrackingActive) {\n window.history.pushState = this.originalPushState;\n window.history.replaceState = this.originalReplaceState;\n this.pushStateProxy?.revoke();\n this.replaceStateProxy?.revoke();\n window.removeEventListener('popstate', this.handleLocationChange);\n this.spaTrackingActive = false;\n }\n }\n setupSPATracking() {\n if (!this.spaTrackingActive) {\n // Configure proxies on History APIs\n this.pushStateProxy = Proxy.revocable(window.history.pushState, {\n apply: (target, thisArg, args) => {\n target.apply(thisArg, args);\n this.handleLocationChange();\n },\n });\n this.replaceStateProxy = Proxy.revocable(window.history.replaceState, {\n apply: (target, thisArg, args) => {\n target.apply(thisArg, args);\n this.handleLocationChange();\n },\n });\n this.originalPushState = window.history.pushState;\n this.originalReplaceState = window.history.replaceState;\n window.history.pushState = this.pushStateProxy.proxy;\n window.history.replaceState = this.replaceStateProxy.proxy;\n window.addEventListener('popstate', this.handleLocationChange);\n sessionStorage.removeItem(PREV_URL_STORAGE_KEY);\n this.spaTrackingActive = true;\n }\n }\n setupMPATracking() {\n this.handleLocationChange();\n }\n handleLocationChange() {\n const currentUrl = this.options.urlProvider();\n const eventName = this.options.eventName || DEFAULT_EVENT_NAME;\n if (this.urlHasChanged()) {\n sessionStorage.setItem(PREV_URL_STORAGE_KEY, currentUrl);\n // Assemble attribute list\n const attributes = Object.assign({\n url: currentUrl,\n }, this.options.attributes);\n logger.debug('Recording automatically tracked page view event', {\n eventName,\n attributes,\n });\n this.eventRecorder(eventName, attributes);\n }\n }\n urlHasChanged() {\n const prevUrl = sessionStorage.getItem(PREV_URL_STORAGE_KEY);\n const currUrl = this.options.urlProvider();\n return currUrl !== prevUrl;\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,iBAAiB,CAAC;AACnD,MAAM,kBAAkB,GAAG,UAAU;AACrC,MAAM,gBAAgB,GAAG,YAAY;AACrC,MAAM,oBAAoB,GAAG,MAAM;AACnC,IAAI,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ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,CAAC,oBAAoB,CAAC;AACpE,QAAQ,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;AAClD,QAAQ,OAAO,OAAO,KAAK,OAAO;AAClC,IAAI;AACJ;;;;"}
package/package.json CHANGED
@@ -1,111 +1,111 @@
1
1
  {
2
- "name": "@aws-amplify/analytics",
3
- "version": "7.0.87",
4
- "description": "Analytics category of aws-amplify",
5
- "main": "./dist/cjs/index.js",
6
- "module": "./dist/esm/index.mjs",
7
- "react-native": "./dist/cjs/index.js",
8
- "typings": "./dist/esm/index.d.ts",
9
- "sideEffects": false,
10
- "publishConfig": {
11
- "access": "public"
12
- },
13
- "scripts": {
14
- "test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
15
- "build-with-test": "npm run clean && npm run test && npm run build",
16
- "build:umd": "webpack && webpack --config ./webpack.config.dev.js",
17
- "build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",
18
- "build:watch": "npm run build:esm-cjs -- --watch",
19
- "build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
20
- "clean": "npm run clean:size && rimraf dist lib lib-esm",
21
- "clean:size": "rimraf dual-publish-tmp tmp*",
22
- "format": "echo \"Not implemented\"",
23
- "lint": "eslint '**/*.{ts,tsx}' && npm run ts-coverage",
24
- "lint:fix": "eslint '**/*.{ts,tsx}' --fix",
25
- "ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 71.4"
26
- },
27
- "typesVersions": {
28
- ">=4.2": {
29
- "pinpoint": [
30
- "./dist/esm/providers/pinpoint/index.d.ts"
31
- ],
32
- "kinesis": [
33
- "./dist/esm/providers/kinesis/index.d.ts"
34
- ],
35
- "kinesis-firehose": [
36
- "./dist/esm/providers/kinesis-firehose/index.d.ts"
37
- ],
38
- "personalize": [
39
- "./dist/esm/providers/personalize/index.d.ts"
40
- ]
41
- }
42
- },
43
- "exports": {
44
- ".": {
45
- "react-native": "./dist/cjs/index.js",
46
- "types": "./dist/esm/index.d.ts",
47
- "import": "./dist/esm/index.mjs",
48
- "require": "./dist/cjs/index.js"
49
- },
50
- "./pinpoint": {
51
- "react-native": "./dist/cjs/providers/pinpoint/index.js",
52
- "types": "./dist/esm/providers/pinpoint/index.d.ts",
53
- "import": "./dist/esm/providers/pinpoint/index.mjs",
54
- "require": "./dist/cjs/providers/pinpoint/index.js"
55
- },
56
- "./kinesis": {
57
- "react-native": "./dist/cjs/providers/kinesis/index.js",
58
- "types": "./dist/esm/providers/kinesis/index.d.ts",
59
- "import": "./dist/esm/providers/kinesis/index.mjs",
60
- "require": "./dist/cjs/providers/kinesis/index.js"
61
- },
62
- "./kinesis-firehose": {
63
- "react-native": "./dist/cjs/providers/kinesis-firehose/index.js",
64
- "types": "./dist/esm/providers/kinesis-firehose/index.d.ts",
65
- "import": "./dist/esm/providers/kinesis-firehose/index.mjs",
66
- "require": "./dist/cjs/providers/kinesis-firehose/index.js"
67
- },
68
- "./personalize": {
69
- "react-native": "./dist/cjs/providers/personalize/index.js",
70
- "types": "./dist/esm/providers/personalize/index.d.ts",
71
- "import": "./dist/esm/providers/personalize/index.mjs",
72
- "require": "./dist/cjs/providers/personalize/index.js"
73
- },
74
- "./package.json": "./package.json"
75
- },
76
- "repository": {
77
- "type": "git",
78
- "url": "https://github.com/aws-amplify/amplify-js.git"
79
- },
80
- "author": "Amazon Web Services",
81
- "license": "Apache-2.0",
82
- "bugs": {
83
- "url": "https://github.com/aws/aws-amplify/issues"
84
- },
85
- "homepage": "https://aws-amplify.github.io/",
86
- "files": [
87
- "dist/cjs",
88
- "dist/esm",
89
- "src",
90
- "pinpoint",
91
- "kinesis",
92
- "kinesis-firehose",
93
- "personalize"
94
- ],
95
- "dependencies": {
96
- "@aws-sdk/client-firehose": "3.621.0",
97
- "@aws-sdk/client-kinesis": "3.621.0",
98
- "@aws-sdk/client-personalize-events": "3.621.0",
99
- "@smithy/util-utf8": "2.0.0",
100
- "tslib": "^2.5.0"
101
- },
102
- "peerDependencies": {
103
- "@aws-amplify/core": "^6.1.0"
104
- },
105
- "devDependencies": {
106
- "@aws-amplify/core": "6.13.2",
107
- "@aws-amplify/react-native": "1.1.10",
108
- "@aws-sdk/types": "3.398.0"
109
- },
110
- "gitHead": "21ebe0a1e6f009a419864ed8550d20a3528d8944"
2
+ "name": "@aws-amplify/analytics",
3
+ "version": "7.0.88-unstable.3ea1c8e.0+3ea1c8e",
4
+ "description": "Analytics category of aws-amplify",
5
+ "main": "./dist/cjs/index.js",
6
+ "module": "./dist/esm/index.mjs",
7
+ "react-native": "./dist/cjs/index.js",
8
+ "typings": "./dist/esm/index.d.ts",
9
+ "sideEffects": false,
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "scripts": {
14
+ "test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
15
+ "build-with-test": "npm run clean && npm run test && npm run build",
16
+ "build:umd": "webpack && webpack --config ./webpack.config.dev.js",
17
+ "build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",
18
+ "build:watch": "npm run build:esm-cjs -- --watch",
19
+ "build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
20
+ "clean": "npm run clean:size && rimraf dist lib lib-esm",
21
+ "clean:size": "rimraf dual-publish-tmp tmp*",
22
+ "format": "echo \"Not implemented\"",
23
+ "lint": "eslint '**/*.{ts,tsx}' && npm run ts-coverage",
24
+ "lint:fix": "eslint '**/*.{ts,tsx}' --fix",
25
+ "ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 71.4"
26
+ },
27
+ "typesVersions": {
28
+ ">=4.2": {
29
+ "pinpoint": [
30
+ "./dist/esm/providers/pinpoint/index.d.ts"
31
+ ],
32
+ "kinesis": [
33
+ "./dist/esm/providers/kinesis/index.d.ts"
34
+ ],
35
+ "kinesis-firehose": [
36
+ "./dist/esm/providers/kinesis-firehose/index.d.ts"
37
+ ],
38
+ "personalize": [
39
+ "./dist/esm/providers/personalize/index.d.ts"
40
+ ]
41
+ }
42
+ },
43
+ "exports": {
44
+ ".": {
45
+ "react-native": "./dist/cjs/index.js",
46
+ "types": "./dist/esm/index.d.ts",
47
+ "import": "./dist/esm/index.mjs",
48
+ "require": "./dist/cjs/index.js"
49
+ },
50
+ "./pinpoint": {
51
+ "react-native": "./dist/cjs/providers/pinpoint/index.js",
52
+ "types": "./dist/esm/providers/pinpoint/index.d.ts",
53
+ "import": "./dist/esm/providers/pinpoint/index.mjs",
54
+ "require": "./dist/cjs/providers/pinpoint/index.js"
55
+ },
56
+ "./kinesis": {
57
+ "react-native": "./dist/cjs/providers/kinesis/index.js",
58
+ "types": "./dist/esm/providers/kinesis/index.d.ts",
59
+ "import": "./dist/esm/providers/kinesis/index.mjs",
60
+ "require": "./dist/cjs/providers/kinesis/index.js"
61
+ },
62
+ "./kinesis-firehose": {
63
+ "react-native": "./dist/cjs/providers/kinesis-firehose/index.js",
64
+ "types": "./dist/esm/providers/kinesis-firehose/index.d.ts",
65
+ "import": "./dist/esm/providers/kinesis-firehose/index.mjs",
66
+ "require": "./dist/cjs/providers/kinesis-firehose/index.js"
67
+ },
68
+ "./personalize": {
69
+ "react-native": "./dist/cjs/providers/personalize/index.js",
70
+ "types": "./dist/esm/providers/personalize/index.d.ts",
71
+ "import": "./dist/esm/providers/personalize/index.mjs",
72
+ "require": "./dist/cjs/providers/personalize/index.js"
73
+ },
74
+ "./package.json": "./package.json"
75
+ },
76
+ "repository": {
77
+ "type": "git",
78
+ "url": "https://github.com/aws-amplify/amplify-js.git"
79
+ },
80
+ "author": "Amazon Web Services",
81
+ "license": "Apache-2.0",
82
+ "bugs": {
83
+ "url": "https://github.com/aws/aws-amplify/issues"
84
+ },
85
+ "homepage": "https://aws-amplify.github.io/",
86
+ "files": [
87
+ "dist/cjs",
88
+ "dist/esm",
89
+ "src",
90
+ "pinpoint",
91
+ "kinesis",
92
+ "kinesis-firehose",
93
+ "personalize"
94
+ ],
95
+ "dependencies": {
96
+ "@aws-sdk/client-firehose": "3.621.0",
97
+ "@aws-sdk/client-kinesis": "3.621.0",
98
+ "@aws-sdk/client-personalize-events": "3.621.0",
99
+ "@smithy/util-utf8": "2.0.0",
100
+ "tslib": "^2.5.0"
101
+ },
102
+ "peerDependencies": {
103
+ "@aws-amplify/core": "6.13.3-unstable.3ea1c8e.0+3ea1c8e"
104
+ },
105
+ "devDependencies": {
106
+ "@aws-amplify/core": "6.13.3-unstable.3ea1c8e.0+3ea1c8e",
107
+ "@aws-amplify/react-native": "1.1.11-unstable.3ea1c8e.0+3ea1c8e",
108
+ "@aws-sdk/types": "3.398.0"
109
+ },
110
+ "gitHead": "3ea1c8e75ce9b03be24803184d912f8f2dee87ad"
111
111
  }
@@ -57,8 +57,8 @@ export class PageViewTracker implements TrackerInterface {
57
57
  this.options = {
58
58
  appType: options?.appType ?? DEFAULT_APP_TYPE,
59
59
  attributes: options?.attributes ?? undefined,
60
- eventName: this.options?.eventName ?? DEFAULT_EVENT_NAME,
61
- urlProvider: this.options?.urlProvider ?? DEFAULT_URL_PROVIDER,
60
+ eventName: options?.eventName ?? DEFAULT_EVENT_NAME,
61
+ urlProvider: options?.urlProvider ?? DEFAULT_URL_PROVIDER,
62
62
  };
63
63
 
64
64
  // Configure SPA or MPA page view tracking