x25 3.0.0 → 17.0.0

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 (274) hide show
  1. package/Account/Load.js +75 -0
  2. package/Account/actions.js +15 -0
  3. package/Account/index.js +20 -0
  4. package/Account/reducer.js +122 -0
  5. package/Account/request.js +44 -0
  6. package/Async/InitModule.js +190 -0
  7. package/Async/RouteLoading.js +64 -0
  8. package/Async/SimulatedException.js +44 -0
  9. package/Async/index.js +95 -0
  10. package/Async/types.js +1 -0
  11. package/Company/Load.js +82 -0
  12. package/Company/actions.js +15 -0
  13. package/Company/index.js +20 -0
  14. package/Company/reducer.js +165 -0
  15. package/Company/request.js +36 -0
  16. package/Company/util.js +10 -0
  17. package/Header/AccountOptionsContainer.js +144 -0
  18. package/Header/AdminSelectCompany.js +109 -0
  19. package/Header/ClientSelectCompany.js +104 -0
  20. package/Header/Header.js +127 -0
  21. package/Header/HeaderContainer.js +39 -0
  22. package/Header/Logo.js +30 -0
  23. package/Header/LogoutButton.js +39 -0
  24. package/Header/index.js +19 -0
  25. package/Header/request.js +26 -0
  26. package/Header/types.js +1 -0
  27. package/Header/util.js +58 -0
  28. package/Inputs/Business/BankAccount.js +48 -0
  29. package/Inputs/Business/BankName.js +49 -0
  30. package/Inputs/Business/CifField.js +112 -0
  31. package/Inputs/Business/CifFieldContainer.js +157 -0
  32. package/Inputs/Business/Email.js +37 -0
  33. package/Inputs/Business/NidField.js +91 -0
  34. package/Inputs/Business/Phone.js +37 -0
  35. package/Inputs/Business/index.js +34 -0
  36. package/Inputs/Business/request.js +39 -0
  37. package/Inputs/CaptchaBox.js +151 -0
  38. package/Inputs/DateInput.js +172 -0
  39. package/Inputs/DateTemplate.js +200 -0
  40. package/Inputs/DelayInputChange.js +135 -0
  41. package/Inputs/FocusTemplate.js +47 -0
  42. package/Inputs/InputTemplate.js +78 -0
  43. package/Inputs/LabelTemplate.js +59 -0
  44. package/Inputs/NumericInput.js +139 -0
  45. package/Inputs/NumericTemplate.js +148 -0
  46. package/Inputs/Selects/County.js +29 -0
  47. package/Inputs/Selects/Custom.js +56 -0
  48. package/Inputs/Selects/Simple.js +75 -0
  49. package/Inputs/Selects/index.js +52 -0
  50. package/Inputs/SimpleInput.js +42 -0
  51. package/Inputs/SimpleTextarea.js +47 -0
  52. package/Inputs/TextareaTemplate.js +55 -0
  53. package/Inputs/Tooltip.js +82 -0
  54. package/Inputs/index.js +185 -0
  55. package/Messages/Error.js +106 -0
  56. package/Messages/Loading.js +68 -0
  57. package/Messages/index.js +29 -0
  58. package/Modal/Delete.js +240 -0
  59. package/Modal/Root.js +81 -0
  60. package/Modal/SimpleModal.js +57 -0
  61. package/Modal/actions.js +10 -0
  62. package/Modal/getComponent.js +42 -0
  63. package/Modal/index.js +22 -0
  64. package/Modal/reducer.js +53 -0
  65. package/Modal/types.js +7 -0
  66. package/Modal/util.js +17 -0
  67. package/Payment/EstimatePrice/Description.js +92 -0
  68. package/Payment/EstimatePrice/PayBox.js +220 -0
  69. package/Payment/EstimatePrice/index.js +92 -0
  70. package/Payment/EstimatePrice/util.js +21 -0
  71. package/Payment/MobilpayForm.js +86 -0
  72. package/Payment/Modal/BankTransfer.js +233 -0
  73. package/Payment/Modal/CompanyValability.js +28 -0
  74. package/Payment/Modal/DoneForm.js +222 -0
  75. package/Payment/Modal/PaymentDone.js +53 -0
  76. package/Payment/Modal/index.js +27 -0
  77. package/Payment/actions.js +23 -0
  78. package/{src/Payment → Payment}/codes.js +19 -16
  79. package/Payment/index.js +141 -0
  80. package/Payment/request.js +49 -0
  81. package/Payment/types.js +1 -0
  82. package/Payment/util.js +50 -0
  83. package/Payment/validate.js +23 -0
  84. package/Sidebar.js +156 -0
  85. package/Things.js +53 -0
  86. package/actions.js +73 -0
  87. package/config.js +10 -0
  88. package/dev/ErrorBoundary.js +109 -0
  89. package/dev/TheError.js +113 -0
  90. package/dev/index.js +132 -0
  91. package/dev/types.js +1 -0
  92. package/package.json +13 -13
  93. package/prod/SentryErrorBoundary.js +150 -0
  94. package/reducer/captchas.js +51 -0
  95. package/reducer/counties.js +57 -0
  96. package/reducer/index.js +38 -0
  97. package/reducer/module.js +48 -0
  98. package/style/index.css +1 -0
  99. package/style/sidebar.css +1 -0
  100. package/types.js +1 -0
  101. package/utility/calendar.js +45 -0
  102. package/utility/date.js +111 -0
  103. package/utility/index.js +125 -0
  104. package/utility/language.js +20 -0
  105. package/utility/mql.js +6 -0
  106. package/utility/normalize-test.js +54 -0
  107. package/utility/normalize.js +108 -0
  108. package/utility/numbers.js +93 -0
  109. package/utility/numeric.js +103 -0
  110. package/utility/others.js +142 -0
  111. package/utility/strings-test.js +216 -0
  112. package/utility/strings.js +85 -0
  113. package/utility/validation/common.js +278 -0
  114. package/utility/validation/index.js +110 -0
  115. package/utility/validation/specific.js +14 -0
  116. package/utility/validation/validate/bank-test.js +41 -0
  117. package/utility/validation/validate/bank.js +176 -0
  118. package/utility/validation/validate/cif-test.js +37 -0
  119. package/utility/validation/validate/cif.js +44 -0
  120. package/utility/validation/validate/cnp-test.js +68 -0
  121. package/utility/validation/validate/cnp.js +193 -0
  122. package/{src/utility → utility}/validation/validate/date.js +61 -73
  123. package/utility/validation/validate/email-test.js +30 -0
  124. package/utility/validation/validate/email.js +11 -0
  125. package/utility/validation/validate/index.js +65 -0
  126. package/.eslintignore +0 -2
  127. package/.eslintrc.json +0 -275
  128. package/.flowconfig +0 -23
  129. package/conf/dev.js +0 -19
  130. package/conf/dist.js +0 -19
  131. package/conf/polyfills/tempPolyfills.js +0 -7
  132. package/src/Account/Load.jsx +0 -79
  133. package/src/Account/actions.js +0 -10
  134. package/src/Account/index.js +0 -11
  135. package/src/Account/reducer.js +0 -139
  136. package/src/Account/request.js +0 -36
  137. package/src/Async/InitModule.jsx +0 -114
  138. package/src/Async/RouteLoading.jsx +0 -52
  139. package/src/Async/SimulatedException.jsx +0 -19
  140. package/src/Async/index.jsx +0 -75
  141. package/src/Async/types.js +0 -39
  142. package/src/Company/Load.jsx +0 -84
  143. package/src/Company/actions.js +0 -10
  144. package/src/Company/index.js +0 -11
  145. package/src/Company/reducer.js +0 -201
  146. package/src/Company/request.js +0 -30
  147. package/src/Company/util.js +0 -7
  148. package/src/Header/AccountOptionsContainer.jsx +0 -124
  149. package/src/Header/AdminSelectCompany.jsx +0 -101
  150. package/src/Header/ClientSelectCompany.jsx +0 -90
  151. package/src/Header/Header.jsx +0 -120
  152. package/src/Header/HeaderContainer.jsx +0 -30
  153. package/src/Header/Logo.jsx +0 -16
  154. package/src/Header/LogoutButton.jsx +0 -34
  155. package/src/Header/index.jsx +0 -9
  156. package/src/Header/request.js +0 -28
  157. package/src/Header/types.js +0 -6
  158. package/src/Header/util.jsx +0 -61
  159. package/src/Inputs/Business/BankAccount.jsx +0 -39
  160. package/src/Inputs/Business/BankName.jsx +0 -40
  161. package/src/Inputs/Business/CifField.jsx +0 -93
  162. package/src/Inputs/Business/CifFieldContainer.jsx +0 -142
  163. package/src/Inputs/Business/Email.jsx +0 -23
  164. package/src/Inputs/Business/NidField.jsx +0 -77
  165. package/src/Inputs/Business/Phone.jsx +0 -23
  166. package/src/Inputs/Business/index.js +0 -16
  167. package/src/Inputs/Business/request.js +0 -39
  168. package/src/Inputs/CaptchaBox.jsx +0 -131
  169. package/src/Inputs/DateInput.jsx +0 -188
  170. package/src/Inputs/DateTemplate.jsx +0 -213
  171. package/src/Inputs/DelayInputChange.jsx +0 -130
  172. package/src/Inputs/FocusTemplate.jsx +0 -41
  173. package/src/Inputs/InputTemplate.jsx +0 -79
  174. package/src/Inputs/LabelTemplate.jsx +0 -47
  175. package/src/Inputs/NumericInput.jsx +0 -142
  176. package/src/Inputs/NumericTemplate.jsx +0 -155
  177. package/src/Inputs/Selects/County.jsx +0 -19
  178. package/src/Inputs/Selects/Custom.jsx +0 -55
  179. package/src/Inputs/Selects/Simple.jsx +0 -73
  180. package/src/Inputs/Selects/index.jsx +0 -37
  181. package/src/Inputs/SimpleInput.jsx +0 -40
  182. package/src/Inputs/SimpleTextarea.jsx +0 -55
  183. package/src/Inputs/TextareaTemplate.jsx +0 -57
  184. package/src/Inputs/Tooltip.jsx +0 -61
  185. package/src/Inputs/index.js +0 -22
  186. package/src/Messages/Error.jsx +0 -83
  187. package/src/Messages/Loading.jsx +0 -43
  188. package/src/Messages/index.jsx +0 -4
  189. package/src/Modal/Delete.jsx +0 -237
  190. package/src/Modal/Root.jsx +0 -57
  191. package/src/Modal/SimpleModal.jsx +0 -47
  192. package/src/Modal/actions.js +0 -7
  193. package/src/Modal/getComponent.jsx +0 -32
  194. package/src/Modal/index.jsx +0 -12
  195. package/src/Modal/reducer.js +0 -40
  196. package/src/Modal/types.js +0 -6
  197. package/src/Modal/util.js +0 -15
  198. package/src/Payment/EstimatePrice/Description.jsx +0 -101
  199. package/src/Payment/EstimatePrice/PayBox.jsx +0 -173
  200. package/src/Payment/EstimatePrice/index.jsx +0 -63
  201. package/src/Payment/EstimatePrice/util.js +0 -15
  202. package/src/Payment/MobilpayForm.jsx +0 -77
  203. package/src/Payment/Modal/BankTransfer.jsx +0 -129
  204. package/src/Payment/Modal/CompanyValability.jsx +0 -14
  205. package/src/Payment/Modal/DoneForm.jsx +0 -209
  206. package/src/Payment/Modal/PaymentDone.jsx +0 -27
  207. package/src/Payment/Modal/index.js +0 -13
  208. package/src/Payment/actions.jsx +0 -22
  209. package/src/Payment/index.jsx +0 -124
  210. package/src/Payment/request.js +0 -50
  211. package/src/Payment/types.js +0 -14
  212. package/src/Payment/util.jsx +0 -52
  213. package/src/Payment/validate.js +0 -25
  214. package/src/Sidebar.jsx +0 -158
  215. package/src/Things.jsx +0 -35
  216. package/src/actions.js +0 -36
  217. package/src/config.js +0 -7
  218. package/src/dev/ErrorBoundary.jsx +0 -98
  219. package/src/dev/TheError.jsx +0 -87
  220. package/src/dev/index.js +0 -127
  221. package/src/dev/types.js +0 -10
  222. package/src/prod/SentryErrorBoundary.jsx +0 -98
  223. package/src/reducer/captchas.js +0 -44
  224. package/src/reducer/counties.js +0 -46
  225. package/src/reducer/index.js +0 -25
  226. package/src/reducer/module.jsx +0 -43
  227. package/src/style/.sass-lint.yml +0 -84
  228. package/src/style/.stylelintrc.json +0 -161
  229. package/src/style/_fancy-text.scss +0 -37
  230. package/src/style/_fix_bootstrap_placeholder_color.scss +0 -14
  231. package/src/style/_header-company.scss +0 -69
  232. package/src/style/_inputs.scss +0 -12
  233. package/src/style/_minimal.scss +0 -31
  234. package/src/style/_navigation.scss +0 -24
  235. package/src/style/_others.scss +0 -79
  236. package/src/style/index.scss +0 -7
  237. package/src/style/sidebar/_animations.scss +0 -21
  238. package/src/style/sidebar/_dark-theme.scss +0 -77
  239. package/src/style/sidebar/_scroll.scss +0 -37
  240. package/src/style/sidebar/_structure.scss +0 -299
  241. package/src/style/sidebar.scss +0 -4
  242. package/src/types.js +0 -31
  243. package/src/utility/calendar.js +0 -39
  244. package/src/utility/date.js +0 -100
  245. package/src/utility/index.js +0 -12
  246. package/src/utility/language.js +0 -17
  247. package/src/utility/mql.js +0 -3
  248. package/src/utility/normalize-test.js +0 -58
  249. package/src/utility/normalize.js +0 -119
  250. package/src/utility/numbers.js +0 -87
  251. package/src/utility/numeric.js +0 -114
  252. package/src/utility/others.jsx +0 -160
  253. package/src/utility/strings-test.js +0 -136
  254. package/src/utility/strings.js +0 -80
  255. package/src/utility/validation/common.js +0 -360
  256. package/src/utility/validation/index.js +0 -70
  257. package/src/utility/validation/specific.js +0 -9
  258. package/src/utility/validation/validate/bank-test.js +0 -129
  259. package/src/utility/validation/validate/bank.js +0 -176
  260. package/src/utility/validation/validate/cif-test.js +0 -105
  261. package/src/utility/validation/validate/cif.js +0 -44
  262. package/src/utility/validation/validate/cnp-test.js +0 -216
  263. package/src/utility/validation/validate/cnp.js +0 -261
  264. package/src/utility/validation/validate/email-test.js +0 -36
  265. package/src/utility/validation/validate/email.js +0 -6
  266. package/src/utility/validation/validate/index.js +0 -7
  267. package/webpack.config.js +0 -90
  268. package/x25.wiki/Account.md +0 -41
  269. package/x25.wiki/Company.md +0 -39
  270. package/x25.wiki/Header.md +0 -21
  271. package/x25.wiki/Home.md +0 -1
  272. package/x25.wiki/Inputs.md +0 -33
  273. package/x25.wiki/Messages.md +0 -27
  274. package/x25.wiki/Payment.md +0 -42
