@amplitude/plugin-global-user-properties 1.2.39 → 1.2.41

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.
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  Object.defineProperty(exports, "__esModule", { value: true });
2
3
  exports.globalUserPropertiesPlugin = void 0;
3
4
  var tslib_1 = require("tslib");
@@ -1 +1 @@
1
- {"version":3,"file":"global-user-properties.js","sourceRoot":"","sources":["../../src/global-user-properties.ts"],"names":[],"mappings":";;;AAEA,qCAAmE;AAE5D,IAAM,0BAA0B,GAA+B,UAAU,OAAqB;IAA/B,iBA+BrE;IA/B+E,wBAAA,EAAA,YAAqB;IACnG,IAAM,MAAM,GAAqB;QAC/B,IAAI,EAAE,0CAA0C;QAChD,IAAI,EAAE,YAAY;QAElB,mGAAmG;QACnG,OAAO,EAAE,UAAO,KAAY;;;gBAC1B,IAAI,CAAC,IAAA,sBAAY,EAAC,KAAK,CAAC,IAAI,CAAC,IAAA,kCAAwB,EAAC,KAAK,CAAC,EAAE;oBAC5D,sBAAO,KAAK,EAAC;iBACd;gBAEG,oBAAoB,GAAG,KAAK,CAAC,eAAe,CAAC;gBACjD,IAAI,OAAO,CAAC,iBAAiB,IAAI,oBAAoB,EAAE;oBACrD,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;iBACxE;gBAED,IAAI,CAAC,oBAAoB,EAAE;oBACzB,sBAAO,KAAK,EAAC;iBACd;gBAED,KAAK,CAAC,sBAAsB,GAAG,oBAAoB,CAAC;gBAEpD,IAAI,CAAC,OAAO,CAAC,gCAAgC,EAAE;oBAC7C,OAAO,KAAK,CAAC,eAAe,CAAC;iBAC9B;gBAED,sBAAO,KAAK,EAAC;;aACd;KACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AA/BW,QAAA,0BAA0B,8BA+BrC","sourcesContent":["import { EnrichmentPlugin, Event } from '@amplitude/analytics-types';\nimport { GlobalUserPropertiesPlugin, Options } from './typings/global-user-properties';\nimport { isAmplitudeIdentifyEvent, isTrackEvent } from './helpers';\n\nexport const globalUserPropertiesPlugin: GlobalUserPropertiesPlugin = function (options: Options = {}) {\n const plugin: EnrichmentPlugin = {\n name: '@amplitude/plugin-global-user-properties',\n type: 'enrichment',\n\n /* Note: The promise is because of the interface, not because this has any asynchronous behavior */\n execute: async (event: Event): Promise<Event> => {\n if (!isTrackEvent(event) && !isAmplitudeIdentifyEvent(event)) {\n return event;\n }\n\n let globalUserProperties = event.user_properties;\n if (options.propertyTransform && globalUserProperties) {\n globalUserProperties = options.propertyTransform(globalUserProperties);\n }\n\n if (!globalUserProperties) {\n return event;\n }\n\n event.global_user_properties = globalUserProperties;\n\n if (!options.shouldKeepOriginalUserProperties) {\n delete event.user_properties;\n }\n\n return event;\n },\n };\n\n return plugin;\n};\n"]}
1
+ {"version":3,"file":"global-user-properties.js","sourceRoot":"","sources":["../../src/global-user-properties.ts"],"names":[],"mappings":";;;;AAEA,qCAAmE;AAE5D,IAAM,0BAA0B,GAA+B,UAAU,OAAqB;IAA/B,iBA+BrE;IA/B+E,wBAAA,EAAA,YAAqB;IACnG,IAAM,MAAM,GAAqB;QAC/B,IAAI,EAAE,0CAA0C;QAChD,IAAI,EAAE,YAAY;QAElB,mGAAmG;QACnG,OAAO,EAAE,UAAO,KAAY;;;gBAC1B,IAAI,CAAC,IAAA,sBAAY,EAAC,KAAK,CAAC,IAAI,CAAC,IAAA,kCAAwB,EAAC,KAAK,CAAC,EAAE;oBAC5D,sBAAO,KAAK,EAAC;iBACd;gBAEG,oBAAoB,GAAG,KAAK,CAAC,eAAe,CAAC;gBACjD,IAAI,OAAO,CAAC,iBAAiB,IAAI,oBAAoB,EAAE;oBACrD,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;iBACxE;gBAED,IAAI,CAAC,oBAAoB,EAAE;oBACzB,sBAAO,KAAK,EAAC;iBACd;gBAED,KAAK,CAAC,sBAAsB,GAAG,oBAAoB,CAAC;gBAEpD,IAAI,CAAC,OAAO,CAAC,gCAAgC,EAAE;oBAC7C,OAAO,KAAK,CAAC,eAAe,CAAC;iBAC9B;gBAED,sBAAO,KAAK,EAAC;;aACd;KACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AA/BW,QAAA,0BAA0B,8BA+BrC","sourcesContent":["import { EnrichmentPlugin, Event } from '@amplitude/analytics-types';\nimport { GlobalUserPropertiesPlugin, Options } from './typings/global-user-properties';\nimport { isAmplitudeIdentifyEvent, isTrackEvent } from './helpers';\n\nexport const globalUserPropertiesPlugin: GlobalUserPropertiesPlugin = function (options: Options = {}) {\n const plugin: EnrichmentPlugin = {\n name: '@amplitude/plugin-global-user-properties',\n type: 'enrichment',\n\n /* Note: The promise is because of the interface, not because this has any asynchronous behavior */\n execute: async (event: Event): Promise<Event> => {\n if (!isTrackEvent(event) && !isAmplitudeIdentifyEvent(event)) {\n return event;\n }\n\n let globalUserProperties = event.user_properties;\n if (options.propertyTransform && globalUserProperties) {\n globalUserProperties = options.propertyTransform(globalUserProperties);\n }\n\n if (!globalUserProperties) {\n return event;\n }\n\n event.global_user_properties = globalUserProperties;\n\n if (!options.shouldKeepOriginalUserProperties) {\n delete event.user_properties;\n }\n\n return event;\n },\n };\n\n return plugin;\n};\n"]}
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  Object.defineProperty(exports, "__esModule", { value: true });
2
3
  exports.isAmplitudeIdentifyEvent = exports.isTrackEvent = void 0;
