@micromag/core 0.3.628 → 0.3.651

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
@@ -1182,15 +1182,18 @@ var useTracking = function useTracking() {
1182
1182
  var propTypes$2 = {
1183
1183
  children: PropTypes.node.isRequired,
1184
1184
  variables: PropTypes$1.trackingVariables,
1185
- disabled: PropTypes.bool
1185
+ disabled: PropTypes.bool,
1186
+ paused: PropTypes.bool
1186
1187
  };
1187
1188
  var defaultProps$2 = {
1188
1189
  variables: null,
1189
- disabled: false
1190
+ disabled: false,
1191
+ paused: false
1190
1192
  };
1191
1193
  var TrackingProvider = function TrackingProvider(_ref) {
1192
1194
  var variables = _ref.variables,
1193
1195
  disabled = _ref.disabled,
1196
+ paused = _ref.paused,
1194
1197
  children = _ref.children;
1195
1198
  var contextTracking = useTracking() || null;
1196
1199
  var refTracking = useRef(null);
@@ -1198,14 +1201,16 @@ var TrackingProvider = function TrackingProvider(_ref) {
1198
1201
  if (refTracking.current === null) {
1199
1202
  refTracking.current = new Tracking({
1200
1203
  variables: _objectSpread(_objectSpread({}, contextTracking !== null ? contextTracking.getVariables() : null), variables),
1201
- disabled: disabled
1204
+ disabled: disabled,
1205
+ paused: paused
1202
1206
  });
1203
1207
  } else {
1204
1208
  refTracking.current.setVariables(_objectSpread(_objectSpread({}, refTracking.current.getVariables()), variables));
1205
1209
  refTracking.current.setDisabled(disabled);
1210
+ refTracking.current.setPaused(paused);
1206
1211
  }
1207
1212
  return refTracking.current;
1208
- }, [contextTracking, variables, disabled]);
1213
+ }, [contextTracking, variables, disabled, paused]);
1209
1214
  return /*#__PURE__*/React.createElement(TrackingContainer, {
1210
1215
  tracking: tracking
1211
1216
  }, children);
package/es/index.js CHANGED
@@ -1199,8 +1199,8 @@ var FieldsManager = /*#__PURE__*/function (_DefinitionsManager) {
1199
1199
  }]);
1200
1200
  }(DefinitionsManager);
1201
1201
 