package/Sidebar.js ADDED
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
8
+
9
+ 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; }; }();
10
+
11
+ var _react = require("react");
12
+
13
+ var React = _interopRequireWildcard(_react);
14
+
15
+ var _reactSidebar = require("react-sidebar");
16
+
17
+ var _reactSidebar2 = _interopRequireDefault(_reactSidebar);
18
+
19
+ var _utility = require("./utility");
20
+
21
+ var _Header = require("./Header");
22
+
23
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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 styles = {
34
+ sidebar: {
35
+ zIndex: 2,
36
+ position: "absolute",
37
+ top: 0,
38
+ bottom: 0,
39
+ transition: "transform .3s ease-out",
40
+ WebkitTransition: "-webkit-transform .3s ease-out",
41
+ willChange: "transform",
42
+ overflowY: "auto"
43
+ },
44
+ overlay: {
45
+ zIndex: 3,
46
+ left: 240
47
+ }
48
+ };
49
+
50
+ var Sidebar = function (_React$PureComponent) {
51
+ _inherits(Sidebar, _React$PureComponent);
52
+
53
+ function Sidebar(props) {
54
+ _classCallCheck(this, Sidebar);
55
+
56
+ var _this = _possibleConstructorReturn(this, (Sidebar.__proto__ || Object.getPrototypeOf(Sidebar)).call(this, props));
57
+
58
+ _this.state = {
59
+ showNavbar: false,
60
+ sidebarDocked: _utility.mql.matches,
61
+ sidebarOpen: false
62
+ };
63
+
64
+ _this.updateSidebar = function () {
65
+ _this.setState(function (current) {
66
+ return {
67
+ sidebarOpen: !_utility.mql.matches && current.sidebarOpen,
68
+ sidebarDocked: _utility.mql.matches
69
+ };
70
+ });
71
+ };
72
+
73
+ _this.toggleNavbar = function () {
74
+ _this.setState(function (current) {
75
+ return {
76
+ showNavbar: !current.showNavbar
77
+ };
78
+ });
79
+ };
80
+
81
+ _this.toggleSidebarOpen = function (value) {
82
+ _this.setState({
83
+ sidebarOpen: value
84
+ });
85
+ };
86
+
87
+ _this.showSidebar = function () {
88
+ var theMetch = _utility.mql.matches;
89
+
90
+ _this.setState({
91
+ sidebarOpen: !theMetch,
92
+ sidebarDocked: theMetch
93
+ });
94
+ };
95
+
96
+ _this.closeSidebar = function () {
97
+ _this.setState({
98
+ sidebarOpen: false,
99
+ sidebarDocked: false
100
+ });
101
+ };
102
+ return _this;
103
+ }
104
+
105
+ _createClass(Sidebar, [{
106
+ key: "componentDidMount",
107
+ value: function componentDidMount() {
108
+ _utility.mql.addListener(this.updateSidebar);
109
+ }
110
+ }, {
111
+ key: "componentWillUnmount",
112
+ value: function componentWillUnmount() {
113
+ _utility.mql.removeListener(this.updateSidebar);
114
+ }
115
+ }, {
116
+ key: "render",
117
+ value: function render() {
118
+ var _props = this.props,
119
+ data = _props.data,
120
+ children = _props.children;
121
+
122
+
123
+ var sidebarprops = {
124
+ closeSidebar: this.closeSidebar
125
+ };
126
+
127
+ return React.createElement(
128
+ _reactSidebar2.default,
129
+ _extends({}, this.props, {
130
+ contentClassName: "wrapper",
131
+ docked: this.state.sidebarDocked,
132
+ onSetOpen: this.toggleSidebarOpen,
133
+ open: this.state.sidebarOpen,
134
+ rootClassName: "page-wrapper dark-theme toggled",
135
+ sidebar: React.cloneElement(this.props.Menu, sidebarprops),
136
+ sidebarClassName: "sidebar-wrapper",
137
+ styles: styles,
138
+ touch: false,
139
+ transitions: false }),
140
+ React.createElement(_Header.Header, {
141
+ brand: this.props.brand,
142
+ company: data,
143
+ showNavbar: this.state.showNavbar,
144
+ showSidebar: this.showSidebar,
145
+ sidebarDocked: this.state.sidebarDocked,
146
+ toggleNavbar: this.toggleNavbar
147
+ }),
148
+ children
149
+ );
150
+ }
151
+ }]);
152
+
153
+ return Sidebar;
154
+ }(React.PureComponent);
155
+
156
+ exports.default = Sidebar;
package/Things.js ADDED
@@ -0,0 +1,53 @@
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 _Root = require("./Modal/Root");
12
+
13
+ var _Root2 = _interopRequireDefault(_Root);
14
+
15
+ var _reactRedux = require("react-redux");
16
+
17
+ var _reactNotificationSystemRedux = require("react-notification-system-redux2");
18
+
19
+ var _reactNotificationSystemRedux2 = _interopRequireDefault(_reactNotificationSystemRedux);
20
+
21
+ var _actions = require("./actions");
22
+
23
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
+
25
+ var mapStateToProps = function mapStateToProps(state) {
26
+ return {
27
+ notifications: state.get("notifications", [])
28
+ };
29
+ },
30
+ mapDispatchToProps = function mapDispatchToProps(dispatch) {
31
+ return {
32
+ handleDismiss: function handleDismiss(notification) {
33
+ dispatch((0, _actions.deleteNotification)(notification.key));
34
+ }
35
+ };
36
+ };
37
+
38
+ var NotificationsContainer = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_reactNotificationSystemRedux2.default);
39
+
40
+ var Things = function Things() {
41
+ return _react2.default.createElement(
42
+ _react2.default.Fragment,
43
+ null,
44
+ _react2.default.createElement(
45
+ "div",
46
+ { className: "d-print-none" },
47
+ _react2.default.createElement(NotificationsContainer, null)
48
+ ),
49
+ _react2.default.createElement(_Root2.default, null)
50
+ );
51
+ };
52
+
53
+ exports.default = Things;
package/actions.js ADDED
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.hideCaptcha = exports.showCaptcha = exports.deleteNotification = exports.notifyError = exports.notify = undefined;
7
+
8
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
9
+
10
+ var _actions = require("./Modal/actions");
11
+
12
+ Object.keys(_actions).forEach(function (key) {
13
+ if (key === "default" || key === "__esModule") return;
14
+ Object.defineProperty(exports, key, {
15
+ enumerable: true,
16
+ get: function get() {
17
+ return _actions[key];
18
+ }
19
+ });
20
+ });
21
+
22
+ var _actions2 = require("./Account/actions");
23
+
24
+ Object.keys(_actions2).forEach(function (key) {
25
+ if (key === "default" || key === "__esModule") return;
26
+ Object.defineProperty(exports, key, {
27
+ enumerable: true,
28
+ get: function get() {
29
+ return _actions2[key];
30
+ }
31
+ });
32
+ });
33
+
34
+ var _reactNotificationSystemRedux = require("react-notification-system-redux2");
35
+
36
+ var _reactNotificationSystemRedux2 = _interopRequireDefault(_reactNotificationSystemRedux);
37
+
38
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
+
40
+ var createNotification = function createNotification(level) {
41
+ return function (title, options) {
42
+ return _reactNotificationSystemRedux2.default.show(_extends({
43
+ title: title,
44
+ position: "tc",
45
+ autoDismiss: 3
46
+ }, options), level);
47
+ };
48
+ };
49
+
50
+ var notify = exports.notify = createNotification("success");
51
+ // export const notifyWarning = createNotification("warning");
52
+ var notifyError = exports.notifyError = createNotification("error");
53
+
54
+ var deleteNotification = exports.deleteNotification = function deleteNotification(position) {
55
+ return {
56
+ type: "DELETE_NOTIFICATION",
57
+ payload: position
58
+ };
59
+ };
60
+
61
+ var showCaptcha = exports.showCaptcha = function showCaptcha(payload) {
62
+ return {
63
+ type: "SHOW_CAPTCHA",
64
+ payload: payload
65
+ };
66
+ };
67
+
68
+ var hideCaptcha = exports.hideCaptcha = function hideCaptcha(payload) {
69
+ return {
70
+ type: "HIDE_CAPTCHA",
71
+ payload: payload
72
+ };
73
+ };
package/config.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var config = exports.config = {};
7
+
8
+ var setConfiguration = exports.setConfiguration = function setConfiguration(current) {
9
+ exports.config = config = current;
10
+ };
@@ -0,0 +1,109 @@
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 _react2 = _interopRequireDefault(_react);
12
+
13
+ var _TheError = require("./TheError");
14
+
15
+ var _TheError2 = _interopRequireDefault(_TheError);
16
+
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+
19
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20
+
21
+ 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; }
22
+
23
+ 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; }
24
+
25
+ var refreshKeyCode = 82,
26
+ timeoutDelay = 200;
27
+
28
+ var ErrorBoundary = function (_React$Component) {
29
+ _inherits(ErrorBoundary, _React$Component);
30
+
31
+ _createClass(ErrorBoundary, [{
32
+ key: "componentDidCatch",
33
+ value: function componentDidCatch(error, info) {
34
+ this.setState({
35
+ error: error,
36
+ info: info
37
+ });
38
+ }
39
+ }]);
40
+
41
+ function ErrorBoundary(props) {
42
+ _classCallCheck(this, ErrorBoundary);
43
+
44
+ var _this = _possibleConstructorReturn(this, (ErrorBoundary.__proto__ || Object.getPrototypeOf(ErrorBoundary)).call(this, props));
45
+
46
+ _this.state = {
47
+ status: null,
48
+ error: null,
49
+ info: null
50
+ };
51
+
52
+ _this.handleKey = function (event) {
53
+ if (event.keyCode === refreshKeyCode) {
54
+ _this.refresh();
55
+ }
56
+ };
57
+
58
+ _this.refresh = function () {
59
+ _this.setState({
60
+ status: "Trying to recover...",
61
+ error: null,
62
+ info: null
63
+ }, function () {
64
+ setTimeout(function () {
65
+ _this.setState({
66
+ status: null,
67
+ error: null,
68
+ info: null
69
+ });
70
+ }, timeoutDelay);
71
+ });
72
+ };
73
+ return _this;
74
+ }
75
+
76
+ _createClass(ErrorBoundary, [{
77
+ key: "shouldComponentUpdate",
78
+ value: function shouldComponentUpdate() {
79
+ return true;
80
+ }
81
+ }, {
82
+ key: "render",
83
+ value: function render() {
84
+ var _state = this.state,
85
+ info = _state.info,
86
+ error = _state.error,
87
+ status = _state.status;
88
+
89
+ // render fallback UI
90
+
91
+ if (error) {
92
+ return _react2.default.createElement(_TheError2.default, {
93
+ error: error,
94
+ handleKey: this.handleKey,
95
+ info: info,
96
+ refresh: this.refresh,
97
+ status: status
98
+ });
99
+ }
100
+
101
+ // when there's not an error, render children untouched
102
+ return this.props.children;
103
+ }
104
+ }]);
105
+
106
+ return ErrorBoundary;
107
+ }(_react2.default.Component);
108
+
109
+ exports.default = ErrorBoundary;
@@ -0,0 +1,113 @@
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
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+
13
+ var TheError = function TheError(props) {
14
+
15
+ _react2.default.useEfect(function () {
16
+ document.addEventListener("keydown", props.handleKey);
17
+
18
+ return function () {
19
+ document.removeEventListener("keydown", props.handleKey);
20
+ };
21
+ }, []);
22
+
23
+ var error = props.error,
24
+ info = props.info,
25
+ status = props.status,
26
+ refresh = props.refresh;
27
+
28
+ // render fallback UI
29
+
30
+ return _react2.default.createElement(
31
+ "div",
32
+ { className: "small", tabIndex: "0" },
33
+ _react2.default.createElement(
34
+ "div",
35
+ { className: " m-2" },
36
+ status ? _react2.default.createElement(
37
+ "div",
38
+ { className: "text-fancy" },
39
+ "Trying to recover app..."
40
+ ) : _react2.default.createElement(
41
+ "div",
42
+ null,
43
+ _react2.default.createElement(
44
+ "button",
45
+ {
46
+ className: "btn btn-block btn-sm btn-primary",
47
+ onClick: refresh, type: "button" },
48
+ "Recover the app"
49
+ ),
50
+ _react2.default.createElement(
51
+ "div",
52
+ { className: "mt-2 mb-2" },
53
+ "Press ",
54
+ _react2.default.createElement(
55
+ "kbd",
56
+ null,
57
+ "R"
58
+ ),
59
+ " to recover the app, after you've done the changes"
60
+ ),
61
+ _react2.default.createElement("hr", null),
62
+ error ? _react2.default.createElement(
63
+ _react2.default.Fragment,
64
+ null,
65
+ _react2.default.createElement(
66
+ "h5",
67
+ { className: "text-danger" },
68
+ error.message
69
+ ),
70
+ _react2.default.createElement(
71
+ "b",
72
+ null,
73
+ "Stack:"
74
+ ),
75
+ _react2.default.createElement(
76
+ "pre",
77
+ null,
78
+ error.stack ? error.stack.split("↵").map(function (line, index) {
79
+ return _react2.default.createElement(
80
+ "div",
81
+ { key: index },
82
+ line
83
+ );
84
+ }) : null
85
+ )
86
+ ) : null,
87
+ _react2.default.createElement("br", null),
88
+ info && info.componentStack ? _react2.default.createElement(
89
+ _react2.default.Fragment,
90
+ null,
91
+ _react2.default.createElement(
92
+ "b",
93
+ null,
94
+ "React info:"
95
+ ),
96
+ _react2.default.createElement(
97
+ "pre",
98
+ null,
99
+ info.componentStack.split("↵").map(function (line, index) {
100
+ return _react2.default.createElement(
101
+ "div",
102
+ { key: index },
103
+ line
104
+ );
105
+ })
106
+ )
107
+ ) : null
108
+ )
109
+ )
110
+ );
111
+ };
112
+
113
+ exports.default = TheError;
package/dev/index.js ADDED
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ensureImmutableState = exports.setFavIconToDev = undefined;
7
+
8
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
9
+ /* eslint-disable no-alert, no-console, no-undefined, callback-return, max-len */
10
+
11
+ var _immutable = require("immutable");
12
+
13
+ var Immutable = _interopRequireWildcard(_immutable);
14
+
15
+ 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; } }
16
+
17
+ var setFavIconToDev = function setFavIconToDev() {
18
+ var element = document.querySelector("link[rel*='icon");
19
+
20
+ if (element !== null && element.href) {
21
+ element.href = "/static/dev.ico";
22
+ }
23
+ };
24
+
25
+ var ensureImmutableState = function ensureImmutableState() {
26
+ var ignored = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
27
+
28
+
29
+ var ignore = function ignore(key) {
30
+ return ignored.includes(key);
31
+ };
32
+
33
+ var isGood = function isGood(data, key) {
34
+ return ignore(key) || data === null || data === undefined || Immutable.isImmutable(data) || typeof data === "number" || typeof data === "boolean" || typeof data === "string";
35
+ };
36
+
37
+ var problems = Immutable.Map(),
38
+ allKeys = Immutable.List(),
39
+ currentKey = Immutable.List();
40
+
41
+ var listCurrentProblems = function listCurrentProblems() {
42
+ if (currentKey.size !== 0) {
43
+ var log = function log(_ref) {
44
+ var data = _ref.data,
45
+ state = _ref.state,
46
+ key = _ref.key;
47
+
48
+ var itExists = typeof data !== "undefined" || typeof state !== "undefined" || typeof key !== "undefined";
49
+
50
+ if (itExists) {
51
+ console.group("redux-ensure-state-is-immutable");
52
+ console.log("data:", data);
53
+ console.log("parent:", state.toJS());
54
+ console.log("typeof data:", typeof data === "undefined" ? "undefined" : _typeof(data));
55
+ console.log("key:", key);
56
+ console.groupEnd();
57
+ }
58
+ };
59
+
60
+ alert("something is not immutable. check console");
61
+
62
+ currentKey.map(function (current) {
63
+ return log(problems.get(current));
64
+ });
65
+ currentKey = currentKey.clear();
66
+ }
67
+ };
68
+
69
+ var addProblem = function addProblem(_ref2) {
70
+ var data = _ref2.data,
71
+ state = _ref2.state,
72
+ key = _ref2.key;
73
+
74
+ problems = problems.set(key, {
75
+ key: key,
76
+ state: state,
77
+ data: data
78
+ });
79
+
80
+ if (!allKeys.includes(key)) {
81
+ allKeys = allKeys.push(key);
82
+ currentKey = currentKey.push(key);
83
+ }
84
+ };
85
+
86
+ var shouldParse = function shouldParse(data, key) {
87
+ return !ignore(key) && Immutable.isImmutable(data);
88
+ };
89
+
90
+ var checkStateContainsOnlyImmutable = function checkStateContainsOnlyImmutable(state) {
91
+ var parse = function parse(data, key) {
92
+ var goodData = isGood(data, key);
93
+ var canParse = shouldParse(data, key);
94
+
95
+ if (!goodData) {
96
+ addProblem({
97
+ data: data,
98
+ state: state,
99
+ key: key
100
+ });
101
+ }
102
+
103
+ listCurrentProblems();
104
+
105
+ if (canParse) {
106
+ checkStateContainsOnlyImmutable(data);
107
+ }
108
+ };
109
+
110
+ state.forEach(function (current, key) {
111
+ parse(current, key);
112
+ });
113
+ };
114
+
115
+ return function (_ref3) {
116
+ var getState = _ref3.getState;
117
+ return function (next) {
118
+ return function (action) {
119
+
120
+ var returnValue = next(action),
121
+ state = getState();
122
+
123
+ checkStateContainsOnlyImmutable(state);
124
+
125
+ return returnValue;
126
+ };
127
+ };
128
+ };
129
+ };
130
+
131
+ exports.setFavIconToDev = setFavIconToDev;
132
+ exports.ensureImmutableState = ensureImmutableState;
package/dev/types.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";