@itcase/storybook-config 1.1.53 → 1.1.54
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/dist/cjs/decorators.js +4 -25
- package/dist/config/msw/index.js +2 -6
- package/dist/config/msw/mswHandlers.js +2 -14
- package/dist/config/mswHandlers.js +2 -14
- package/dist/decorators.js +5 -26
- package/dist/utils/handleMSWParameters.js +1 -11
- package/dist/utils/hasFormParameters.js +1 -2
- package/package.json +3 -3
package/dist/cjs/decorators.js
CHANGED
|
@@ -382,24 +382,6 @@ var error500Handler = function error500Handler(formUrl) {
|
|
|
382
382
|
}, _callee2);
|
|
383
383
|
})));
|
|
384
384
|
};
|
|
385
|
-
var loadingHandler = function loadingHandler(formUrl) {
|
|
386
|
-
msw.http.post(formUrl, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
387
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
388
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
389
|
-
case 0:
|
|
390
|
-
_context3.next = 2;
|
|
391
|
-
return msw.delay(60000);
|
|
392
|
-
case 2:
|
|
393
|
-
return _context3.abrupt("return", msw.HttpResponse({}, {
|
|
394
|
-
status: 200
|
|
395
|
-
}));
|
|
396
|
-
case 3:
|
|
397
|
-
case "end":
|
|
398
|
-
return _context3.stop();
|
|
399
|
-
}
|
|
400
|
-
}, _callee3);
|
|
401
|
-
})));
|
|
402
|
-
};
|
|
403
385
|
|
|
404
386
|
function handleMSWParameters(parameters, args) {
|
|
405
387
|
var mswHandlersParams = {};
|
|
@@ -415,18 +397,12 @@ function handleMSWParameters(parameters, args) {
|
|
|
415
397
|
handlers: [error500Handler(parameters.formUrl)]
|
|
416
398
|
}
|
|
417
399
|
};
|
|
418
|
-
} else if (parameters.loading) {
|
|
419
|
-
mswHandlersParams = {
|
|
420
|
-
msw: {
|
|
421
|
-
handlers: [loadingHandler(parameters.formUrl)]
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
400
|
}
|
|
425
401
|
return mswHandlersParams;
|
|
426
402
|
}
|
|
427
403
|
|
|
428
404
|
function hasFormParameters(parameters) {
|
|
429
|
-
return Boolean(parameters.require || parameters.validation || parameters.serverError || parameters.error500
|
|
405
|
+
return Boolean(parameters.require || parameters.validation || parameters.serverError || parameters.error500);
|
|
430
406
|
}
|
|
431
407
|
|
|
432
408
|
function withNextDecoratorFactory(_ref) {
|
|
@@ -449,6 +425,9 @@ function withNextDecoratorFactory(_ref) {
|
|
|
449
425
|
if (hasFormParameters(parameters) && !parameters.formUrl) {
|
|
450
426
|
throw new Error('Set "formUrl" in stories!');
|
|
451
427
|
}
|
|
428
|
+
if (parameters.storeData) {
|
|
429
|
+
throw new Error('Use store/s/DataSet, add "s"!');
|
|
430
|
+
}
|
|
452
431
|
return /*#__PURE__*/React.createElement(RootStoreProvider, parameters.storesData, /*#__PURE__*/React.createElement(UIContext.UIProvider, null, /*#__PURE__*/React.createElement(Notifications.NotificationsProvider, null, hasFormParameters(parameters) ? /*#__PURE__*/React.createElement(index.FormSubmitWrapper, updatedContext, /*#__PURE__*/React.createElement(Story, updatedContext)) : /*#__PURE__*/React.createElement(Story, updatedContext))));
|
|
453
432
|
};
|
|
454
433
|
return decorator;
|
package/dist/config/msw/index.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
error500Handler,
|
|
3
|
-
loadingHandler,
|
|
4
|
-
serverErrorHandler,
|
|
5
|
-
} from './mswHandlers'
|
|
1
|
+
import { error500Handler, serverErrorHandler } from './mswHandlers'
|
|
6
2
|
|
|
7
|
-
export { serverErrorHandler, error500Handler
|
|
3
|
+
export { serverErrorHandler, error500Handler }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { http, HttpResponse } from 'msw'
|
|
2
2
|
|
|
3
3
|
const serverErrorHandler = (formUrl, errors) => {
|
|
4
4
|
return http.post(formUrl, async () => {
|
|
@@ -17,16 +17,4 @@ const error500Handler = (formUrl) => {
|
|
|
17
17
|
})
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
http.post(formUrl, async () => {
|
|
22
|
-
await delay(60000)
|
|
23
|
-
return HttpResponse(
|
|
24
|
-
{},
|
|
25
|
-
{
|
|
26
|
-
status: 200,
|
|
27
|
-
},
|
|
28
|
-
)
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { serverErrorHandler, error500Handler, loadingHandler }
|
|
20
|
+
export { serverErrorHandler, error500Handler }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { http, HttpResponse } from 'msw'
|
|
2
2
|
|
|
3
3
|
const serverErrorHandler = (formUrl, errors) => {
|
|
4
4
|
return http.post(formUrl, async () => {
|
|
@@ -17,16 +17,4 @@ const error500Handler = (formUrl) => {
|
|
|
17
17
|
})
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
http.post(formUrl, async () => {
|
|
22
|
-
await delay(60000)
|
|
23
|
-
return HttpResponse(
|
|
24
|
-
{},
|
|
25
|
-
{
|
|
26
|
-
status: 200,
|
|
27
|
-
},
|
|
28
|
-
)
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { serverErrorHandler, error500Handler, loadingHandler }
|
|
20
|
+
export { serverErrorHandler, error500Handler }
|
package/dist/decorators.js
CHANGED
|
@@ -4,7 +4,7 @@ import { UIProvider } from '@itcase/ui/context/UIContext';
|
|
|
4
4
|
import { FormSubmitWrapper } from './components/FormSubmitWrapper.js';
|
|
5
5
|
import 'lodash/camelCase';
|
|
6
6
|
import '@itcase/common';
|
|
7
|
-
import { http, HttpResponse
|
|
7
|
+
import { http, HttpResponse } from 'msw';
|
|
8
8
|
|
|
9
9
|
function withExtraProviders(providers) {
|
|
10
10
|
if (providers === void 0) {
|
|
@@ -380,24 +380,6 @@ var error500Handler = function error500Handler(formUrl) {
|
|
|
380
380
|
}, _callee2);
|
|
381
381
|
})));
|
|
382
382
|
};
|
|
383
|
-
var loadingHandler = function loadingHandler(formUrl) {
|
|
384
|
-
http.post(formUrl, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
385
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
386
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
387
|
-
case 0:
|
|
388
|
-
_context3.next = 2;
|
|
389
|
-
return delay(60000);
|
|
390
|
-
case 2:
|
|
391
|
-
return _context3.abrupt("return", HttpResponse({}, {
|
|
392
|
-
status: 200
|
|
393
|
-
}));
|
|
394
|
-
case 3:
|
|
395
|
-
case "end":
|
|
396
|
-
return _context3.stop();
|
|
397
|
-
}
|
|
398
|
-
}, _callee3);
|
|
399
|
-
})));
|
|
400
|
-
};
|
|
401
383
|
|
|
402
384
|
function handleMSWParameters(parameters, args) {
|
|
403
385
|
var mswHandlersParams = {};
|
|
@@ -413,18 +395,12 @@ function handleMSWParameters(parameters, args) {
|
|
|
413
395
|
handlers: [error500Handler(parameters.formUrl)]
|
|
414
396
|
}
|
|
415
397
|
};
|
|
416
|
-
} else if (parameters.loading) {
|
|
417
|
-
mswHandlersParams = {
|
|
418
|
-
msw: {
|
|
419
|
-
handlers: [loadingHandler(parameters.formUrl)]
|
|
420
|
-
}
|
|
421
|
-
};
|
|
422
398
|
}
|
|
423
399
|
return mswHandlersParams;
|
|
424
400
|
}
|
|
425
401
|
|
|
426
402
|
function hasFormParameters(parameters) {
|
|
427
|
-
return Boolean(parameters.require || parameters.validation || parameters.serverError || parameters.error500
|
|
403
|
+
return Boolean(parameters.require || parameters.validation || parameters.serverError || parameters.error500);
|
|
428
404
|
}
|
|
429
405
|
|
|
430
406
|
function withNextDecoratorFactory(_ref) {
|
|
@@ -447,6 +423,9 @@ function withNextDecoratorFactory(_ref) {
|
|
|
447
423
|
if (hasFormParameters(parameters) && !parameters.formUrl) {
|
|
448
424
|
throw new Error('Set "formUrl" in stories!');
|
|
449
425
|
}
|
|
426
|
+
if (parameters.storeData) {
|
|
427
|
+
throw new Error('Use store/s/DataSet, add "s"!');
|
|
428
|
+
}
|
|
450
429
|
return /*#__PURE__*/React.createElement(RootStoreProvider, parameters.storesData, /*#__PURE__*/React.createElement(UIProvider, null, /*#__PURE__*/React.createElement(NotificationsProvider, null, hasFormParameters(parameters) ? /*#__PURE__*/React.createElement(FormSubmitWrapper, updatedContext, /*#__PURE__*/React.createElement(Story, updatedContext)) : /*#__PURE__*/React.createElement(Story, updatedContext))));
|
|
451
430
|
};
|
|
452
431
|
return decorator;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
error500Handler,
|
|
3
|
-
loadingHandler,
|
|
4
|
-
serverErrorHandler,
|
|
5
|
-
} from '../config/msw'
|
|
1
|
+
import { error500Handler, serverErrorHandler } from '../config/msw'
|
|
6
2
|
|
|
7
3
|
function handleMSWParameters(parameters, args) {
|
|
8
4
|
let mswHandlersParams = {}
|
|
@@ -19,12 +15,6 @@ function handleMSWParameters(parameters, args) {
|
|
|
19
15
|
handlers: [error500Handler(parameters.formUrl)],
|
|
20
16
|
},
|
|
21
17
|
}
|
|
22
|
-
} else if (parameters.loading) {
|
|
23
|
-
mswHandlersParams = {
|
|
24
|
-
msw: {
|
|
25
|
-
handlers: [loadingHandler(parameters.formUrl)],
|
|
26
|
-
},
|
|
27
|
-
}
|
|
28
18
|
}
|
|
29
19
|
|
|
30
20
|
return mswHandlersParams
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/storybook-config",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.54",
|
|
4
4
|
"author": "ITCase",
|
|
5
5
|
"description": "Code style linter configuration presets",
|
|
6
6
|
"engines": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"workerDirectory": "public"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@itcase/config": "^1.0.
|
|
69
|
+
"@itcase/config": "^1.0.54",
|
|
70
70
|
"@itcase/storybook-addon-auth": "^1.0.5",
|
|
71
71
|
"@storybook/addon-designs": "^10.0.1",
|
|
72
72
|
"@storybook/addon-links": "^9.0.16",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"@commitlint/cli": "^19.8.1",
|
|
89
89
|
"@commitlint/config-conventional": "^19.8.1",
|
|
90
90
|
"@itcase/common": "^1.2.28",
|
|
91
|
-
"@itcase/lint": "^1.1.
|
|
91
|
+
"@itcase/lint": "^1.1.27",
|
|
92
92
|
"@rollup/plugin-babel": "^6.0.4",
|
|
93
93
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
94
94
|
"@rollup/plugin-json": "^6.1.0",
|