3
4
  var analytics_types_1 = require("@amplitude/analytics-types");
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";;AAAA,8DAAgG;AAEhG,IAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,kCAAgB,CAAC,CAAC,CAAC;AAEjE,IAAM,YAAY,GAAG,UAAC,KAAY;IACvC,OAAO,CAAC,sBAAsB,CAAC,GAAG,CAAC,KAAK,CAAC,UAA8B,CAAC,CAAC;AAC3E,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEK,IAAM,wBAAwB,GAAG,UAAC,KAAY;IACnD,OAAO,KAAK,CAAC,UAAU,KAAK,kCAAgB,CAAC,QAAQ,CAAC;AACxD,CAAC,CAAC;AAFW,QAAA,wBAAwB,4BAEnC","sourcesContent":["import { Event, TrackEvent, SpecialEventType, IdentifyEvent } from '@amplitude/analytics-types';\n\nconst specialAmplitudeEvents = new Set(Object.values(SpecialEventType));\n\nexport const isTrackEvent = (event: Event): event is TrackEvent => {\n return !specialAmplitudeEvents.has(event.event_type as SpecialEventType);\n};\n\nexport const isAmplitudeIdentifyEvent = (event: Event): event is IdentifyEvent => {\n return event.event_type === SpecialEventType.IDENTIFY;\n};\n"]}
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";;;AAAA,8DAAgG;AAEhG,IAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,kCAAgB,CAAC,CAAC,CAAC;AAEjE,IAAM,YAAY,GAAG,UAAC,KAAY;IACvC,OAAO,CAAC,sBAAsB,CAAC,GAAG,CAAC,KAAK,CAAC,UAA8B,CAAC,CAAC;AAC3E,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEK,IAAM,wBAAwB,GAAG,UAAC,KAAY;IACnD,OAAO,KAAK,CAAC,UAAU,KAAK,kCAAgB,CAAC,QAAQ,CAAC;AACxD,CAAC,CAAC;AAFW,QAAA,wBAAwB,4BAEnC","sourcesContent":["import { Event, TrackEvent, SpecialEventType, IdentifyEvent } from '@amplitude/analytics-types';\n\nconst specialAmplitudeEvents = new Set(Object.values(SpecialEventType));\n\nexport const isTrackEvent = (event: Event): event is TrackEvent => {\n return !specialAmplitudeEvents.has(event.event_type as SpecialEventType);\n};\n\nexport const isAmplitudeIdentifyEvent = (event: Event): event is IdentifyEvent => {\n return event.event_type === SpecialEventType.IDENTIFY;\n};\n"]}
package/lib/cjs/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  Object.defineProperty(exports, "__esModule", { value: true });
2
3
  exports.plugin = exports.globalUserPropertiesPlugin = void 0;
