@amplitude/analytics-browser 2.22.0 → 2.22.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.
Files changed (35) hide show
  1. package/README.md +1 -1
  2. package/lib/cjs/config/joined-config.d.ts +28 -0
  3. package/lib/cjs/config/joined-config.d.ts.map +1 -1
  4. package/lib/cjs/config/joined-config.js +88 -4
  5. package/lib/cjs/config/joined-config.js.map +1 -1
  6. package/lib/cjs/config.d.ts +1 -1
  7. package/lib/cjs/version.d.ts +1 -1
  8. package/lib/cjs/version.js +1 -1
  9. package/lib/cjs/version.js.map +1 -1
  10. package/lib/esm/config/joined-config.d.ts +28 -0
  11. package/lib/esm/config/joined-config.d.ts.map +1 -1
  12. package/lib/esm/config/joined-config.js +86 -3
  13. package/lib/esm/config/joined-config.js.map +1 -1
  14. package/lib/esm/config.d.ts +1 -1
  15. package/lib/esm/version.d.ts +1 -1
  16. package/lib/esm/version.js +1 -1
  17. package/lib/esm/version.js.map +1 -1
  18. package/lib/scripts/amplitude-bookmarklet-snippet-min.js +1 -1
  19. package/lib/scripts/amplitude-bookmarklet.html +1 -1
  20. package/lib/scripts/amplitude-gtm-min.js +1 -1
  21. package/lib/scripts/amplitude-gtm-min.js.gz +0 -0
  22. package/lib/scripts/amplitude-gtm-min.js.map +1 -1
  23. package/lib/scripts/amplitude-gtm-snippet-min.js +1 -1
  24. package/lib/scripts/amplitude-min.js +1 -1
  25. package/lib/scripts/amplitude-min.js.gz +0 -0
  26. package/lib/scripts/amplitude-min.js.map +1 -1
  27. package/lib/scripts/amplitude-min.umd.js +1 -1
  28. package/lib/scripts/amplitude-min.umd.js.gz +0 -0
  29. package/lib/scripts/amplitude-snippet-instructions.html +1 -1
  30. package/lib/scripts/amplitude-snippet-min.js +1 -1
  31. package/lib/scripts/config/joined-config.d.ts +28 -0
  32. package/lib/scripts/config/joined-config.d.ts.map +1 -1
  33. package/lib/scripts/config.d.ts +1 -1
  34. package/lib/scripts/version.d.ts +1 -1
  35. package/package.json +7 -7
Binary file
@@ -1,5 +1,5 @@
1
1
  <script type="text/javascript">