1202
- var _excluded$5 = ["medias"],
1203
- _excluded2$1 = ["medias"];
1202
+ var _excluded$6 = ["medias"],
1203
+ _excluded2$2 = ["medias"];
1204
1204
  var MediasParser = /*#__PURE__*/function () {
1205
1205
  function MediasParser(_ref) {
1206
1206
  var fieldsManager = _ref.fieldsManager,
@@ -1219,7 +1219,7 @@ var MediasParser = /*#__PURE__*/function () {
1219
1219
  if (typeof this.parsedThemesCache[storyId] === 'undefined') {
1220
1220
  var _this$toPath = this.toPath(theme),
1221
1221
  themeMedias = _this$toPath.medias,
1222
- newTheme = _objectWithoutProperties(_this$toPath, _excluded$5);
1222
+ newTheme = _objectWithoutProperties(_this$toPath, _excluded$6);
1223
1223
  this.parsedThemesCache[storyId] = {
1224
1224
  themeMedias: themeMedias,
1225
1225
  newTheme: newTheme
@@ -1273,7 +1273,7 @@ var MediasParser = /*#__PURE__*/function () {
1273
1273
  if (theme !== null) {
1274
1274
  var _this$getParsedStoryT = this.getParsedStoryTheme(storyId, theme),
1275
1275
  themeMedias = _this$getParsedStoryT.medias,
1276
- newTheme = _objectWithoutProperties(_this$getParsedStoryT, _excluded2$1);
1276
+ newTheme = _objectWithoutProperties(_this$getParsedStoryT, _excluded2$2);
1277
1277
  return medias !== null || themeMedias !== null ? _objectSpread(_objectSpread({}, story), {}, {
1278
1278
  theme: newTheme,
1279
1279
  components: newComponents,
@@ -1525,7 +1525,7 @@ var ScreensManager = /*#__PURE__*/function (_DefinitionsManager) {
1525
1525
  }]);
1526
1526
  }(DefinitionsManager);
1527
1527
 
1528
- var _excluded$4 = ["fonts"];
1528
+ var _excluded$5 = ["fonts"];
1529
1529
  var FontsParser = /*#__PURE__*/function () {
1530
1530
  function FontsParser(_ref) {
1531
1531
  var fieldsManager = _ref.fieldsManager,
@@ -1574,7 +1574,7 @@ var FontsParser = /*#__PURE__*/function () {
1574
1574
  var _this$parse = this.parse(theme),
1575
1575
  _this$parse$fonts = _this$parse.fonts,
1576
1576
  themeFonts = _this$parse$fonts === undefined ? [] : _this$parse$fonts,
1577
- newTheme = _objectWithoutProperties(_this$parse, _excluded$4);
1577
+ newTheme = _objectWithoutProperties(_this$parse, _excluded$5);
1578
1578
  return fonts.length > 0 || themeFonts.length > 0 ? _objectSpread(_objectSpread({}, story), {}, {
1579
1579
  theme: newTheme,
1580
1580
  fonts: uniq([].concat(_toConsumableArray(themeFonts), _toConsumableArray(fonts)), 'name')
@@ -1650,7 +1650,7 @@ var FontsParser = /*#__PURE__*/function () {
1650
1650
  }]);
1651
1651
  }();
1652
1652
 
1653
- var _excluded$3 = ["shareIncentive", "callToAction"];
1653
+ var _excluded$4 = ["shareIncentive", "callToAction"];
1654
1654
  /* eslint-disable class-methods-use-this */
1655
1655
  var ShareCall = /*#__PURE__*/function () {
1656
1656
  function ShareCall() {
@@ -1677,7 +1677,7 @@ var ShareCall = /*#__PURE__*/function () {
1677
1677
  shareIncentive = _ref2$shareIncentive === undefined ? null : _ref2$shareIncentive,
1678
1678
  _ref2$callToAction = _ref2.callToAction,
1679
1679
  callToAction = _ref2$callToAction === undefined ? null : _ref2$callToAction,
1680
- restScreen = _objectWithoutProperties(_ref2, _excluded$3);
1680
+ restScreen = _objectWithoutProperties(_ref2, _excluded$4);
1681
1681
  var _ref3 = screen || {},
1682
1682
  _ref3$header = _ref3.header,
1683
1683
  header = _ref3$header === undefined ? null : _ref3$header,
@@ -1705,8 +1705,59 @@ var ShareCall = /*#__PURE__*/function () {
1705
1705
  }]);
1706
1706
  }();
1707
1707
 
1708
+ var _excluded$3 = ["answers"],
1709
+ _excluded2$1 = ["customAnswerLabel"];
1710
+ /* eslint-disable class-methods-use-this */
1711
+ var CustomAnswerLabel = /*#__PURE__*/function () {
1712
+ function CustomAnswerLabel() {
1713
+ _classCallCheck(this, CustomAnswerLabel);
1714
+ }
1715
+ return _createClass(CustomAnswerLabel, [{
1716
+ key: "test",
1717
+ value: function test(screen) {
1718
+ var _ref = screen || {},
1719
+ _ref$answers = _ref.answers,
1720
+ answers = _ref$answers === undefined ? null : _ref$answers;
1721
+ if (answers === null || answers.length === 0) {
1722
+ return false;
1723
+ }
1724
+ var hasCustomAnswerLabel = answers.some(function () {
1725
+ var answer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1726
+ return answer !== null && typeof answer.customAnswerLabel !== 'undefined';
1727
+ });
1728
+ if (!hasCustomAnswerLabel) {
1729
+ return false;
1730
+ }
1731
+ return true;
1732
+ }
1733
+ }, {
1734
+ key: "parse",
1735
+ value: function parse(screen) {
1736
+ var _ref2 = screen || {},
1737
+ _ref2$answers = _ref2.answers,
1738
+ answers = _ref2$answers === undefined ? null : _ref2$answers,
1739
+ restScreen = _objectWithoutProperties(_ref2, _excluded$3);
1740
+ return _objectSpread(_objectSpread({}, restScreen), {}, {
1741
+ answers: answers.map(function () {
1742
+ var answer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1743
+ if (answer === null || typeof answer.customAnswerLabel === 'undefined') {
1744
+ return answer;
1745
+ }
1746
+ var _ref3 = answer || {},
1747
+ customAnswerLabel = _ref3.customAnswerLabel,
1748
+ restAnswer = _objectWithoutProperties(_ref3, _excluded2$1);
1749
+ return _objectSpread(_objectSpread({}, restAnswer), {}, {
1750
+ result: customAnswerLabel
1751
+ });
1752
+ })
1753
+ });
1754
+ }
1755
+ }]);
1756
+ }();
1757
+
1708
1758
  var migrations = /*#__PURE__*/Object.freeze({
1709
1759
  __proto__: null,
1760
+ CustomAnswerLabel: CustomAnswerLabel,
1710
1761
  ShareCall: ShareCall
1711
1762
  });
1712
1763
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/core",
3
- "version": "0.3.628",
3
+ "version": "0.3.651",
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": "6f1230244a2966c16e85b7d44583276421a38cca"
147
+ "gitHead": "9639dccc046f7adfe9673f53ede77360b8b75d51"
148
148
  }