@micromag/data 0.3.246 → 0.3.251

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/index.js CHANGED
@@ -11,7 +11,6 @@ import { generatePath } from 'react-router';
11
11
  import { stringify } from 'query-string';
12
12
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
13
13
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
14
- import { useVisitor, useStory } from '@micromag/core/contexts';
15
14
 
16
15
  var Base = /*#__PURE__*/function () {
17
16
  function Base() {
@@ -879,9 +878,7 @@ var useQuizCreate = function useQuizCreate() {
879
878
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
880
879
  screenId = _ref.screenId,
881
880
  _ref$visitorId = _ref.visitorId,
882
- providedVisitorId = _ref$visitorId === void 0 ? null : _ref$visitorId,
883
- _ref$storyId = _ref.storyId,
884
- providedStoryId = _ref$storyId === void 0 ? null : _ref$storyId,
881
+ visitorId = _ref$visitorId === void 0 ? null : _ref$visitorId,
885
882
  _ref$onSuccess = _ref.onSuccess,
886
883
  onSuccess = _ref$onSuccess === void 0 ? null : _ref$onSuccess;
887
884
 
@@ -892,12 +889,6 @@ var useQuizCreate = function useQuizCreate() {
892
889
  creating = _useState2[0],
893
890
  setCreating = _useState2[1];
894
891
 
895
- var _ref2 = useVisitor() || {},
896
- visitorId = _ref2.id;
897
-
898
- var _ref3 = useStory() || {},
899
- storyId = _ref3.id;
900
-
901
892
  var create = useCallback(function (data) {
902
893
  if (api === null) {
903
894
  return null;
@@ -906,8 +897,7 @@ var useQuizCreate = function useQuizCreate() {
906
897
  setCreating(true);
907
898
  return api.quiz.create(_objectSpread({
908
899
  screen_id: screenId,
909
- visitor_id: providedVisitorId || visitorId,
910
- story_id: providedStoryId || storyId
900
+ visitor_id: visitorId
911
901
  }, data)).then(function (response) {
912
902
  setCreating(false);
913
903
 
@@ -917,7 +907,7 @@ var useQuizCreate = function useQuizCreate() {
917
907
 
918
908
  return response;
919
909
  });
920
- }, [api, setCreating, onSuccess, screenId, visitorId, storyId, providedVisitorId, providedStoryId]);
910
+ }, [api, setCreating, onSuccess, screenId, visitorId]);
921
911
  return {
922
912
  create: create,
923
913
  creating: creating
package/lib/index.js CHANGED
@@ -15,7 +15,6 @@ var reactRouter = require('react-router');
15
15
  var queryString = require('query-string');
16
16
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
17
17
  var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
18
- var contexts = require('@micromag/core/contexts');
19
18
 
20
19
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
20
 
@@ -896,9 +895,7 @@ var useQuizCreate = function useQuizCreate() {
896
895
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
897
896
  screenId = _ref.screenId,
898
897
  _ref$visitorId = _ref.visitorId,
899
- providedVisitorId = _ref$visitorId === void 0 ? null : _ref$visitorId,
900
- _ref$storyId = _ref.storyId,
901
- providedStoryId = _ref$storyId === void 0 ? null : _ref$storyId,
898
+ visitorId = _ref$visitorId === void 0 ? null : _ref$visitorId,
902
899
  _ref$onSuccess = _ref.onSuccess,
903
900
  onSuccess = _ref$onSuccess === void 0 ? null : _ref$onSuccess;
904
901
 
@@ -909,12 +906,6 @@ var useQuizCreate = function useQuizCreate() {
909
906
  creating = _useState2[0],
910
907
  setCreating = _useState2[1];
911
908
 
912
- var _ref2 = contexts.useVisitor() || {},
913
- visitorId = _ref2.id;
914
-
915
- var _ref3 = contexts.useStory() || {},
916
- storyId = _ref3.id;
917
-
918
909
  var create = React.useCallback(function (data) {
919
910
  if (api === null) {
920
911
  return null;
@@ -923,8 +914,7 @@ var useQuizCreate = function useQuizCreate() {
923
914
  setCreating(true);
924
915
  return api.quiz.create(_objectSpread__default["default"]({
925
916
  screen_id: screenId,
926
- visitor_id: providedVisitorId || visitorId,
927
- story_id: providedStoryId || storyId
917
+ visitor_id: visitorId
928
918
  }, data)).then(function (response) {
929
919
  setCreating(false);
930
920
 
@@ -934,7 +924,7 @@ var useQuizCreate = function useQuizCreate() {
934
924
 
935
925
  return response;
936
926
  });
937
- }, [api, setCreating, onSuccess, screenId, visitorId, storyId, providedVisitorId, providedStoryId]);
927
+ }, [api, setCreating, onSuccess, screenId, visitorId]);
938
928
  return {
939
929
  create: create,
940
930
  creating: creating
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/data",
3
- "version": "0.3.246",
3
+ "version": "0.3.251",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -50,7 +50,7 @@
50
50
  "dependencies": {
51
51
  "@babel/runtime": "^7.13.10",
52
52
  "@folklore/fetch": "^0.1.15",
53
- "@micromag/core": "^0.3.246",
53
+ "@micromag/core": "^0.3.251",
54
54
  "prop-types": "^15.7.2",
55
55
  "query-string": "^6.13.7",
56
56
  "react-router": "^5.2.0"
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "473a4ad55684e54d3f1e62e760792ed6e003f8e7"
61
+ "gitHead": "3b6fb00baaa7f3ab90684a88cbe4c30929b6b27d"
62
62
  }