@mparticle/web-sdk 2.16.1 → 2.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-sdk",
3
- "version": "2.16.1",
3
+ "version": "2.17.0",
4
4
  "description": "mParticle core SDK for web applications",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -54,34 +54,45 @@
54
54
  "lint": "eslint src/ test/src/",
55
55
  "gts:check": "gts check",
56
56
  "gts:fix": "gts fix",
57
- "prettier": "node_modules/.bin/prettier --check \"**/*.js\""
57
+ "prettier": "node_modules/.bin/prettier --check \"**/*.js\"",
58
+ "uglify": "npx uglify-js dist/mparticle.js --output dist/mparticle.min.js",
59
+ "gzip": "gzip -c dist/mparticle.min.js > dist/mparticle.min.js.gz",
60
+ "bundle": "npm run uglify && npm run gzip",
61
+ "report:bundled": "ls -l dist/mparticle.min.js.gz | awk '{print $5}'",
62
+ "report:bundled:human": "ls -lh dist/mparticle.min.js.gz | awk '{print $5}'"
58
63
  },
59
64
  "pre-commit": [
60
65
  "lint"
61
66
  ],
62
67
  "devDependencies": {
63
- "@babel/core": "^7.6.0",
68
+ "@babel/core": "^7.18.6",
69
+ "@babel/eslint-parser": "^7.18.2",
70
+ "@babel/eslint-plugin": "^7.17.7",
64
71
  "@babel/plugin-proposal-class-properties": "^7.5.5",
65
72
  "@babel/plugin-proposal-object-rest-spread": "^7.5.5",
66
73
  "@babel/plugin-transform-runtime": "^7.6.0",
67
74
  "@babel/preset-env": "^7.6.0",
68
75
  "@babel/preset-typescript": "^7.6.0",
69
76
  "@mparticle/data-planning-models": "^0.1.0",
70
- "@mparticle/event-models": "^1.1.4",
77
+ "@mparticle/event-models": "^1.1.6",
71
78
  "@rollup/plugin-json": "^4.1.0",
79
+ "@rollup/plugin-typescript": "^8.3.3",
80
+ "@rollup/plugin-babel": "5.3.1",
81
+ "@rollup/plugin-commonjs": "22.0.1",
82
+ "@rollup/plugin-node-resolve": "13.3.0",
72
83
  "@semantic-release/changelog": "^5.0.1",
73
84
  "@semantic-release/exec": "^5.0.0",
74
85
  "@semantic-release/git": "^9.0.0",
75
86
  "@types/chai": "^4.2.3",
76
87
  "@types/mocha": "^9.0.0",
88
+ "@types/mparticle__web-sdk": "^2.16.1",
77
89
  "@types/node": "^16.0.0",
78
- "babel-eslint": "^10.0.3",
79
90
  "babel-preset-minify": "^0.5.1",
80
91
  "browser-sync": "^2.26.3",
81
92
  "browserify": "^17.0.0",
82
93
  "chai": "^4.2.0",
83
94
  "cross-env": "^7.0.3",
84
- "eslint": "^7.25.0",
95
+ "eslint": "^7.32.0",
85
96
  "eslint-config-prettier": "8.3.0",
86
97
  "eslint-plugin-prettier": "3.4.1",
87
98
  "fetch-mock": "^7.5.1",
@@ -99,11 +110,7 @@
99
110
  "mocha": "^9.0.0",
100
111
  "pre-commit": "^1.2.2",
101
112
  "prettier": "1.18.2",
102
- "rollup": "^1.19.4",
103
- "rollup-plugin-babel": "^4.3.3",
104
- "rollup-plugin-commonjs": "^10.1.0",
105
- "rollup-plugin-node-resolve": "^5.2.0",
106
- "rollup-plugin-typescript": "^1.0.1",
113
+ "rollup": "^2.75.7",
107
114
  "shelljs": "^0.8.4",
108
115
  "should": "^7.1.0",
109
116
  "sinon": "^11.0.0",
@@ -136,7 +136,11 @@ export class BatchUploader {
136
136
 
137
137
  if (onCreateBatchCallback) {
138
138
  uploadBatchObject = onCreateBatchCallback(uploadBatchObject);
139
- uploadBatchObject.mutated = true;
139
+ if (uploadBatchObject) {
140
+ uploadBatchObject.modified = true;
141
+ } else {
142
+ mpInstance.Logger.warning('Skiping batch upload because no batch was returned from onCreateBatch callback');
143
+ }
140
144
  }
141
145
 
142
146
  if (uploadBatchObject) {
package/src/constants.ts CHANGED
@@ -59,8 +59,7 @@ const Constants = {
59
59
  'identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again',
60
60
  IdentityRequesetInvalidKey:
61
61
  'There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.',
62
- OnUserAliasType:
63
- 'The onUserAlias value must be a function. The onUserAlias provided is of type',
62
+ OnUserAliasType: 'The onUserAlias value must be a function.',
64
63
  UserIdentities:
65
64
  'The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.',
66
65
  UserIdentitiesInvalidKey:
package/src/forwarders.js CHANGED
@@ -55,6 +55,7 @@ export default function Forwarders(mpInstance, kitBlocker) {
55
55
  );
56
56
 
57
57
  if (!forwarder.initialized) {
58
+ forwarder.logger = mpInstance.Logger;
58
59
  forwarder.init(
59
60
  forwarder.settings,
60
61
  forwardingStatsCallback,
@@ -327,8 +327,7 @@ export function convertPromotionAction(
327
327
  return null;
328
328
  }
329
329
  const promotionAction: EventsApi.PromotionAction = {
330
- action: sdkEvent.PromotionAction
331
- .PromotionActionType as EventsApi.PromotionActionActionEnum,
330
+ action: sdkEvent.PromotionAction.PromotionActionType as EventsApi.PromotionActionActionEnum,
332
331
  promotions: convertPromotions(sdkEvent.PromotionAction.PromotionList),
333
332
  };
334
333
  return promotionAction;
package/src/utils.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  type valueof<T> = T[keyof T];
2
2
 
3
3
  const inArray = (items: any[], name: string): boolean => {
4
- const i = 0;
4
+ let i = 0;
5
5
 
6
6
  if (Array.prototype.indexOf) {
7
7
  return items.indexOf(name, 0) >= 0;
package/src/validators.ts CHANGED
@@ -78,11 +78,9 @@ const Validators = {
78
78
  ) {
79
79
  return {
80
80
  valid: false,
81
- // FIXME: Validates type safety
82
81
  error:
83
82
  Constants.Messages.ValidationMessages
84
- .OnUserAliasType +
85
- typeof identityApiData[key],
83
+ .OnUserAliasType,
86
84
  };
87
85
  }
88
86
  }