@itcase/storybook-config 1.1.113 → 1.1.115

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.
@@ -10,13 +10,13 @@ function EmailTemplatePreview(props) {
10
10
  var style = {
11
11
  width: '100%',
12
12
  height: '100%',
13
+ border: '0',
13
14
  position: 'absolute',
14
15
  top: '0',
15
16
  right: '0',
16
17
  bottom: '0',
17
18
  left: '0',
18
19
  overflow: 'hidden',
19
- border: '0',
20
20
  overflowX: 'hidden',
21
21
  overflowY: 'hidden'
22
22
  };
@@ -9,7 +9,6 @@ function FormSubmitWrapper(props) {
9
9
  React.useEffect(function () {
10
10
  if (formRef != null && formRef.current && submit) {
11
11
  formRef.current.submit();
12
- console.log(formRef.current.getState());
13
12
  }
14
13
  }, [formRef]);
15
14
  return /*#__PURE__*/React.cloneElement(props.children, {
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+
5
+ function withClearStoresDecorator(_ref) {
6
+ var clearStoreData = _ref.clearStoreData;
7
+ var Decorator = function Decorator(Story) {
8
+ React.useMemo(function () {
9
+ clearStoreData();
10
+ }, [Story]);
11
+ return /*#__PURE__*/React.createElement(Story, null);
12
+ };
13
+ return Decorator;
14
+ }
15
+
16
+ exports.withClearStoresDecorator = withClearStoresDecorator;
@@ -6,8 +6,8 @@ require('lodash/camelCase');
6
6
  require('@itcase/common');
7
7
  var msw = require('msw');
8
8
 
9
- var serverErrorHandler = function serverErrorHandler(formUrl, errors) {
10
- return msw.http.post(formUrl, function () {
9
+ var serverErrorHandler = function serverErrorHandler(errors) {
10
+ return msw.http.post('*', function () {
11
11
  return msw.HttpResponse.json(errors, {
12
12
  status: 400
13
13
  });
@@ -19,7 +19,7 @@ function handleMSWParameters(parameters, args) {
19
19
  if (parameters.serverError) {
20
20
  mswHandlersParams = {
21
21
  msw: {
22
- handlers: [serverErrorHandler(parameters.formUrl, args.errors)]
22
+ handlers: [serverErrorHandler(args.errors)]
23
23
  }
24
24
  };
25
25
  }
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var withClearStoresDecorator = require('./decorators/withClearStoresDecorator.js');
3
4
  var withExtraProviders = require('./decorators/withExtraProviders.js');
4
5
  var withFigmaSourceLink = require('./decorators/withFigmaSourceLink.js');
5
6
  var withFormSubmitDecorator = require('./decorators/withFormSubmitDecorator.js');
@@ -17,6 +18,7 @@ require('@itcase/ui/context/UIContext');
17
18
 
18
19
 
19
20
 
21
+ exports.withClearStoresDecorator = withClearStoresDecorator.withClearStoresDecorator;
20
22
  exports.withExtraProviders = withExtraProviders.withExtraProviders;
21
23
  exports.withFigmaSourceLink = withFigmaSourceLink.withFigmaSourceLink;
22
24
  exports.withFormSubmitDecorator = withFormSubmitDecorator.withFormSubmitDecorator;
@@ -8,13 +8,13 @@ function EmailTemplatePreview(props) {
8
8
  var style = {
9
9
  width: '100%',
10
10
  height: '100%',
11
+ border: '0',
11
12
  position: 'absolute',
12
13
  top: '0',
13
14
  right: '0',
14
15
  bottom: '0',
15
16
  left: '0',
16
17
  overflow: 'hidden',
17
- border: '0',
18
18
  overflowX: 'hidden',
19
19
  overflowY: 'hidden'
20
20
  };
@@ -7,7 +7,6 @@ function FormSubmitWrapper(props) {
7
7
  useEffect(function () {
8
8
  if (formRef != null && formRef.current && submit) {
9
9
  formRef.current.submit();
10
- console.log(formRef.current.getState());
11
10
  }
12
11
  }, [formRef]);
13
12
  return /*#__PURE__*/React.cloneElement(props.children, {
@@ -1,3 +1,3 @@
1
1
  import { serverErrorDataHandler, serverErrorHandler } from './mswHandlers'
2
2
 
3
- export { serverErrorHandler, serverErrorDataHandler }
3
+ export { serverErrorDataHandler, serverErrorHandler }
@@ -1,15 +1,15 @@
1
1
  import { http, HttpResponse } from 'msw'
2
2
 
3
- const serverErrorHandler = (formUrl, errors) => {
4
- return http.post(formUrl, () => {
3
+ const serverErrorHandler = (errors) => {
4
+ return http.post('*', () => {
5
5
  return HttpResponse.json(errors, { status: 400 })
6
6
  })
7
7
  }
8
8
 
9
- const serverErrorDataHandler = (formUrl, message) => {
10
- return http.post(formUrl, () => {
9
+ const serverErrorDataHandler = (message) => {
10
+ return http.post('*', () => {
11
11
  return HttpResponse.json({ non_field_errors: message }, { status: 400 })
12
12
  })
13
13
  }
14
14
 
15
- export { serverErrorHandler, serverErrorDataHandler }
15
+ export { serverErrorDataHandler, serverErrorHandler }
@@ -0,0 +1,14 @@
1
+ import React, { useMemo } from 'react';
2
+
3
+ function withClearStoresDecorator(_ref) {
4
+ var clearStoreData = _ref.clearStoreData;
5
+ var Decorator = function Decorator(Story) {
6
+ useMemo(function () {
7
+ clearStoreData();
8
+ }, [Story]);
9
+ return /*#__PURE__*/React.createElement(Story, null);
10
+ };
11
+ return Decorator;
12
+ }
13
+
14
+ export { withClearStoresDecorator };
@@ -4,8 +4,8 @@ import 'lodash/camelCase';
4
4
  import '@itcase/common';
5
5
  import { http, HttpResponse } from 'msw';
6
6
 
7
- var serverErrorHandler = function serverErrorHandler(formUrl, errors) {
8
- return http.post(formUrl, function () {
7
+ var serverErrorHandler = function serverErrorHandler(errors) {
8
+ return http.post('*', function () {
9
9
  return HttpResponse.json(errors, {
10
10
  status: 400
11
11
  });
@@ -17,7 +17,7 @@ function handleMSWParameters(parameters, args) {
17
17
  if (parameters.serverError) {
18
18
  mswHandlersParams = {
19
19
  msw: {
20
- handlers: [serverErrorHandler(parameters.formUrl, args.errors)]
20
+ handlers: [serverErrorHandler(args.errors)]
21
21
  }
22
22
  };
23
23
  }
@@ -1,3 +1,4 @@
1
+ export { withClearStoresDecorator } from './decorators/withClearStoresDecorator.js';
1
2
  export { withExtraProviders } from './decorators/withExtraProviders.js';
2
3
  export { withFigmaSourceLink } from './decorators/withFigmaSourceLink.js';
3
4
  export { withFormSubmitDecorator } from './decorators/withFormSubmitDecorator.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/storybook-config",
3
- "version": "1.1.113",
3
+ "version": "1.1.115",
4
4
  "author": "ITCase",
5
5
  "description": "Storybook configuration package",
6
6
  "engines": {
@@ -101,7 +101,7 @@
101
101
  "@commitlint/cli": "^19.8.1",
102
102
  "@commitlint/config-conventional": "^19.8.1",
103
103
  "@itcase/common": "^1.2.29",
104
- "@itcase/lint": "^1.1.42",
104
+ "@itcase/lint": "^1.1.43",
105
105
  "@rollup/plugin-babel": "^6.0.4",
106
106
  "@rollup/plugin-commonjs": "^28.0.6",
107
107
  "@rollup/plugin-json": "^6.1.0",