@amplitude/analytics-react-native 1.10.2 → 1.11.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.
Files changed (52) hide show
  1. package/lib/commonjs/amp-capture.js +10 -1
  2. package/lib/commonjs/amp-capture.js.map +1 -1
  3. package/lib/commonjs/autocapture/element-interaction.js +22 -0
  4. package/lib/commonjs/autocapture/element-interaction.js.map +1 -0
  5. package/lib/commonjs/autocapture/rage-click.js +141 -0
  6. package/lib/commonjs/autocapture/rage-click.js.map +1 -0
  7. package/lib/commonjs/config/joined-config.js +1 -0
  8. package/lib/commonjs/config/joined-config.js.map +1 -1
  9. package/lib/commonjs/constants.js +2 -1
  10. package/lib/commonjs/constants.js.map +1 -1
  11. package/lib/commonjs/plugins/frustration-plugin.js +67 -0
  12. package/lib/commonjs/plugins/frustration-plugin.js.map +1 -0
  13. package/lib/commonjs/react-native-client.js +27 -23
  14. package/lib/commonjs/react-native-client.js.map +1 -1
  15. package/lib/commonjs/version.js +1 -1
  16. package/lib/module/amp-capture.js +10 -1
  17. package/lib/module/amp-capture.js.map +1 -1
  18. package/lib/module/autocapture/element-interaction.js +17 -0
  19. package/lib/module/autocapture/element-interaction.js.map +1 -0
  20. package/lib/module/autocapture/rage-click.js +133 -0
  21. package/lib/module/autocapture/rage-click.js.map +1 -0
  22. package/lib/module/config/joined-config.js +1 -0
  23. package/lib/module/config/joined-config.js.map +1 -1
  24. package/lib/module/constants.js +1 -0
  25. package/lib/module/constants.js.map +1 -1
  26. package/lib/module/plugins/frustration-plugin.js +59 -0
  27. package/lib/module/plugins/frustration-plugin.js.map +1 -0
  28. package/lib/module/react-native-client.js +28 -24
  29. package/lib/module/react-native-client.js.map +1 -1
  30. package/lib/module/version.js +1 -1
  31. package/lib/typescript/amp-capture.d.ts +7 -1
  32. package/lib/typescript/amp-capture.d.ts.map +1 -1
  33. package/lib/typescript/autocapture/element-interaction.d.ts +7 -0
  34. package/lib/typescript/autocapture/element-interaction.d.ts.map +1 -0
  35. package/lib/typescript/autocapture/rage-click.d.ts +30 -0
  36. package/lib/typescript/autocapture/rage-click.d.ts.map +1 -0
  37. package/lib/typescript/config/joined-config.d.ts.map +1 -1
  38. package/lib/typescript/constants.d.ts +1 -0
  39. package/lib/typescript/constants.d.ts.map +1 -1
  40. package/lib/typescript/plugins/frustration-plugin.d.ts +17 -0
  41. package/lib/typescript/plugins/frustration-plugin.d.ts.map +1 -0
  42. package/lib/typescript/react-native-client.d.ts.map +1 -1
  43. package/lib/typescript/version.d.ts +1 -1
  44. package/package.json +3 -3
  45. package/src/amp-capture.ts +13 -3
  46. package/src/autocapture/element-interaction.ts +27 -0
  47. package/src/autocapture/rage-click.ts +172 -0
  48. package/src/config/joined-config.ts +1 -0
  49. package/src/constants.ts +1 -0
  50. package/src/plugins/frustration-plugin.ts +80 -0
  51. package/src/react-native-client.ts +19 -14
  52. package/src/version.ts +1 -1
@@ -41,6 +41,7 @@ import { plugin as networkCapturePlugin } from '@amplitude/plugin-network-captur
41
41
  import { CampaignTracker } from './campaign/campaign-tracker';
42
42
  import { Context } from './plugins/context';
