@micromag/core 0.3.614 → 0.3.615

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/es/hooks.js CHANGED
@@ -1937,7 +1937,10 @@ function useProgressSteps() {
1937
1937
  });
1938
1938
  stepsToTrack.forEach(function (step) {
1939
1939
  if (onStep !== null) {
1940
- onStep(step);
1940
+ onStep(step, {
1941
+ duration: duration,
1942
+ currentTime: currentTime
1943
+ });
1941
1944
  }
1942
1945
  currentSteps[step] = true;
1943
1946
  });
@@ -2356,7 +2359,7 @@ var useTrackScreenMedia = function useTrackScreenMedia() {
2356
2359
  return useCallback(function () {
2357
2360
  var media = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
2358
2361
  var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2359
- var opts = arguments.length > 2 ? arguments[2] : undefined;
2362
+ var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
2360
2363
  if (type !== null && media !== null && action !== null) {
2361
2364
  tracking.trackMedia("screen_".concat(type), media, action, _objectSpread(_objectSpread({}, opts), getScreenOptions(screenContext, opts)));
2362
2365
  }
package/es/index.js CHANGED
@@ -654,6 +654,7 @@ var PropTypes = /*#__PURE__*/Object.freeze({
654
654
  closedCaptions: closedCaptions,
655
655
  closedCaptionsElement: closedCaptionsElement,
656
656
  closedCaptionsMedia: closedCaptionsMedia,
657
+ color: color,
657
658
  colorObject: colorObject,
658
659
  component: component,
659
660
  componentNames: componentNames,
@@ -2234,8 +2235,10 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
2234
2235
  var _ref6 = media || {},
2235
2236
  _ref6$id = _ref6.id,
2236
2237
  mediaId = _ref6$id === undefined ? null : _ref6$id,
2238
+ _ref6$url = _ref6.url,
2239
+ mediaUrl = _ref6$url === undefined ? null : _ref6$url,
2237
2240
  _ref6$name = _ref6.name,
2238
- name = _ref6$name === undefined ? null : _ref6$name,
2241
+ mediaName = _ref6$name === undefined ? null : _ref6$name,
2239
2242
  _ref6$duration = _ref6.duration,
2240
2243
  rootDuration = _ref6$duration === undefined ? null : _ref6$duration,
2241
2244
  _ref6$currentTime = _ref6.currentTime,
@@ -2245,17 +2248,25 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
2245
2248
  var _ref7 = metadata || {},
2246
2249
  _ref7$duration = _ref7.duration,
2247
2250
  duration = _ref7$duration === undefined ? rootDuration : _ref7$duration;
2248
- var label = name;
2249
2251
  var data = _objectSpread(_objectSpread({}, opts), {}, {
2250
2252
  event: 'eventInteraction',
2251
2253
  eventCategory: type,
2252
2254
  eventAction: action,
2253
- eventLabel: label,
2255
+ eventLabel: mediaName || mediaUrl,
2254
2256
  eventValue: value,
2255
2257
  mediaId: mediaId,
2256
- mediaCurrentTime: currentTime !== null ? Math.round(currentTime) : null,
2257
- mediaProgress: currentTime !== null && duration !== null && duration > 0 ? Math.round(currentTime / duration * 100) : null
2258
+ mediaUrl: mediaUrl,
2259
+ mediaName: mediaName
2258
2260
  });
2261
+ if (duration !== null) {
2262
+ data.mediaDuration = Math.round(duration);
2263
+ }
2264
+ if (currentTime !== null) {
2265
+ data.mediaCurrentTime = Math.round(currentTime);
2266
+ }
2267
+ if (currentTime !== null && duration !== null && duration > 0) {
2268
+ data.mediaProgress = Math.round(currentTime / duration * 100);
2269
+ }
2259
2270
  this.push(data);
2260
2271
  }
2261
2272
  }]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/core",
3
- "version": "0.3.614",
3
+ "version": "0.3.615",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -144,5 +144,5 @@
144
144
  "access": "public",
145
145
  "registry": "https://registry.npmjs.org/"
146
146
  },
147
- "gitHead": "98ba70b785fcd089365cc26eb8ee79ec897016dc"
147
+ "gitHead": "0269f185b25adfc919c7208bbc63e4824012c980"
148
148
  }