2
- !function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=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,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))};!function(e,t,r){e._q.push({name:t,args:Array.prototype.slice.call(r,0)})}(e,t,Array.prototype.slice.call(arguments))}},i=function(e){for(var t=0;t<y.length;t++)o(e,y[t],!1);for(var r=0;r<m.length;r++)o(e,m[r],!0)};r.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-IUW8RjRN702gJvUVDSmYo1mlK5T6rvXQB7Naxm+l1aeYOyifGXytp09FVaoZPXhr",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/analytics-browser-2.22.0-min.js.gz",a.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var c=t.getElementsByTagName("script")[0];c.parentNode.insertBefore(a,c);for(var u=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)n(u,l[p]);r.Identify=u;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setReceipt","setReceiptSig","setCurrency","setEventProperties"],v=0;v<f.length;v++)n(d,f[v]);r.Revenue=d;var y=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],m=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(r),r.createInstance=function(e){return r._iq[e]={_q:[]},i(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}();
2
+ !function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=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,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))};!function(e,t,r){e._q.push({name:t,args:Array.prototype.slice.call(r,0)})}(e,t,Array.prototype.slice.call(arguments))}},i=function(e){for(var t=0;t<v.length;t++)o(e,v[t],!1);for(var r=0;r<g.length;r++)o(e,g[r],!0)};r.invoked=!0;var c=t.createElement("script");c.type="text/javascript",c.integrity="sha384-VDysG3y8O289yWNGGS5ESEU5j/t67M0RoQzTAd8C0RU6oep9uB64PVjIqHkX7O4N",c.crossOrigin="anonymous",c.async=!0,c.src="https://cdn.amplitude.com/libs/analytics-browser-2.22.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++)n(u,p[l]);r.Identify=u;for(var d=function(){return this._q=[],this},y=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setReceipt","setReceiptSig","setCurrency","setEventProperties"],f=0;f<y.length;f++)n(d,y[f]);r.Revenue=d;var v=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],g=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(r),r.createInstance=function(e){return r._iq[e]={_q:[]},i(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}();
3
3
 
4
4
  amplitude.init("<YOUR_API_KEY>");
5
5
  </script>
@@ -1 +1 @@
1
- !function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=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,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))};!function(e,t,r){e._q.push({name:t,args:Array.prototype.slice.call(r,0)})}(e,t,Array.prototype.slice.call(arguments))}},i=function(e){for(var t=0;t<y.length;t++)o(e,y[t],!1);for(var r=0;r<m.length;r++)o(e,m[r],!0)};r.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-IUW8RjRN702gJvUVDSmYo1mlK5T6rvXQB7Naxm+l1aeYOyifGXytp09FVaoZPXhr",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/analytics-browser-2.22.0-min.js.gz",a.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var c=t.getElementsByTagName("script")[0];c.parentNode.insertBefore(a,c);for(var u=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)n(u,l[p]);r.Identify=u;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setReceipt","setReceiptSig","setCurrency","setEventProperties"],v=0;v<f.length;v++)n(d,f[v]);r.Revenue=d;var y=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],m=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(r),r.createInstance=function(e){return r._iq[e]={_q:[]},i(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}();
1
+ !function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=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,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))};!function(e,t,r){e._q.push({name:t,args:Array.prototype.slice.call(r,0)})}(e,t,Array.prototype.slice.call(arguments))}},i=function(e){for(var t=0;t<v.length;t++)o(e,v[t],!1);for(var r=0;r<g.length;r++)o(e,g[r],!0)};r.invoked=!0;var c=t.createElement("script");c.type="text/javascript",c.integrity="sha384-VDysG3y8O289yWNGGS5ESEU5j/t67M0RoQzTAd8C0RU6oep9uB64PVjIqHkX7O4N",c.crossOrigin="anonymous",c.async=!0,c.src="https://cdn.amplitude.com/libs/analytics-browser-2.22.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++)n(u,p[l]);r.Identify=u;for(var d=function(){return this._q=[],this},y=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setReceipt","setReceiptSig","setCurrency","setEventProperties"],f=0;f<y.length;f++)n(d,y[f]);r.Revenue=d;var v=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],g=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(r),r.createInstance=function(e){return r._iq[e]={_q:[]},i(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}();
@@ -8,6 +8,34 @@ export interface ElementInteractionsOptionsRemoteConfig extends ElementInteracti
8
8
  */
9
9
  pageUrlAllowlistRegex?: string[];
10
10
  }