3
4
  var global_user_properties_1 = require("./global-user-properties");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAAA,mEAAsE;AAA7D,oIAAA,0BAA0B,OAAA;AACnC,mEAAgF;AAAvE,gHAAA,0BAA0B,OAAU","sourcesContent":["export { globalUserPropertiesPlugin } from './global-user-properties';\nexport { globalUserPropertiesPlugin as plugin } from './global-user-properties';\nexport { GlobalUserPropertiesPlugin, Options } from './typings/global-user-properties';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,mEAAsE;AAA7D,oIAAA,0BAA0B,OAAA;AACnC,mEAAgF;AAAvE,gHAAA,0BAA0B,OAAU","sourcesContent":["export { globalUserPropertiesPlugin } from './global-user-properties';\nexport { globalUserPropertiesPlugin as plugin } from './global-user-properties';\nexport { GlobalUserPropertiesPlugin, Options } from './typings/global-user-properties';\n"]}
@@ -1,2 +1,3 @@
1
+ "use strict";
1
2
  Object.defineProperty(exports, "__esModule", { value: true });
2
3
  //# sourceMappingURL=global-user-properties.js.map
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).amplitude={})}(this,(function(e){"use strict";function n(e,n,t,r){return new(t||(t=Promise))((function(o,i){function u(e){try{l(r.next(e))}catch(e){i(e)}}function a(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(u,a)}l((r=r.apply(e,n||[])).next())}))}function t(e,n){var t,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(l){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(t=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=n.call(e,u)}catch(e){a=[6,e],r=0}finally{t=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var r,o,i;!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(r||(r={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE="$revenue"}(o||(o={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(i||(i={}));var u=new Set(Object.values(i)),a=function(e){var r=this;return void 0===e&&(e={}),{name:"@amplitude/plugin-global-user-properties",type:"enrichment",execute:function(o){return n(r,void 0,void 0,(function(){var n;return t(this,(function(t){return function(e){return!u.has(e.event_type)}(o)||function(e){return e.event_type===i.IDENTIFY}(o)?(n=o.user_properties,e.propertyTransform&&n&&(n=e.propertyTransform(n)),n?(o.global_user_properties=n,e.shouldKeepOriginalUserProperties||delete o.user_properties,[2,o]):[2,o]):[2,o]}))}))}}};e.globalUserPropertiesPlugin=a,e.plugin=a,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).amplitude={})}(this,(function(e){"use strict";function n(e,n,t,r){return new(t||(t=Promise))((function(o,u){function i(e){try{l(r.next(e))}catch(e){u(e)}}function a(e){try{l(r.throw(e))}catch(e){u(e)}}function l(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,a)}l((r=r.apply(e,n||[])).next())}))}function t(e,n){var t,r,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function a(a){return function(l){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;u&&(u=0,a[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=n.call(e,i)}catch(e){a=[6,e],r=0}finally{t=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var r,o,u;!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(r||(r={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue"}(o||(o={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(u||(u={}));var i=new Set(Object.values(u)),a=function(e){var r=this;return void 0===e&&(e={}),{name:"@amplitude/plugin-global-user-properties",type:"enrichment",execute:function(o){return n(r,void 0,void 0,(function(){var n;return t(this,(function(t){return function(e){return!i.has(e.event_type)}(o)||function(e){return e.event_type===u.IDENTIFY}(o)?(n=o.user_properties,e.propertyTransform&&n&&(n=e.propertyTransform(n)),n?(o.global_user_properties=n,e.shouldKeepOriginalUserProperties||delete o.user_properties,[2,o]):[2,o]):[2,o]}))}))}}};e.globalUserPropertiesPlugin=a,e.plugin=a,Object.defineProperty(e,"__esModule",{value:!0})}));
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amplitude/plugin-global-user-properties",
3
- "version": "1.2.39",
3
+ "version": "1.2.41",
4
4
  "description": "An event enrichment plugin that adds the experimental global user properties field to events",
5
5
  "author": "Amplitude Inc",
6
6
  "homepage": "https://github.com/amplitude/Amplitude-TypeScript",
@@ -36,11 +36,11 @@
36
36
  "url": "https://github.com/amplitude/Amplitude-TypeScript/issues"
37
37
  },
38
38
  "dependencies": {
39
- "@amplitude/analytics-types": "^2.8.4",
39
+ "@amplitude/analytics-types": "^2.9.0",
40
40
  "tslib": "^2.4.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@amplitude/analytics-browser": "^2.11.12",
43
+ "@amplitude/analytics-browser": "^2.12.0",
44
44
  "@rollup/plugin-commonjs": "^23.0.4",
45
45
  "@rollup/plugin-node-resolve": "^15.0.1",
46
46
  "@rollup/plugin-typescript": "^10.0.1",
@@ -52,5 +52,5 @@
52
52
  "files": [
53
53
  "lib"
54
54
  ],
55
- "gitHead": "d8f0e2f45827d6f65c621a1f232a3b897cff8d3c"
55
+ "gitHead": "7c04614bf38ea7f86cf615f69bbdc2d90756f188"
56
56
  }