@micromag/core 0.3.614 → 0.3.616

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,
@@ -2188,9 +2189,13 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
2188
2189
  _ref2$type = _ref2.type,
2189
2190
  screenType = _ref2$type === undefined ? null : _ref2$type,
2190
2191
  _ref2$metadata = _ref2.metadata,
2191
- metadata = _ref2$metadata === undefined ? {} : _ref2$metadata;
2192
- var _ref3 = metadata || {},
2193
- screenTitle = _ref3.title;
2192
+ metadata = _ref2$metadata === undefined ? {} : _ref2$metadata,
2193
+ _ref2$parameters = _ref2.parameters,
2194
+ _ref2$parameters2 = _ref2$parameters === undefined ? {} : _ref2$parameters,
2195
+ parametersMetadata = _ref2$parameters2.metadata;
2196
+ var _ref3 = metadata || parametersMetadata || {},
2197
+ screenTitle = _ref3.title,
2198
+ screenDescrition = _ref3.description;
2194
2199
  if (this.screensViewed.indexOf(screenId || screenIndex) === -1) {
2195
2200
  this.screensViewed = [].concat(_toConsumableArray(this.screensViewed), [screenId || screenIndex]);
2196
2201
  }
@@ -2199,7 +2204,9 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
2199
2204
  screenId: screenId,
2200
2205
  screenType: screenType,
2201
2206
  screenIndex: screenIndex,
2207
+ screensCount: screensCount,
2202
2208
  screenTitle: screenTitle,
2209
+ screenDescrition: screenDescrition,
2203
2210
  screenProgress: screensCount !== null && screenIndex !== null ? (screenIndex + 1) / screensCount : null,
2204
2211
  screensViewed: this.screensViewed,
2205
2212
  screensViewedProgress: screensCount !== null ? this.screensViewed.length / screensCount : null
@@ -2234,8 +2241,10 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
2234
2241
  var _ref6 = media || {},
2235
2242
  _ref6$id = _ref6.id,
2236
2243
  mediaId = _ref6$id === undefined ? null : _ref6$id,
2244
+ _ref6$url = _ref6.url,
2245
+ mediaUrl = _ref6$url === undefined ? null : _ref6$url,
2237
2246
  _ref6$name = _ref6.name,
2238
- name = _ref6$name === undefined ? null : _ref6$name,
2247
+ mediaName = _ref6$name === undefined ? null : _ref6$name,
2239
2248
  _ref6$duration = _ref6.duration,
2240
2249
  rootDuration = _ref6$duration === undefined ? null : _ref6$duration,
2241
2250
  _ref6$currentTime = _ref6.currentTime,
@@ -2245,17 +2254,25 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
2245
2254
  var _ref7 = metadata || {},
2246
2255
  _ref7$duration = _ref7.duration,
2247
2256
  duration = _ref7$duration === undefined ? rootDuration : _ref7$duration;
2248
- var label = name;
2249
2257
  var data = _objectSpread(_objectSpread({}, opts), {}, {
2250
2258
  event: 'eventInteraction',
2251
2259
  eventCategory: type,
2252
2260
  eventAction: action,
2253
- eventLabel: label,
2261
+ eventLabel: mediaName || mediaUrl,
2254
2262
  eventValue: value,
2255
2263
  mediaId: mediaId,
2256
- mediaCurrentTime: currentTime !== null ? Math.round(currentTime) : null,
2257
- mediaProgress: currentTime !== null && duration !== null && duration > 0 ? Math.round(currentTime / duration * 100) : null
2264
+ mediaUrl: mediaUrl,
2265
+ mediaName: mediaName
2258
2266
  });
2267
+ if (duration !== null) {
2268
+ data.mediaDuration = Math.round(duration);
2269
+ }
2270
+ if (currentTime !== null) {
2271
+ data.mediaCurrentTime = Math.round(currentTime);
2272
+ }
2273
+ if (currentTime !== null && duration !== null && duration > 0) {
2274
+ data.mediaProgress = Math.round(currentTime / duration * 100);
2275
+ }
2259
2276
  this.push(data);
2260
2277
  }
2261
2278
  }]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/core",
3
- "version": "0.3.614",
3
+ "version": "0.3.616",
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": "040b32d80d95f2377c284d30eea3673838a89cb2"
148
148
  }