x25 17.0.14 → 17.0.18

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.
Files changed (123) hide show
  1. package/package.json +59 -75
  2. package/Account/Load.js +0 -78
  3. package/Account/actions.js +0 -15
  4. package/Account/index.js +0 -20
  5. package/Account/reducer.js +0 -122
  6. package/Account/request.js +0 -44
  7. package/Async/InitModule.js +0 -190
  8. package/Async/RouteLoading.js +0 -66
  9. package/Async/SimulatedException.js +0 -44
  10. package/Async/index.js +0 -98
  11. package/Async/types.js +0 -1
  12. package/Company/Load.js +0 -85
  13. package/Company/actions.js +0 -15
  14. package/Company/index.js +0 -20
  15. package/Company/reducer.js +0 -165
  16. package/Company/request.js +0 -36
  17. package/Company/util.js +0 -10
  18. package/Header/AccountOptionsContainer.js +0 -146
  19. package/Header/AdminSelectCompany.js +0 -109
  20. package/Header/ClientSelectCompany.js +0 -106
  21. package/Header/Header.js +0 -129
  22. package/Header/HeaderContainer.js +0 -39
  23. package/Header/Logo.js +0 -30
  24. package/Header/LogoutButton.js +0 -41
  25. package/Header/index.js +0 -19
  26. package/Header/request.js +0 -26
  27. package/Header/types.js +0 -1
  28. package/Header/util.js +0 -60
  29. package/Inputs/Business/BankAccount.js +0 -50
  30. package/Inputs/Business/BankName.js +0 -51
  31. package/Inputs/Business/CifField.js +0 -114
  32. package/Inputs/Business/CifFieldContainer.js +0 -157
  33. package/Inputs/Business/Email.js +0 -37
  34. package/Inputs/Business/NidField.js +0 -93
  35. package/Inputs/Business/Phone.js +0 -37
  36. package/Inputs/Business/index.js +0 -34
  37. package/Inputs/Business/request.js +0 -39
  38. package/Inputs/CaptchaBox.js +0 -153
  39. package/Inputs/DateInput.js +0 -172
  40. package/Inputs/DateTemplate.js +0 -200
  41. package/Inputs/DelayInputChange.js +0 -135
  42. package/Inputs/FocusTemplate.js +0 -47
  43. package/Inputs/InputTemplate.js +0 -78
  44. package/Inputs/LabelTemplate.js +0 -59
  45. package/Inputs/NumericInput.js +0 -139
  46. package/Inputs/NumericTemplate.js +0 -148
  47. package/Inputs/Selects/County.js +0 -29
  48. package/Inputs/Selects/Custom.js +0 -56
  49. package/Inputs/Selects/Simple.js +0 -77
  50. package/Inputs/Selects/index.js +0 -52
  51. package/Inputs/SimpleInput.js +0 -42
  52. package/Inputs/SimpleTextarea.js +0 -47
  53. package/Inputs/TextareaTemplate.js +0 -55
  54. package/Inputs/Tooltip.js +0 -82
  55. package/Inputs/index.js +0 -185
  56. package/Messages/Error.js +0 -108
  57. package/Messages/Loading.js +0 -70
  58. package/Messages/index.js +0 -29
  59. package/Modal/Delete.js +0 -240
  60. package/Modal/Root.js +0 -81
  61. package/Modal/SimpleModal.js +0 -57
  62. package/Modal/actions.js +0 -10
  63. package/Modal/getComponent.js +0 -42
  64. package/Modal/index.js +0 -22
  65. package/Modal/reducer.js +0 -53
  66. package/Modal/types.js +0 -7
  67. package/Modal/util.js +0 -17
  68. package/Payment/EstimatePrice/Description.js +0 -92
  69. package/Payment/EstimatePrice/PayBox.js +0 -220
  70. package/Payment/EstimatePrice/index.js +0 -92
  71. package/Payment/EstimatePrice/util.js +0 -21
  72. package/Payment/MobilpayForm.js +0 -86
  73. package/Payment/Modal/BankTransfer.js +0 -233
  74. package/Payment/Modal/CompanyValability.js +0 -28
  75. package/Payment/Modal/DoneForm.js +0 -222
  76. package/Payment/Modal/PaymentDone.js +0 -53
  77. package/Payment/Modal/index.js +0 -27
  78. package/Payment/actions.js +0 -23
  79. package/Payment/codes.js +0 -53
  80. package/Payment/index.js +0 -141
  81. package/Payment/request.js +0 -49
  82. package/Payment/types.js +0 -1
  83. package/Payment/util.js +0 -50
  84. package/Payment/validate.js +0 -23
  85. package/Sidebar.js +0 -156
  86. package/Things.js +0 -53
  87. package/actions.js +0 -73
  88. package/config.js +0 -10
  89. package/dev/ErrorBoundary.js +0 -111
  90. package/dev/TheError.js +0 -113
  91. package/dev/index.js +0 -134
  92. package/dev/types.js +0 -1
  93. package/prod/SentryErrorBoundary.js +0 -140
  94. package/reducer/captchas.js +0 -51
  95. package/reducer/counties.js +0 -57
  96. package/reducer/index.js +0 -38
  97. package/reducer/module.js +0 -48
  98. package/types.js +0 -1
  99. package/utility/calendar.js +0 -45
  100. package/utility/date.js +0 -111
  101. package/utility/index.js +0 -125
  102. package/utility/mql.js +0 -6
  103. package/utility/normalize-test.js +0 -54
  104. package/utility/normalize.js +0 -110
  105. package/utility/numbers.js +0 -93
  106. package/utility/numeric.js +0 -103
  107. package/utility/others.js +0 -92
  108. package/utility/strings-test.js +0 -216
  109. package/utility/strings.js +0 -85
  110. package/utility/validation/common.js +0 -277
  111. package/utility/validation/index.js +0 -112
  112. package/utility/validation/specific.js +0 -14
  113. package/utility/validation/validate/bank-test.js +0 -41
  114. package/utility/validation/validate/bank.js +0 -176
  115. package/utility/validation/validate/cif-test.js +0 -37
  116. package/utility/validation/validate/cif.js +0 -44
  117. package/utility/validation/validate/cnp-test.js +0 -68
  118. package/utility/validation/validate/cnp.js +0 -193
  119. package/utility/validation/validate/date.js +0 -61
  120. package/utility/validation/validate/email-test.js +0 -30
  121. package/utility/validation/validate/email.js +0 -11
  122. package/utility/validation/validate/index.js +0 -65
  123. package/utility/words.js +0 -176
