@mparticle/web-amplitude-kit 2.1.0 → 2.2.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/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  ## Releases
2
2
 
3
3
  --
4
+ #### 2.2.0 - 2021-11-03
5
+
6
+ - feat: Support other5-other10 IDs
7
+
4
8
  #### 2.1.0 - 2021-08-30
5
9
 
6
10
  - feat: Add support for EU Data Center
@@ -11,16 +11,6 @@ function isObject(val) {
11
11
  return val != null && typeof val === 'object' && Array.isArray(val) === false;
12
12
  }
13
13
 
14
- var isobject = /*#__PURE__*/Object.freeze({
15
- 'default': isObject
16
- });
17
-
18
- function getCjsExportFromNamespace (n) {
19
- return n && n['default'] || n;
20
- }
21
-
22
- var isobject$1 = getCjsExportFromNamespace(isobject);
23
-
24
14
  /* eslint-disable no-undef*/
25
15
  //
26
16
  // Copyright 2015 mParticle, Inc.
@@ -59,6 +49,12 @@ var constants = {
59
49
  other2: 'other2',
60
50
  other3: 'other3',
61
51
  other4: 'other4',
52
+ other5: 'other5',
53
+ other6: 'other6',
54
+ other7: 'other7',
55
+ other8: 'other8',
56
+ other9: 'other9',
57
+ other10: 'other10',
62
58
  };
63
59
 
64
60
  /* eslint-disable */
@@ -167,7 +163,8 @@ var constructor = function () {
167
163
  }
168
164
 
169
165
  function onUserIdentified(user) {
170
- var userIdMissing;
166
+ var userId;
167
+
171
168
  if (isInitialized) {
172
169
  var userIdentities = user.getUserIdentities().userIdentities;
173
170
 
@@ -179,67 +176,51 @@ var constructor = function () {
179
176
  try {
180
177
  switch (forwarderSettings.userIdentification) {
181
178
  case constants.MPID:
182
- return getInstance().setUserId(user.getMPID());
179
+ userId = user.getMPID();
180
+ break;
183
181
  // server returns `customerId` whereas key on userIdentities object is `customerid`
184
182
  case constants.customerId:
185
- if (userIdentities.customerid) {
186
- return getInstance().setUserId(
187
- userIdentities.customerid
188
- );
189
- } else {
190
- userIdMissing = true;
191
- }
183
+ userId = userIdentities.customerid;
192
184
  break;
193
185
  case constants.email:
194
- if (userIdentities.email) {
195
- return getInstance().setUserId(
196
- userIdentities.email
197
- );
198
- } else {
199
- userIdMissing = true;
200
- }
186
+ userId = userIdentities.email;
201
187
  break;
202
188
  case constants.other:
203
- if (userIdentities.other) {
204
- return getInstance().setUserId(
205
- userIdentities.other
206
- );
207
- } else {
208
- userIdMissing = true;
209
- }
189
+ userId = userIdentities.other;
210
190
  break;
211
191
  case constants.other2:
212
- if (userIdentities.other2) {
213
- return getInstance().setUserId(
214
- userIdentities.other2
215
- );
216
- } else {
217
- userIdMissing = true;
218
- }
192
+ userId = userIdentities.other2;
219
193
  break;
220
194
  case constants.other3:
221
- if (userIdentities.other3) {
222
- return getInstance().setUserId(
223
- userIdentities.other3
224
- );
225
- } else {
226
- userIdMissing = true;
227
- }
195
+ userId = userIdentities.other3;
228
196
  break;
229
197
  case constants.other4:
230
- if (userIdentities.other4) {
231
- return getInstance().setUserId(
232
- userIdentities.other4
233
- );
234
- } else {
235
- userIdMissing = true;
236
- }
198
+ userId = userIdentities.other4;
199
+ break;
200
+ case constants.other5:
201
+ userId = userIdentities.other5;
202
+ break;
203
+ case constants.other6:
204
+ userId = userIdentities.other6;
205
+ break;
206
+ case constants.other7:
207
+ userId = userIdentities.other7;
208
+ break;
209
+ case constants.other8:
210
+ userId = userIdentities.other8;
211
+ break;
212
+ case constants.other9:
213
+ userId = userIdentities.other9;
214
+ break;
215
+ case constants.other10:
216
+ userId = userIdentities.other10;
237
217
  break;
238
-
239
218
  default:
240
- return;
219
+ userId = null;
241
220
  }
242
- if (userIdMissing) {
221
+ if (userId) {
222
+ return getInstance().setUserId(userId);
223
+ } else {
243
224
  console.warn(
244
225
  'A user identification type of ' +
245
226
  forwarderSettings.userIdentification +
@@ -505,8 +486,7 @@ var constructor = function () {
505
486
  }
506
487
 
507
488
  if (forwarderSettings.baseUrl) {
508
- ampSettings.apiEndpoint =
509
- forwarderSettings.baseUrl;
489
+ ampSettings.apiEndpoint = forwarderSettings.baseUrl;
510
490
  }
511
491
 
512
492
  isDefaultInstance =
@@ -553,14 +533,14 @@ function register(config) {
553
533
  return;
554
534
  }
555
535
 
556
- if (!isobject$1(config)) {
536
+ if (!isObject(config)) {
557
537
  console.log(
558
538
  'The "config" must be an object. You passed in a ' + typeof config
559
539
  );
560
540
  return;
561
541
  }
562
542
 
563
- if (isobject$1(config.kits)) {
543
+ if (isObject(config.kits)) {
564
544
  config.kits[name] = {
565
545
  constructor: constructor,
566
546
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-amplitude-kit",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "author": "mParticle Developers <developers@mparticle.com> (https://www.mparticle.com)",
5
5
  "description": "mParticle integration sdk for Amplitude",
6
6
  "main": "dist/Amplitude.common.js",