43
43
  import { networkConnectivityCheckerPlugin } from './plugins/network-connectivity-checker';
44
+ import { frustrationPlugin } from './plugins/frustration-plugin';
44
45
  import { ReactNativeDiagnosticsStorage } from './diagnostics/diagnostics-storage';
45
46
  import { LIBPREFIX } from './lib-prefix';
46
47
  import { VERSION } from './version';
@@ -50,6 +51,7 @@ import { parseOldCookies } from './cookie-migration';
50
51
  import { isNative } from './utils/platform';
51
52
  import { RemoteConfigCustomStorage } from './remote-config/remote-config-customstorage';
52
53
  import * as Capture from './amp-capture';
54
+ import { getElementInteractionEventProperties } from './autocapture/element-interaction';
53
55
  import {
54
56
  APP_BUILD,
55
57
  APP_VERSION,
@@ -64,11 +66,6 @@ import {
64
66
  PREVIOUS_BUILD,
65
67
  PREVIOUS_VERSION,
66
68
  SCREEN_NAME,
67
- TARGET_ACCESSIBILITY_LABEL,
68
- TARGET_ACTION,
69
- TARGET_COMPONENT,
70
- TARGET_ELEMENT,
71
- TARGET_TEST_ID,
72
69
  } from './constants';
73
70
 
74
71
  /**
@@ -300,6 +297,7 @@ export class AmplitudeReactNative extends AmplitudeCore implements ReactNativeCl
300
297
  screenViews: true,
301
298
  elementInteractions: true,
302
299
  networkTracking: true,
300
+ frustrationInteractions: true,
303
301
  };
304
302
  } else if (autocaptureConfig && typeof autocaptureConfig === 'object') {
305
303
  this.autocapture = autocaptureConfig;
@@ -342,17 +340,23 @@ export class AmplitudeReactNative extends AmplitudeCore implements ReactNativeCl
342
340
  await this.add(networkCapturePlugin(getNetworkTrackingConfig(this.config))).promise;
343
341
  }
344
342
 
343
+ const frustrationInteractions = this.autocapture?.frustrationInteractions;
344
+ if (frustrationInteractions) {
345
+ this.config.loggerProvider.debug('Adding frustration interactions plugin');
346
+ await this.add(
347
+ frustrationPlugin({
348
+ ...(typeof frustrationInteractions === 'object' ? frustrationInteractions : {}),
349
+ getScreenName: () => this.currentScreenName,
350
+ }),
351
+ ).promise;
352
+ }
353
+
345
354
  if (this.autocapture?.elementInteractions === true) {
346
355
  this.captureUnsubscribe = Capture.subscribe((properties) => {
347
- const analyticsProps = {
348
- [SCREEN_NAME]: this.currentScreenName,
349
- [TARGET_ACCESSIBILITY_LABEL]: properties.accessibilityLabel,
350
- [TARGET_ACTION]: properties.action,
351
- [TARGET_COMPONENT]: properties.component,
352
- [TARGET_ELEMENT]: properties.element,
353
- [TARGET_TEST_ID]: properties.testID,
354
- };
355
- this.track(DEFAULT_ELEMENT_INTERACTED_EVENT, analyticsProps);
356
+ this.track(
357
+ DEFAULT_ELEMENT_INTERACTED_EVENT,
358
+ getElementInteractionEventProperties(properties, this.currentScreenName),
359
+ );
356
360
  });
357
361
  }
358
362
 
@@ -396,6 +400,7 @@ export class AmplitudeReactNative extends AmplitudeCore implements ReactNativeCl
396
400
  shutdown() {
397
401
  this.appStateChangeHandler?.remove();
398
402
  this.captureUnsubscribe?.();
403
+ this.timeline.reset(this);
399
404
  }
400
405
 
401
406
  async runAttributionStrategy(attributionConfig?: AttributionOptions, isNewSession = false) {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.10.2';
1
+ export const VERSION = '1.11.0';