@micromag/core 0.2.365 → 0.2.375

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/contexts.js CHANGED
@@ -1030,7 +1030,6 @@ var ScreenSizeProvider = function ScreenSizeProvider(_ref) {
1030
1030
  ScreenSizeProvider.propTypes = propTypes$4;
1031
1031
  ScreenSizeProvider.defaultProps = defaultProps$4;
1032
1032
 
1033
- /* eslint-disable react/jsx-props-no-spreading */
1034
1033
  var useTracking = function useTracking() {
1035
1034
  return useContext(TrackingContext);
1036
1035
  };
@@ -1046,13 +1045,8 @@ var TrackingProvider = function TrackingProvider(_ref) {
1046
1045
  children = _ref.children;
1047
1046
  var contextTracking = useTracking() || null;
1048
1047
  var tracking = useMemo(function () {
1049
- if (contextTracking !== null) {
1050
- contextTracking.setVariables(variables);
1051
- return contextTracking;
1052
- }
1053
-
1054
1048
  return new Tracking({
1055
- variables: variables
1049
+ variables: _objectSpread(_objectSpread({}, contextTracking !== null ? contextTracking.getVariables() : null), variables)
1056
1050
  });
1057
1051
  }, [contextTracking, variables]);
1058
1052
  return /*#__PURE__*/React.createElement(TrackingContainer, {
package/es/index.js CHANGED
@@ -1798,7 +1798,7 @@ var StoryParser = /*#__PURE__*/function () {
1798
1798
  }();
1799
1799
 
1800
1800
  var _excluded = ["value"],
1801
- _excluded2 = ["value"];
1801
+ _excluded2 = ["value", "currentTime"];
1802
1802
 
1803
1803
  var Tracking = /*#__PURE__*/function (_BaseTracking) {
1804
1804
  _inherits(Tracking, _BaseTracking);
@@ -1816,6 +1816,7 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
1816
1816
  var _this$options$variabl = _this.options.variables,
1817
1817
  variables = _this$options$variabl === void 0 ? null : _this$options$variabl;
1818
1818
  _this.variables = null;
1819
+ _this.screensViewed = [];
1819
1820
 
1820
1821
  if (variables !== null) {
1821
1822
  _this.setVariables(variables);
@@ -1841,27 +1842,44 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
1841
1842
  }, {
1842
1843
  key: "trackScreenView",
1843
1844
  value: function trackScreenView(screen, screenIndex) {
1844
- var _ref = screen || {},
1845
- _ref$id = _ref.id,
1846
- screenId = _ref$id === void 0 ? null : _ref$id,
1847
- _ref$type = _ref.type,
1848
- screenType = _ref$type === void 0 ? null : _ref$type;
1845
+ var _ref = this.variables || {},
1846
+ _ref$screensCount = _ref.screensCount,
1847
+ screensCount = _ref$screensCount === void 0 ? null : _ref$screensCount;
1848
+
1849
+ var _ref2 = screen || {},
1850
+ _ref2$id = _ref2.id,
1851
+ screenId = _ref2$id === void 0 ? null : _ref2$id,
1852
+ _ref2$type = _ref2.type,
1853
+ screenType = _ref2$type === void 0 ? null : _ref2$type,
1854
+ _ref2$metadata = _ref2.metadata,
1855
+ metadata = _ref2$metadata === void 0 ? {} : _ref2$metadata;
1856
+
1857
+ var _ref3 = metadata || {},
1858
+ screenTitle = _ref3.title;
1859
+
1860
+ if (this.screensViewed.indexOf(screenId || index) !== -1) {
1861
+ this.screensViewed = [].concat(_toConsumableArray(this.screensViewed), [screenId || index]);
1862
+ }
1849
1863
 
1850
1864
  var data = {
1851
1865
  event: 'screenView',
1852
1866
  screenId: screenId,
1853
1867
  screenType: screenType,
1854
- screenIndex: screenIndex
1868
+ screenIndex: screenIndex,
1869
+ screenTitle: screenTitle,
1870
+ screenProgress: screensCount !== null && screenIndex !== null ? (screenIndex + 1) / screensCount : null,
1871
+ screensViewed: this.screensViewed,
1872
+ screensViewedProgress: screensCount !== null ? this.screensViewed.length / screensCount : null
1855
1873
  };
1856
1874
  this.push(data);
1857
1875
  }
1858
1876
  }, {
1859
1877
  key: "trackEvent",
1860
1878
  value: function trackEvent(category, action, label) {
1861
- var _ref2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
1862
- _ref2$value = _ref2.value,
1863
- value = _ref2$value === void 0 ? null : _ref2$value,
1864
- opts = _objectWithoutProperties(_ref2, _excluded);
1879
+ var _ref4 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
1880
+ _ref4$value = _ref4.value,
1881
+ value = _ref4$value === void 0 ? null : _ref4$value,
1882
+ opts = _objectWithoutProperties(_ref4, _excluded);
1865
1883
 
1866
1884
  var data = _objectSpread(_objectSpread({}, opts), {}, {
1867
1885
  event: 'eventInteraction',
@@ -1876,20 +1894,28 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
1876
1894
  }, {
1877
1895
  key: "trackMedia",
1878
1896
  value: function trackMedia(type, media, action) {
1879
- var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
1880
- _ref3$value = _ref3.value,
1881
- value = _ref3$value === void 0 ? null : _ref3$value,
1882
- opts = _objectWithoutProperties(_ref3, _excluded2);
1883
-
1884
- var _ref4 = media || {},
1885
- _ref4$id = _ref4.id,
1886
- mediaId = _ref4$id === void 0 ? null : _ref4$id,
1887
- _ref4$name = _ref4.name,
1888
- name = _ref4$name === void 0 ? null : _ref4$name,
1889
- _ref4$duration = _ref4.duration,
1890
- duration = _ref4$duration === void 0 ? null : _ref4$duration,
1891
- _ref4$currentTime = _ref4.currentTime,
1892
- currentTime = _ref4$currentTime === void 0 ? null : _ref4$currentTime;
1897
+ var _ref5 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
1898
+ _ref5$value = _ref5.value,
1899
+ value = _ref5$value === void 0 ? null : _ref5$value,
1900
+ _ref5$currentTime = _ref5.currentTime,
1901
+ optsCurrentTime = _ref5$currentTime === void 0 ? null : _ref5$currentTime,
1902
+ opts = _objectWithoutProperties(_ref5, _excluded2);
1903
+
1904
+ var _ref6 = media || {},
1905
+ _ref6$id = _ref6.id,
1906
+ mediaId = _ref6$id === void 0 ? null : _ref6$id,
1907
+ _ref6$name = _ref6.name,
1908
+ name = _ref6$name === void 0 ? null : _ref6$name,
1909
+ _ref6$duration = _ref6.duration,
1910
+ rootDuration = _ref6$duration === void 0 ? null : _ref6$duration,
1911
+ _ref6$currentTime = _ref6.currentTime,
1912
+ currentTime = _ref6$currentTime === void 0 ? optsCurrentTime : _ref6$currentTime,
1913
+ _ref6$metadata = _ref6.metadata,
1914
+ metadata = _ref6$metadata === void 0 ? {} : _ref6$metadata;
1915
+
1916
+ var _ref7 = metadata || {},
1917
+ _ref7$duration = _ref7.duration,
1918
+ duration = _ref7$duration === void 0 ? rootDuration : _ref7$duration;
1893
1919
 
1894
1920
  var label = name;
1895
1921
 
package/lib/contexts.js CHANGED
@@ -1064,7 +1064,6 @@ var ScreenSizeProvider = function ScreenSizeProvider(_ref) {
1064
1064
  ScreenSizeProvider.propTypes = propTypes$4;
1065
1065
  ScreenSizeProvider.defaultProps = defaultProps$4;
1066
1066
 
1067
- /* eslint-disable react/jsx-props-no-spreading */
1068
1067
  var useTracking = function useTracking() {
1069
1068
  return React.useContext(tracking.TrackingContext);
1070
1069
  };
@@ -1080,13 +1079,8 @@ var TrackingProvider = function TrackingProvider(_ref) {
1080
1079
  children = _ref.children;
1081
1080
  var contextTracking = useTracking() || null;
1082
1081
  var tracking$1 = React.useMemo(function () {
1083
- if (contextTracking !== null) {
1084
- contextTracking.setVariables(variables);
1085
- return contextTracking;
1086
- }
1087
-
1088
1082
  return new core.Tracking({
1089
- variables: variables
1083
+ variables: _objectSpread__default["default"](_objectSpread__default["default"]({}, contextTracking !== null ? contextTracking.getVariables() : null), variables)
1090
1084
  });
1091
1085
  }, [contextTracking, variables]);
1092
1086
  return /*#__PURE__*/React__default["default"].createElement(tracking.TrackingContainer, {
package/lib/index.js CHANGED
@@ -1824,7 +1824,7 @@ var StoryParser = /*#__PURE__*/function () {
1824
1824
  }();
1825
1825
 
1826
1826
  var _excluded = ["value"],
1827
- _excluded2 = ["value"];
1827
+ _excluded2 = ["value", "currentTime"];
1828
1828
 
1829
1829
  var Tracking = /*#__PURE__*/function (_BaseTracking) {
1830
1830
  _inherits__default["default"](Tracking, _BaseTracking);
@@ -1842,6 +1842,7 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
1842
1842
  var _this$options$variabl = _this.options.variables,
1843
1843
  variables = _this$options$variabl === void 0 ? null : _this$options$variabl;
1844
1844
  _this.variables = null;
1845
+ _this.screensViewed = [];
1845
1846
 
1846
1847
  if (variables !== null) {
1847
1848
  _this.setVariables(variables);
@@ -1867,27 +1868,44 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
1867
1868
  }, {
1868
1869
  key: "trackScreenView",
1869
1870
  value: function trackScreenView(screen, screenIndex) {
1870
- var _ref = screen || {},
1871
- _ref$id = _ref.id,
1872
- screenId = _ref$id === void 0 ? null : _ref$id,
1873
- _ref$type = _ref.type,
1874
- screenType = _ref$type === void 0 ? null : _ref$type;
1871
+ var _ref = this.variables || {},
1872
+ _ref$screensCount = _ref.screensCount,
1873
+ screensCount = _ref$screensCount === void 0 ? null : _ref$screensCount;
1874
+
1875
+ var _ref2 = screen || {},
1876
+ _ref2$id = _ref2.id,
1877
+ screenId = _ref2$id === void 0 ? null : _ref2$id,
1878
+ _ref2$type = _ref2.type,
1879
+ screenType = _ref2$type === void 0 ? null : _ref2$type,
1880
+ _ref2$metadata = _ref2.metadata,
1881
+ metadata = _ref2$metadata === void 0 ? {} : _ref2$metadata;
1882
+
1883
+ var _ref3 = metadata || {},
1884
+ screenTitle = _ref3.title;
1885
+
1886
+ if (this.screensViewed.indexOf(screenId || index) !== -1) {
1887
+ this.screensViewed = [].concat(_toConsumableArray__default["default"](this.screensViewed), [screenId || index]);
1888
+ }
1875
1889
 
1876
1890
  var data = {
1877
1891
  event: 'screenView',
1878
1892
  screenId: screenId,
1879
1893
  screenType: screenType,
1880
- screenIndex: screenIndex
1894
+ screenIndex: screenIndex,
1895
+ screenTitle: screenTitle,
1896
+ screenProgress: screensCount !== null && screenIndex !== null ? (screenIndex + 1) / screensCount : null,
1897
+ screensViewed: this.screensViewed,
1898
+ screensViewedProgress: screensCount !== null ? this.screensViewed.length / screensCount : null
1881
1899
  };
1882
1900
  this.push(data);
1883
1901
  }
1884
1902
  }, {
1885
1903
  key: "trackEvent",
1886
1904
  value: function trackEvent(category, action, label) {
1887
- var _ref2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
1888
- _ref2$value = _ref2.value,
1889
- value = _ref2$value === void 0 ? null : _ref2$value,
1890
- opts = _objectWithoutProperties__default["default"](_ref2, _excluded);
1905
+ var _ref4 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
1906
+ _ref4$value = _ref4.value,
1907
+ value = _ref4$value === void 0 ? null : _ref4$value,
1908
+ opts = _objectWithoutProperties__default["default"](_ref4, _excluded);
1891
1909
 
1892
1910
  var data = _objectSpread__default["default"](_objectSpread__default["default"]({}, opts), {}, {
1893
1911
  event: 'eventInteraction',
@@ -1902,20 +1920,28 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
1902
1920
  }, {
1903
1921
  key: "trackMedia",
1904
1922
  value: function trackMedia(type, media, action) {
1905
- var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
1906
- _ref3$value = _ref3.value,
1907
- value = _ref3$value === void 0 ? null : _ref3$value,
1908
- opts = _objectWithoutProperties__default["default"](_ref3, _excluded2);
1909
-
1910
- var _ref4 = media || {},
1911
- _ref4$id = _ref4.id,
1912
- mediaId = _ref4$id === void 0 ? null : _ref4$id,
1913
- _ref4$name = _ref4.name,
1914
- name = _ref4$name === void 0 ? null : _ref4$name,
1915
- _ref4$duration = _ref4.duration,
1916
- duration = _ref4$duration === void 0 ? null : _ref4$duration,
1917
- _ref4$currentTime = _ref4.currentTime,
1918
- currentTime = _ref4$currentTime === void 0 ? null : _ref4$currentTime;
1923
+ var _ref5 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
1924
+ _ref5$value = _ref5.value,
1925
+ value = _ref5$value === void 0 ? null : _ref5$value,
1926
+ _ref5$currentTime = _ref5.currentTime,
1927
+ optsCurrentTime = _ref5$currentTime === void 0 ? null : _ref5$currentTime,
1928
+ opts = _objectWithoutProperties__default["default"](_ref5, _excluded2);
1929
+
1930
+ var _ref6 = media || {},
1931
+ _ref6$id = _ref6.id,
1932
+ mediaId = _ref6$id === void 0 ? null : _ref6$id,
1933
+ _ref6$name = _ref6.name,
1934
+ name = _ref6$name === void 0 ? null : _ref6$name,
1935
+ _ref6$duration = _ref6.duration,
1936
+ rootDuration = _ref6$duration === void 0 ? null : _ref6$duration,
1937
+ _ref6$currentTime = _ref6.currentTime,
1938
+ currentTime = _ref6$currentTime === void 0 ? optsCurrentTime : _ref6$currentTime,
1939
+ _ref6$metadata = _ref6.metadata,
1940
+ metadata = _ref6$metadata === void 0 ? {} : _ref6$metadata;
1941
+
1942
+ var _ref7 = metadata || {},
1943
+ _ref7$duration = _ref7.duration,
1944
+ duration = _ref7$duration === void 0 ? rootDuration : _ref7$duration;
1919
1945
 
1920
1946
  var label = name;
1921
1947
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/core",
3
- "version": "0.2.365",
3
+ "version": "0.2.375",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -36,7 +36,15 @@
36
36
  "./components": "./lib/components.js",
37
37
  "./contexts": "./lib/contexts.js",
38
38
  "./hooks": "./lib/hooks.js",
39
- "./utils": "./lib/utils.js"
39
+ "./utils": "./lib/utils.js",
40
+ "./scss/mixins": "./scss/_mixins.scss",
41
+ "./scss/placeholders": "./scss/_placeholders.scss",
42
+ "./scss/theme": "./scss/_theme.scss",
43
+ "./scss/variables": "./scss/_variables.scss",
44
+ "./scss/styles": "./scss/styles.scss",
45
+ "./scss/upload": "./scss/upload.scss",
46
+ "./scss/vendor": "./scss/vendor.scss",
47
+ "./assets/css/styles.css": "./assets/css/styles.css"
40
48
  },
41
49
  "browser": {
42
50
  ".": "./es/index.js",
@@ -98,7 +106,7 @@
98
106
  "debug": "^4.3.1",
99
107
  "flat": "^5.0.2",
100
108
  "hoist-non-react-statics": "^3.3.2",
101
- "lodash": "^4.17.20",
109
+ "lodash": "^4.17.21",
102
110
  "param-case": "^3.0.4",
103
111
  "prop-types": "^15.7.2",
104
112
  "react-helmet": "^6.1.0",
@@ -117,5 +125,5 @@
117
125
  "publishConfig": {
118
126
  "access": "public"
119
127
  },
120
- "gitHead": "b7cf35b6fbf51a8d0fbe6c019b6bd4c11a63b637"
128
+ "gitHead": "9ebbd762e94c3943073e47397ca9d3729d59c570"
121
129
  }