11
+ /**
12
+ * Performs a deep transformation of a remote config object so that
13
+ * it matches the expected schema of the local config.
14
+ *
15
+ * Specifically, it normalizes nested `enabled` flags into concise union types.
16
+ *
17
+ * ### Transformation Rules:
18
+ * - If an object has `enabled: true`, it is replaced by the same object without the `enabled` field.
19
+ * - If it has only `enabled: true`, it is replaced with `true`.
20
+ * - If it has `enabled: false`, it is replaced with `false` regardless of other fields.
21
+ *
22
+ * ### Examples:
23
+ * Input: { prop: { enabled: true, hello: 'world' }}
24
+ * Output: { prop: { hello: 'world' } }
25
+ *
26
+ * Input: { prop: { enabled: true }}
27
+ * Output: { prop: true }
28
+ *
29
+ * Input: { prop: { enabled: false, hello: 'world' }}
30
+ * Output: { prop: false }
31
+ *
32
+ * Input: { prop: { hello: 'world' }}
33
+ * Output: { prop: { hello: 'world' } } // No change
34
+ *
35
+ * @param config Remote config object to be transformed
36
+ * @returns Transformed config object compatible with local schema
37
+ */
38
+ export declare function translateRemoteConfigToLocal(config?: Record<string, any>): void;
11
39
  /**
12
40
  * Updates the browser config in place by applying remote configuration settings.
13
41
  * Primarily merges autocapture settings from the remote config into the browser config.
@@ -1 +1 @@
1
- {"version":3,"file":"joined-config.d.ts","sourceRoot":"","sources":["../../../src/config/joined-config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,KAAK,0BAA0B,EAC/B,aAAa,EACb,YAAY,EACb,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,8BAA+B,SAAQ,kBAAkB;IACxE,mBAAmB,CAAC,EAAE,OAAO,GAAG,sCAAsC,CAAC;CACxE;AACD,MAAM,WAAW,sCAAuC,SAAQ,0BAA0B;IACxF;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;CAClC;AAOD;;;;;;GAMG;AACH,wBAAgB,mCAAmC,CACjD,YAAY,EAAE,YAAY,GAAG,IAAI,EACjC,aAAa,EAAE,aAAa,GAC3B,IAAI,CAwFN"}
1
+ {"version":3,"file":"joined-config.d.ts","sourceRoot":"","sources":["../../../src/config/joined-config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,KAAK,0BAA0B,EAC/B,aAAa,EACb,YAAY,EACb,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,8BAA+B,SAAQ,kBAAkB;IACxE,mBAAmB,CAAC,EAAE,OAAO,GAAG,sCAAsC,CAAC;CACxE;AACD,MAAM,WAAW,sCAAuC,SAAQ,0BAA0B;IACxF;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;CAClC;AAOD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QA2CxE;AAED;;;;;;GAMG;AACH,wBAAgB,mCAAmC,CACjD,YAAY,EAAE,YAAY,GAAG,IAAI,EACjC,aAAa,EAAE,aAAa,GAC3B,IAAI,CA2FN"}
@@ -31,7 +31,7 @@ export declare class BrowserConfig extends Config implements IBrowserConfig {
31
31
  useBatch: boolean;
32
32
  fetchRemoteConfig: boolean;
33
33
  networkTrackingOptions?: NetworkTrackingOptions | undefined;
34
- readonly version = "2.22.0";
34
+ readonly version = "2.22.1";
35
35
  protected _cookieStorage: Storage<UserSession>;
36
36
  protected _deviceId?: string;
37
37
  protected _lastEventId?: number;
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.22.0";
1
+ export declare const VERSION = "2.22.1";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amplitude/analytics-browser",
3
- "version": "2.22.0",
3
+ "version": "2.22.1",
4
4
  "description": "Official Amplitude SDK for Web",
5
5
  "keywords": [
6
6
  "analytics",
@@ -47,12 +47,12 @@
47
47
  "url": "https://github.com/amplitude/Amplitude-TypeScript/issues"
48
48
  },
49
49
  "dependencies": {
50
- "@amplitude/analytics-core": "^2.20.0",
50
+ "@amplitude/analytics-core": "^2.20.1",
51
51
  "@amplitude/analytics-remote-config": "^0.4.0",
52
- "@amplitude/plugin-autocapture-browser": "^1.8.2",
53
- "@amplitude/plugin-network-capture-browser": "^1.4.3",
54
- "@amplitude/plugin-page-view-tracking-browser": "^2.3.38",
55
- "@amplitude/plugin-web-vitals-browser": "^0.1.0-beta.13",
52
+ "@amplitude/plugin-autocapture-browser": "^1.8.3",
53
+ "@amplitude/plugin-network-capture-browser": "^1.4.4",
54
+ "@amplitude/plugin-page-view-tracking-browser": "^2.3.39",
55
+ "@amplitude/plugin-web-vitals-browser": "^0.1.0-beta.14",
56
56
  "tslib": "^2.4.1"
57
57
  },
58
58
  "devDependencies": {
@@ -71,5 +71,5 @@
71
71
  "files": [
72
72
  "lib"
73
73
  ],
74
- "gitHead": "cb2be608bc3d8a45da74afe8ebe6ef0132c1db06"
74
+ "gitHead": "f8a56543f6156b759d4be1411573e216eb359e77"
75
75
  }