package/package.json CHANGED
@@ -1,19 +1,23 @@
1
1
  {
2
- "version": "17.0.14",
2
+ "version": "17.0.18",
3
3
  "name": "x25",
4
4
  "description": "x25",
5
5
  "scripts": {
6
6
  "load": "npm run intern-pre && cd dist && npm publish",
7
7
  "load-beta": "npm run intern-pre && cd dist && npm publish --tag beta",
8
- "check": "npm-check -u -i babel-jest -i jest --specials=bin,eslint,babel,webpack",
9
- "eslint": "eslint --ext .jsx,.js src --fix",
8
+ "eslint": "eslint --ext .tsx,.ts src --fix",
10
9
  "intern-pre": "npm run intern-test && npm run eslint && npm run intern-clean && npm run intern-build && npm run intern-copy",
11
10
  "intern-build-scss": "node-sass --output-style compressed src -o dist",
12
11
  "intern-build-babel": "babel src --out-dir dist",
13
12
  "intern-copy": "copy package.json dist",
14
13
  "intern-build": "npm run intern-build-scss && npm run intern-build-babel",
15
14
  "intern-clean": "rimraf dist dist",
16
- "intern-test": "jest"
15
+ "intern-test": "jest",
16
+ "check": "npm run depcheck & npm run check:npm-check",
17
+ "check:npm-check": "npm-check -u -i babel-jest -i jest --specials=bin,eslint,babel,webpack",
18
+ "depcheck": "depcheck --ignores=webpack-cli,@hot-loader/react-dom --ignore-patterns=server,node_modules,tmp,fonts",
19
+ "check:global": "npm-check -gu",
20
+ "ts:check": "tsc --noEmit"
17
21
  },
18
22
  "repository": {
19
23
  "type": "git",
@@ -28,29 +32,29 @@
28
32
  "homepage": "https://github.com/cristian-sima/x25#readme",
29
33
  "babel": {
30
34
  "presets": [
31
- "env",
32
- "stage-0",
33
- "react"
35
+ "@babel/env",
36
+ "@babel/preset-typescript",
37
+ "@babel/preset-react"
34
38
  ],
35
39
  "env": {
36
40
  "production": {
37
41
  "plugins": [
38
- "transform-decorators-legacy",
39
- "react-html-attrs",
40
- "transform-class-properties",
41
- "transform-react-constant-elements",
42
- "transform-react-inline-elements",
43
- "transform-react-remove-prop-types",
44
- "transform-flow-strip-types"
42
+ "@babel/plugin-syntax-dynamic-import",
43
+ "@babel/plugin-proposal-class-properties",
44
+ "@babel/plugin-proposal-export-default-from",
45
+ "@babel/plugin-transform-modules-commonjs",
46
+ "@babel/plugin-transform-react-constant-elements",
47
+ "@babel/plugin-transform-react-inline-elements",
48
+ "@babel/plugin-transform-typescript",
49
+ "transform-react-remove-prop-types"
45
50
  ]
46
51
  },
47
- "developmentTime": {
52
+ "development": {
48
53
  "plugins": [
49
- "transform-decorators-legacy",
50
- "react-hot-loader/babel",
51
- "flow-react-proptypes",
52
- "react-html-attrs",
53
- "transform-class-properties"
54
+ "@babel/plugin-syntax-dynamic-import",
55
+ "@babel/plugin-proposal-class-properties",
56
+ "@babel/plugin-proposal-export-default-from",
57
+ "@babel/plugin-transform-modules-commonjs"
54
58
  ]
55
59
  }
56
60
  }
@@ -60,78 +64,58 @@
60
64
  },
61
65
  "jest": {
62
66
  "transform": {
63
- "^.+\\.jsx?$": "babel-jest"
67
+ "^.+\\.tsx?$": "babel-jest"
64
68
  },
65
- "testRegex": "src/.*-test.js$",
69
+ "testRegex": "src/.*-test.ts$",
66
70
  "modulePaths": [
67
71
  "src"
68
72
  ]
69
73
  },
70
74
  "devDependencies": {
71
- "babel-cli": "^6.26.0",
72
- "babel-core": "^6.26.3",
73
- "babel-eslint": "^10.0.2",
74
- "babel-jest": "^23.6.0",
75
- "babel-loader": "^8.0.6",
76
- "babel-plugin-add-module-exports": "^1.0.4",
77
- "babel-plugin-flow-react-proptypes": "^25.1.0",
78
- "babel-plugin-react-html-attrs": "^2.1.0",
79
- "babel-plugin-syntax-flow": "^6.18.0",
80
- "babel-plugin-transform-class-properties": "^6.24.1",
81
- "babel-plugin-transform-decorators-legacy": "^1.3.5",
82
- "babel-plugin-transform-flow-strip-types": "^6.22.0",
83
- "babel-plugin-transform-react-constant-elements": "^6.23.0",
84
- "babel-plugin-transform-react-inline-elements": "^6.22.0",
75
+ "@babel/plugin-proposal-class-properties": "^7.16.7",
76
+ "@babel/plugin-proposal-export-default-from": "^7.16.7",
77
+ "@babel/plugin-syntax-dynamic-import": "^7.8.3",
78
+ "@babel/plugin-transform-modules-commonjs": "^7.16.8",
79
+ "@babel/plugin-transform-react-constant-elements": "^7.16.7",
80
+ "@babel/plugin-transform-react-inline-elements": "^7.16.7",
81
+ "@babel/plugin-transform-typescript": "^7.16.8",
82
+ "@babel/preset-env": "^7.16.11",
83
+ "@babel/preset-react": "^7.16.7",
84
+ "@babel/preset-typescript": "^7.16.7",
85
+ "@types/jest": "^27.4.0",
86
+ "@types/superagent": "^4.1.15",
87
+ "@typescript-eslint/eslint-plugin": "^5.11.0",
88
+ "@typescript-eslint/parser": "^5.11.0",
89
+ "add-matchers": "^0.6.2",
90
+ "babel-loader": "^8.2.3",
85
91
  "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
86
- "babel-polyfill": "^6.26.0",
87
- "babel-preset-env": "^1.7.0",
88
- "babel-preset-es2015": "^6.24.1",
89
- "babel-preset-react": "^6.24.1",
90
- "babel-preset-stage-0": "^6.24.1",
91
- "cross-env": "^6.0.3",
92
- "css-loader": "^3.2.0",
93
- "es3ify": "^0.2.2",
94
- "eslint": "^6.6.0",
95
- "eslint-plugin-flowtype": "^4.4.1",
96
- "eslint-plugin-jsx-a11y": "^6.2.3",
97
- "eslint-plugin-react": "^7.16.0",
98
- "eslint-plugin-react-hooks": "^4.3.0",
99
- "file-loader": "^4.3.0",
100
- "flow-bin": "^0.112.0",
101
- "flow-status-webpack-plugin": "^0.1.7",
102
- "jest": "^23.6.0",
103
- "jest-immutable-matchers": "^2.0.1",
104
- "json-loader": "^0.5.7",
105
- "node-sass": "^4.13.0",
92
+ "copy": "^0.3.2",
93
+ "css-loader": "^6.6.0",
94
+ "depcheck": "^1.4.3",
95
+ "eslint": "^8.9.0",
96
+ "eslint-plugin-import": "^2.25.4",
97
+ "eslint-plugin-react": "^7.28.0",
98
+ "jest-cli": "^27.5.1",
99
+ "jest-immutable-matchers": "^3.0.0",
106
100
  "npm-check": "^5.9.2",
107
- "npm-check-unused": "^6.0.0",
108
- "npm-check-updates": "^3.2.1",
109
- "postcss-loader": "^3.0.0",
110
- "sass-loader": "^8.0.0",
111
- "scss-compile": "^0.1.7",
112
- "style-loader": "^1.0.0",
113
- "url-loader": "^2.3.0",
114
- "webpack": "^4.41.2",
115
- "webpack-cli": "^3.3.10",
116
- "webpack-dev-server": "^3.9.0",
117
- "webpack-git-hash": "^1.0.2",
118
- "webpack-preset": "^0.2.0",
119
- "webpack-preset-babel": "^0.2.0",
120
- "webpack-preset-babel-stage-2": "^0.2.0"
101
+ "style-loader": "^3.3.1",
102
+ "ts-loader": "^9.2.6",
103
+ "webpack": "^5.68.0"
121
104
  },
122
105
  "dependencies": {
123
- "@sentry/browser": "^6.17.3",
106
+ "@docusaurus/react-loadable": "^5.5.2",
107
+ "@sentry/browser": "^6.17.7",
124
108
  "big.js": "^6.1.1",
125
109
  "classnames": "^2.3.1",
126
- "copy": "^0.3.2",
127
110
  "immutable": "^4.0.0-rc.12",
111
+ "jest": "^27.5.1",
128
112
  "moment": "^2.29.1",
113
+ "node-sass": "^7.0.1",
129
114
  "react": "^17.0.2",
130
115
  "react-dom": "^17.0.2",
131
- "react-loadable": "~5.5.0",
132
- "react-notification-system-redux2": "^3.0.2",
116
+ "react-notification-system-redux2": "^3.0.4",
133
117
  "react-redux": "^7.2.6",
134
- "react-router-dom": "^5.2.0",
118
+ "react-router-dom": "^6.2.1",
135
119
  "react-select": "^5.2.2",
136
120
  "react-sidebar": "^3.0.2",
137
121
  "reactstrap": "^9.0.1",
package/Account/Load.js DELETED
@@ -1,78 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _react = require("react");
8
-
9
- var _react2 = _interopRequireDefault(_react);
10
-
11
- var _reactRedux = require("react-redux");
12
-
13
- var _reducer = require("./reducer");
14
-
15
- var _utility = require("../utility");
16
-
17
- var _actions = require("./actions");
18
-
19
- var _Messages = require("../Messages");
20
-
21
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
-
23
- /* eslint-disable react/require-optimization */
24
-
25
- var mapStateToProps = function mapStateToProps(state) {
26
- return {
27
- data: _reducer.selectors.getCurrentAccount(state),
28
- hasError: _reducer.selectors.getCurrentAccountHasError(state),
29
- fetched: _reducer.selectors.getCurrentAccountIsFetched(state),
30
- isFetching: _reducer.selectors.getCurrentAccountIsFetching(state),
31
- shouldFetch: _reducer.selectors.getCurrentAccountShouldFetch(state)
32
- };
33
- },
34
- mapDispatchToProps = function mapDispatchToProps(dispatch, _ref) {
35
- var appName = _ref.appName;
36
- return {
37
- fetchInitialInformation: function fetchInitialInformation() {
38
- setTimeout(function () {
39
- dispatch((0, _actions.fetchInitialInformation)(appName));
40
- });
41
- }
42
- };
43
- };
44
-
45
- var LoadAccount = function LoadAccount(props) {
46
- var children = props.children,
47
- data = props.data,
48
- isFetching = props.isFetching,
49
- shouldFetch = props.shouldFetch,
50
- hasError = props.hasError,
51
- fetchInitialInformation = props.fetchInitialInformation;
52
-
53
-
54
- _react2.default.useEffect(function () {
55
- if (shouldFetch) {
56
- fetchInitialInformation();
57
- }
58
- }, [shouldFetch, isFetching, hasError]);
59
-
60
- if (isFetching) {
61
- return _react2.default.createElement(_Messages.LoadingMessage, { message: _utility.words.PleaseWait });
62
- }
63
-
64
- if (hasError) {
65
- return _react2.default.createElement(_Messages.LargeErrorMessage, {
66
- message: _utility.words.ThereWasAProblem,
67
- onRetry: fetchInitialInformation
68
- });
69
- }
70
-
71
- if (data.size === 0) {
72
- return null;
73
- }
74
-
75
- return children;
76
- };
77
-
78
- exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(LoadAccount);
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.fetchInitialInformation = undefined;
7
-
8
- var _request = require("./request");
9
-
10
- var fetchInitialInformation = exports.fetchInitialInformation = function fetchInitialInformation(appName) {
11
- return {
12
- type: "FETCH_INITIAL_INFORMATION",
13
- payload: (0, _request.fetchInitialInformation)(appName)
14
- };
15
- };
package/Account/index.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.LoadAccount = exports.accountReducer = exports.accountSelectors = undefined;
7
-
8
- var _reducer = require("./reducer");
9
-
10
- var _reducer2 = _interopRequireDefault(_reducer);
11
-
12
- var _Load = require("./Load");
13
-
14
- var _Load2 = _interopRequireDefault(_Load);
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- exports.accountSelectors = _reducer.selectors;
19
- exports.accountReducer = _reducer2.default;
20
- exports.LoadAccount = _Load2.default;
@@ -1,122 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.selectors = undefined;
7
-
8
- var _reselect = require("reselect");
9
-
10
- var _immutable = require("immutable");
11
-
12
- var Immutable = _interopRequireWildcard(_immutable);
13
-
14
- var _utility = require("../utility");
15
-
16
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
17
-
18
- var initialState = Immutable.Map({
19
- error: _utility.noError,
20
- fetched: false,
21
- fetching: false,
22
-
23
- info: Immutable.Map(),
24
- companies: Immutable.Map()
25
- });
26
-
27
- var fetchCurrentAccountPending = function fetchCurrentAccountPending(state) {
28
- return state.merge({
29
- error: _utility.noError,
30
- fetching: true
31
- });
32
- },
33
- fetchCurrentAccountRejected = function fetchCurrentAccountRejected(state, _ref) {
34
- var error = _ref.payload.error;
35
- return state.merge({
36
- error: error,
37
- fetching: false
38
- });
39
- },
40
- fetchCurrentAccountFulfilled = function fetchCurrentAccountFulfilled(state, _ref2) {
41
- var payload = _ref2.payload;
42
- return state.mergeDeep({
43
- fetched: true,
44
- fetching: false,
45
-
46
- info: payload.Account,
47
- companies: payload.Companies
48
- });
49
- },
50
- accountChangePassword = function accountChangePassword(state) {
51
- return state.setIn(["info", "RequireChange"], false);
52
- },
53
- accountGaveConsent = function accountGaveConsent(state) {
54
- return state.setIn(["info", "HasToGiveConsent"], false);
55
- };
56
-
57
- var reducer = function reducer() {
58
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
59
- var action = arguments[1];
60
-
61
-
62
- switch (action.type) {
63
- case "FETCH_INITIAL_INFORMATION_PENDING":
64
- return fetchCurrentAccountPending(state);
65
-
66
- case "FETCH_INITIAL_INFORMATION_REJECTED":
67
- return fetchCurrentAccountRejected(state, action);
68
-
69
- case "FETCH_INITIAL_INFORMATION_FULFILLED":
70
- return fetchCurrentAccountFulfilled(state, action);
71
-
72
- case "ACCOUNT_CHANGE_PASSWORD":
73
- return accountChangePassword(state);
74
-
75
- case "ACCOUNT_GAVE_CONSENT":
76
- return accountGaveConsent(state);
77
-
78
- default:
79
- return state;
80
- }
81
- };
82
-
83
- var getFetched = function getFetched(state) {
84
- return state.getIn(["account", "fetched"]);
85
- },
86
- getError = function getError(state) {
87
- return state.getIn(["account", "error"]);
88
- };
89
-
90
- var getCurrentAccount = function getCurrentAccount(state) {
91
- return state.getIn(["account", "info"]);
92
- },
93
- getCurrentAccountCompanies = function getCurrentAccountCompanies(state) {
94
- return state.getIn(["account", "companies"]);
95
- },
96
- getCurrentAccountIsFetching = function getCurrentAccountIsFetching(state) {
97
- return state.getIn(["account", "fetching"]);
98
- },
99
- getCurrentAccountShouldFetch = (0, _reselect.createSelector)(getCurrentAccountIsFetching, getFetched, getError, function (isFetching, isFetched, error) {
100
- return !isFetching && !isFetched && error === _utility.noError;
101
- }),
102
- getCurrentAccountIsFetched = (0, _reselect.createSelector)(getCurrentAccountIsFetching, getFetched, getError, function (isFetching, isFetched, error) {
103
- return !isFetching && isFetched && error === _utility.noError;
104
- }),
105
- getCurrentAccountHasError = (0, _reselect.createSelector)(getError, function (error) {
106
- return error !== _utility.noError;
107
- }),
108
- getIsCurrentAccountAdministrator = (0, _reselect.createSelector)(getCurrentAccount, function (account) {
109
- return (0, _utility.isAdministratorAccount)(account.get("Type"));
110
- });
111
-
112
- var selectors = exports.selectors = {
113
- getCurrentAccountCompanies: getCurrentAccountCompanies,
114
- getCurrentAccount: getCurrentAccount,
115
- getCurrentAccountIsFetching: getCurrentAccountIsFetching,
116
- getCurrentAccountShouldFetch: getCurrentAccountShouldFetch,
117
- getCurrentAccountIsFetched: getCurrentAccountIsFetched,
118
- getCurrentAccountHasError: getCurrentAccountHasError,
119
- getIsCurrentAccountAdministrator: getIsCurrentAccountAdministrator
120
- };
121
-
122
- exports.default = reducer;
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.fetchInitialInformation = undefined;
7
-
8
- var _superagent = require("superagent");
9
-
10
- var _superagent2 = _interopRequireDefault(_superagent);
11
-
12
- var _immutable = require("immutable");
13
-
14
- var Immutable = _interopRequireWildcard(_immutable);
15
-
16
- var _utility = require("../utility");
17
-
18
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
19
-
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
- var normalizeInitialInformation = function normalizeInitialInformation(info) {
23
- var Account = info.Account,
24
- IsConnected = info.IsConnected,
25
- Counties = info.Counties,
26
- Companies = info.Companies;
27
-
28
-
29
- return {
30
- Account: Immutable.Map(Account || {}),
31
- IsConnected: IsConnected,
32
- Error: IsConnected ? _utility.noError : "Not connected",
33
- Counties: typeof Counties === "undefined" ? Immutable.List() : (0, _utility.normalizeArrayByField)(Counties, "Short").entities,
34
- Companies: typeof Companies === "undefined" ? Immutable.List() : (0, _utility.normalizeArray)(Companies).entities
35
- };
36
- };
37
-
38
- var fetchInitialInformation = exports.fetchInitialInformation = function fetchInitialInformation(app) {
39
- return new Promise(function (resolve, reject) {
40
- return _superagent2.default.get("/api/extern/get-initial-information").type("form").query({ app: app }).end((0, _utility.withPromiseCallback)(function (reponse) {
41
- return resolve(normalizeInitialInformation(reponse));
42
- }, reject));
43
- });
44
- };
@@ -1,190 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8
-
9
- var _react = require("react");
10
-
11
- var React = _interopRequireWildcard(_react);
12
-
13
- var _Loading = require("../Messages/Loading");
14
-
15
- var _util = require("../Modal/util");
16
-
17
- var _reduxInjector = require("redux-injector");
18
-
19
- var _utility = require("../utility");
20
-
21
- var _reactRedux = require("react-redux");
22
-
23
- var _module = require("../reducer/module");
24
-
25
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
26
-
27
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
28
-
29
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
30
-
31
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
32
-
33
- var injectPaginator = function injectPaginator(_ref) {
34
- var key = _ref.key,
35
- itemsReducer = _ref.itemsReducer,
36
- pagesReducer = _ref.pagesReducer;
37
-
38
- (0, _reduxInjector.injectReducer)("entities." + key, itemsReducer);
39
- (0, _reduxInjector.injectReducer)("paginations." + key, pagesReducer);
40
- };
41
-
42
- var mapStateToProps = function mapStateToProps(state, _ref2) {
43
- var module = _ref2.route.default.module;
44
- return {
45
- ready: (0, _module.getIsModuleReady)(state, module)
46
- };
47
- },
48
- mapDispatchToProps = function mapDispatchToProps(dispatch, _ref3) {
49
- var route = _ref3.route;
50
- return {
51
- initModule: function initModule() {
52
- var _route$default = route.default,
53
- reducers = _route$default.reducers,
54
- modals = _route$default.modals,
55
- paginators = _route$default.paginators,
56
- module = _route$default.module;
57
-
58
-
59
- (0, _utility.delay)().then(function () {
60
- if (reducers) {
61
- if (Array.isArray(reducers)) {
62
- var _iteratorNormalCompletion = true;
63
- var _didIteratorError = false;
64
- var _iteratorError = undefined;
65
-
66
- try {
67
- for (var _iterator = reducers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
68
- var _ref4 = _step.value;
69
- var key = _ref4.key,
70
- func = _ref4.func;
71
-
72
- (0, _reduxInjector.injectReducer)(key, func);
73
- }
74
- } catch (err) {
75
- _didIteratorError = true;
76
- _iteratorError = err;
77
- } finally {
78
- try {
79
- if (!_iteratorNormalCompletion && _iterator.return) {
80
- _iterator.return();
81
- }
82
- } finally {
83
- if (_didIteratorError) {
84
- throw _iteratorError;
85
- }
86
- }
87
- }
88
- } else {
89
- var _key = reducers.key,
90
- _func = reducers.func;
91
-
92
-
93
- (0, _reduxInjector.injectReducer)(_key, _func);
94
- }
95
- }
96
- }).then(function () {
97
- if (modals) {
98
- (0, _util.injectModals)(modals);
99
- }
100
- }).then(function () {
101
- if (paginators) {
102
- if (Array.isArray(paginators)) {
103
- var _iteratorNormalCompletion2 = true;
104
- var _didIteratorError2 = false;
105
- var _iteratorError2 = undefined;
106
-
107
- try {
108
- for (var _iterator2 = paginators[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
109
- var paginator = _step2.value;
110
-
111
- injectPaginator(paginator);
112
- }
113
- } catch (err) {
114
- _didIteratorError2 = true;
115
- _iteratorError2 = err;
116
- } finally {
117
- try {
118
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
119
- _iterator2.return();
120
- }
121
- } finally {
122
- if (_didIteratorError2) {
123
- throw _iteratorError2;
124
- }
125
- }
126
- }
127
- } else {
128
- injectPaginator(paginators);
129
- }
130
- }
131
- }).then(function () {
132
- dispatch((0, _module.moduleIsReadyAction)(module));
133
- });
134
- }
135
- };
136
- };
137
-
138
- var InitModule = function (_React$Component) {
139
- _inherits(InitModule, _React$Component);
140
-
141
- function InitModule() {
142
- _classCallCheck(this, InitModule);
143
-
144
- return _possibleConstructorReturn(this, (InitModule.__proto__ || Object.getPrototypeOf(InitModule)).apply(this, arguments));
145
- }
146
-
147
- _createClass(InitModule, [{
148
- key: "componentDidMount",
149
- value: function componentDidMount() {
150
- if (!this.props.ready) {
151
- this.props.initModule();
152
- }
153
- }
154
- }, {
155
- key: "shouldComponentUpdate",
156
- value: function shouldComponentUpdate() {
157
- return true;
158
- }
159
- }, {
160
- key: "render",
161
- value: function render() {
162
- var _props = this.props,
163
- route = _props.route,
164
- ready = _props.ready,
165
- props = _props.props;
166
- var Component = route.default.Component;
167
-
168
-
169
- if (ready) {
170
- return React.createElement(Component, props);
171
- }
172
-
173
- return React.createElement(
174
- "div",
175
- { className: "mt-3" },
176
- React.createElement(_Loading.LoadingMessage, { message: _utility.words.PleaseWait })
177
- );
178
- }
179
- }]);
180
-
181
- return InitModule;
182
- }(React.Component);
183
-
184
- var WrapInitModule = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(InitModule);
185
-
186
- var createWrap = function createWrap(route, props) {
187
- return React.createElement(WrapInitModule, { props: props, route: route });
188
- };
189
-
190
- exports.default = createWrap;