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.
- package/Account/Load.js +75 -0
- package/Account/actions.js +15 -0
- package/Account/index.js +20 -0
- package/Account/reducer.js +122 -0
- package/Account/request.js +44 -0
- package/Async/InitModule.js +190 -0
- package/Async/RouteLoading.js +64 -0
- package/Async/SimulatedException.js +44 -0
- package/Async/index.js +95 -0
- package/Async/types.js +1 -0
- package/Company/Load.js +82 -0
- package/Company/actions.js +15 -0
- package/Company/index.js +20 -0
- package/Company/reducer.js +165 -0
- package/Company/request.js +36 -0
- package/Company/util.js +10 -0
- package/Header/AccountOptionsContainer.js +144 -0
- package/Header/AdminSelectCompany.js +109 -0
- package/Header/ClientSelectCompany.js +104 -0
- package/Header/Header.js +127 -0
- package/Header/HeaderContainer.js +39 -0
- package/Header/Logo.js +30 -0
- package/Header/LogoutButton.js +39 -0
- package/Header/index.js +19 -0
- package/Header/request.js +26 -0
- package/Header/types.js +1 -0
- package/Header/util.js +58 -0
- package/Inputs/Business/BankAccount.js +48 -0
- package/Inputs/Business/BankName.js +49 -0
- package/Inputs/Business/CifField.js +112 -0
- package/Inputs/Business/CifFieldContainer.js +157 -0
- package/Inputs/Business/Email.js +37 -0
- package/Inputs/Business/NidField.js +91 -0
- package/Inputs/Business/Phone.js +37 -0
- package/Inputs/Business/index.js +34 -0
- package/Inputs/Business/request.js +39 -0
- package/Inputs/CaptchaBox.js +151 -0
- package/Inputs/DateInput.js +172 -0
- package/Inputs/DateTemplate.js +200 -0
- package/Inputs/DelayInputChange.js +135 -0
- package/Inputs/FocusTemplate.js +47 -0
- package/Inputs/InputTemplate.js +78 -0
- package/Inputs/LabelTemplate.js +59 -0
- package/Inputs/NumericInput.js +139 -0
- package/Inputs/NumericTemplate.js +148 -0
- package/Inputs/Selects/County.js +29 -0
- package/Inputs/Selects/Custom.js +56 -0
- package/Inputs/Selects/Simple.js +75 -0
- package/Inputs/Selects/index.js +52 -0
- package/Inputs/SimpleInput.js +42 -0
- package/Inputs/SimpleTextarea.js +47 -0
- package/Inputs/TextareaTemplate.js +55 -0
- package/Inputs/Tooltip.js +82 -0
- package/Inputs/index.js +185 -0
- package/Messages/Error.js +106 -0
- package/Messages/Loading.js +68 -0
- package/Messages/index.js +29 -0
- package/Modal/Delete.js +240 -0
- package/Modal/Root.js +81 -0
- package/Modal/SimpleModal.js +57 -0
- package/Modal/actions.js +10 -0
- package/Modal/getComponent.js +42 -0
- package/Modal/index.js +22 -0
- package/Modal/reducer.js +53 -0
- package/Modal/types.js +7 -0
- package/Modal/util.js +17 -0
- package/Payment/EstimatePrice/Description.js +92 -0
- package/Payment/EstimatePrice/PayBox.js +220 -0
- package/Payment/EstimatePrice/index.js +92 -0
- package/Payment/EstimatePrice/util.js +21 -0
- package/Payment/MobilpayForm.js +86 -0
- package/Payment/Modal/BankTransfer.js +233 -0
- package/Payment/Modal/CompanyValability.js +28 -0
- package/Payment/Modal/DoneForm.js +222 -0
- package/Payment/Modal/PaymentDone.js +53 -0
- package/Payment/Modal/index.js +27 -0
- package/Payment/actions.js +23 -0
- package/{src/Payment → Payment}/codes.js +19 -16
- package/Payment/index.js +141 -0
- package/Payment/request.js +49 -0
- package/Payment/types.js +1 -0
- package/Payment/util.js +50 -0
- package/Payment/validate.js +23 -0
- package/Sidebar.js +156 -0
- package/Things.js +53 -0
- package/actions.js +73 -0
- package/config.js +10 -0
- package/dev/ErrorBoundary.js +109 -0
- package/dev/TheError.js +113 -0
- package/dev/index.js +132 -0
- package/dev/types.js +1 -0
- package/package.json +13 -13
- package/prod/SentryErrorBoundary.js +150 -0
- package/reducer/captchas.js +51 -0
- package/reducer/counties.js +57 -0
- package/reducer/index.js +38 -0
- package/reducer/module.js +48 -0
- package/style/index.css +1 -0
- package/style/sidebar.css +1 -0
- package/types.js +1 -0
- package/utility/calendar.js +45 -0
- package/utility/date.js +111 -0
- package/utility/index.js +125 -0
- package/utility/language.js +20 -0
- package/utility/mql.js +6 -0
- package/utility/normalize-test.js +54 -0
- package/utility/normalize.js +108 -0
- package/utility/numbers.js +93 -0
- package/utility/numeric.js +103 -0
- package/utility/others.js +142 -0
- package/utility/strings-test.js +216 -0
- package/utility/strings.js +85 -0
- package/utility/validation/common.js +278 -0
- package/utility/validation/index.js +110 -0
- package/utility/validation/specific.js +14 -0
- package/utility/validation/validate/bank-test.js +41 -0
- package/utility/validation/validate/bank.js +176 -0
- package/utility/validation/validate/cif-test.js +37 -0
- package/utility/validation/validate/cif.js +44 -0
- package/utility/validation/validate/cnp-test.js +68 -0
- package/utility/validation/validate/cnp.js +193 -0
- package/{src/utility → utility}/validation/validate/date.js +61 -73
- package/utility/validation/validate/email-test.js +30 -0
- package/utility/validation/validate/email.js +11 -0
- package/utility/validation/validate/index.js +65 -0
- package/.eslintignore +0 -2
- package/.eslintrc.json +0 -275
- package/.flowconfig +0 -23
- package/conf/dev.js +0 -19
- package/conf/dist.js +0 -19
- package/conf/polyfills/tempPolyfills.js +0 -7
- package/src/Account/Load.jsx +0 -79
- package/src/Account/actions.js +0 -10
- package/src/Account/index.js +0 -11
- package/src/Account/reducer.js +0 -139
- package/src/Account/request.js +0 -36
- package/src/Async/InitModule.jsx +0 -114
- package/src/Async/RouteLoading.jsx +0 -52
- package/src/Async/SimulatedException.jsx +0 -19
- package/src/Async/index.jsx +0 -75
- package/src/Async/types.js +0 -39
- package/src/Company/Load.jsx +0 -84
- package/src/Company/actions.js +0 -10
- package/src/Company/index.js +0 -11
- package/src/Company/reducer.js +0 -201
- package/src/Company/request.js +0 -30
- package/src/Company/util.js +0 -7
- package/src/Header/AccountOptionsContainer.jsx +0 -124
- package/src/Header/AdminSelectCompany.jsx +0 -101
- package/src/Header/ClientSelectCompany.jsx +0 -90
- package/src/Header/Header.jsx +0 -120
- package/src/Header/HeaderContainer.jsx +0 -30
- package/src/Header/Logo.jsx +0 -16
- package/src/Header/LogoutButton.jsx +0 -34
- package/src/Header/index.jsx +0 -9
- package/src/Header/request.js +0 -28
- package/src/Header/types.js +0 -6
- package/src/Header/util.jsx +0 -61
- package/src/Inputs/Business/BankAccount.jsx +0 -39
- package/src/Inputs/Business/BankName.jsx +0 -40
- package/src/Inputs/Business/CifField.jsx +0 -93
- package/src/Inputs/Business/CifFieldContainer.jsx +0 -142
- package/src/Inputs/Business/Email.jsx +0 -23
- package/src/Inputs/Business/NidField.jsx +0 -77
- package/src/Inputs/Business/Phone.jsx +0 -23
- package/src/Inputs/Business/index.js +0 -16
- package/src/Inputs/Business/request.js +0 -39
- package/src/Inputs/CaptchaBox.jsx +0 -131
- package/src/Inputs/DateInput.jsx +0 -188
- package/src/Inputs/DateTemplate.jsx +0 -213
- package/src/Inputs/DelayInputChange.jsx +0 -130
- package/src/Inputs/FocusTemplate.jsx +0 -41
- package/src/Inputs/InputTemplate.jsx +0 -79
- package/src/Inputs/LabelTemplate.jsx +0 -47
- package/src/Inputs/NumericInput.jsx +0 -142
- package/src/Inputs/NumericTemplate.jsx +0 -155
- package/src/Inputs/Selects/County.jsx +0 -19
- package/src/Inputs/Selects/Custom.jsx +0 -55
- package/src/Inputs/Selects/Simple.jsx +0 -73
- package/src/Inputs/Selects/index.jsx +0 -37
- package/src/Inputs/SimpleInput.jsx +0 -40
- package/src/Inputs/SimpleTextarea.jsx +0 -55
- package/src/Inputs/TextareaTemplate.jsx +0 -57
- package/src/Inputs/Tooltip.jsx +0 -61
- package/src/Inputs/index.js +0 -22
- package/src/Messages/Error.jsx +0 -83
- package/src/Messages/Loading.jsx +0 -43
- package/src/Messages/index.jsx +0 -4
- package/src/Modal/Delete.jsx +0 -237
- package/src/Modal/Root.jsx +0 -57
- package/src/Modal/SimpleModal.jsx +0 -47
- package/src/Modal/actions.js +0 -7
- package/src/Modal/getComponent.jsx +0 -32
- package/src/Modal/index.jsx +0 -12
- package/src/Modal/reducer.js +0 -40
- package/src/Modal/types.js +0 -6
- package/src/Modal/util.js +0 -15
- package/src/Payment/EstimatePrice/Description.jsx +0 -101
- package/src/Payment/EstimatePrice/PayBox.jsx +0 -173
- package/src/Payment/EstimatePrice/index.jsx +0 -63
- package/src/Payment/EstimatePrice/util.js +0 -15
- package/src/Payment/MobilpayForm.jsx +0 -77
- package/src/Payment/Modal/BankTransfer.jsx +0 -129
- package/src/Payment/Modal/CompanyValability.jsx +0 -14
- package/src/Payment/Modal/DoneForm.jsx +0 -209
- package/src/Payment/Modal/PaymentDone.jsx +0 -27
- package/src/Payment/Modal/index.js +0 -13
- package/src/Payment/actions.jsx +0 -22
- package/src/Payment/index.jsx +0 -124
- package/src/Payment/request.js +0 -50
- package/src/Payment/types.js +0 -14
- package/src/Payment/util.jsx +0 -52
- package/src/Payment/validate.js +0 -25
- package/src/Sidebar.jsx +0 -158
- package/src/Things.jsx +0 -35
- package/src/actions.js +0 -36
- package/src/config.js +0 -7
- package/src/dev/ErrorBoundary.jsx +0 -98
- package/src/dev/TheError.jsx +0 -87
- package/src/dev/index.js +0 -127
- package/src/dev/types.js +0 -10
- package/src/prod/SentryErrorBoundary.jsx +0 -98
- package/src/reducer/captchas.js +0 -44
- package/src/reducer/counties.js +0 -46
- package/src/reducer/index.js +0 -25
- package/src/reducer/module.jsx +0 -43
- package/src/style/.sass-lint.yml +0 -84
- package/src/style/.stylelintrc.json +0 -161
- package/src/style/_fancy-text.scss +0 -37
- package/src/style/_fix_bootstrap_placeholder_color.scss +0 -14
- package/src/style/_header-company.scss +0 -69
- package/src/style/_inputs.scss +0 -12
- package/src/style/_minimal.scss +0 -31
- package/src/style/_navigation.scss +0 -24
- package/src/style/_others.scss +0 -79
- package/src/style/index.scss +0 -7
- package/src/style/sidebar/_animations.scss +0 -21
- package/src/style/sidebar/_dark-theme.scss +0 -77
- package/src/style/sidebar/_scroll.scss +0 -37
- package/src/style/sidebar/_structure.scss +0 -299
- package/src/style/sidebar.scss +0 -4
- package/src/types.js +0 -31
- package/src/utility/calendar.js +0 -39
- package/src/utility/date.js +0 -100
- package/src/utility/index.js +0 -12
- package/src/utility/language.js +0 -17
- package/src/utility/mql.js +0 -3
- package/src/utility/normalize-test.js +0 -58
- package/src/utility/normalize.js +0 -119
- package/src/utility/numbers.js +0 -87
- package/src/utility/numeric.js +0 -114
- package/src/utility/others.jsx +0 -160
- package/src/utility/strings-test.js +0 -136
- package/src/utility/strings.js +0 -80
- package/src/utility/validation/common.js +0 -360
- package/src/utility/validation/index.js +0 -70
- package/src/utility/validation/specific.js +0 -9
- package/src/utility/validation/validate/bank-test.js +0 -129
- package/src/utility/validation/validate/bank.js +0 -176
- package/src/utility/validation/validate/cif-test.js +0 -105
- package/src/utility/validation/validate/cif.js +0 -44
- package/src/utility/validation/validate/cnp-test.js +0 -216
- package/src/utility/validation/validate/cnp.js +0 -261
- package/src/utility/validation/validate/email-test.js +0 -36
- package/src/utility/validation/validate/email.js +0 -6
- package/src/utility/validation/validate/index.js +0 -7
- package/webpack.config.js +0 -90
- package/x25.wiki/Account.md +0 -41
- package/x25.wiki/Company.md +0 -39
- package/x25.wiki/Header.md +0 -21
- package/x25.wiki/Home.md +0 -1
- package/x25.wiki/Inputs.md +0 -33
- package/x25.wiki/Messages.md +0 -27
- package/x25.wiki/Payment.md +0 -42
package/src/Account/reducer.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import type { Action, State } from "src\\types";
|
|
4
|
-
|
|
5
|
-
import { createSelector } from "reselect";
|
|
6
|
-
import * as Immutable from "immutable";
|
|
7
|
-
|
|
8
|
-
import { isAdministratorAccount, noError } from "../utility";
|
|
9
|
-
|
|
10
|
-
const initialState = Immutable.Map({
|
|
11
|
-
error : noError,
|
|
12
|
-
fetched : false,
|
|
13
|
-
fetching : false,
|
|
14
|
-
|
|
15
|
-
info : Immutable.Map(),
|
|
16
|
-
companies : Immutable.Map(),
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
fetchCurrentAccountPending = (state : any) => (
|
|
21
|
-
state.merge({
|
|
22
|
-
error : noError,
|
|
23
|
-
fetching : true,
|
|
24
|
-
})
|
|
25
|
-
),
|
|
26
|
-
fetchCurrentAccountRejected = (state : any, { payload : { error } }) => (
|
|
27
|
-
state.merge({
|
|
28
|
-
error,
|
|
29
|
-
fetching: false,
|
|
30
|
-
})
|
|
31
|
-
),
|
|
32
|
-
fetchCurrentAccountFulfilled = (state : any, { payload }) => (
|
|
33
|
-
state.mergeDeep({
|
|
34
|
-
fetched : true,
|
|
35
|
-
fetching : false,
|
|
36
|
-
|
|
37
|
-
info : payload.Account,
|
|
38
|
-
companies : payload.Companies,
|
|
39
|
-
})
|
|
40
|
-
),
|
|
41
|
-
accountChangePassword = (state : any) => (
|
|
42
|
-
state.setIn([
|
|
43
|
-
"info",
|
|
44
|
-
"RequireChange",
|
|
45
|
-
], false)
|
|
46
|
-
),
|
|
47
|
-
accountGaveConsent = (state : any) => (
|
|
48
|
-
state.setIn([
|
|
49
|
-
"info",
|
|
50
|
-
"HasToGiveConsent",
|
|
51
|
-
], false)
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
const reducer = (state : any = initialState, action : Action) => {
|
|
55
|
-
|
|
56
|
-
switch (action.type) {
|
|
57
|
-
case "FETCH_INITIAL_INFORMATION_PENDING":
|
|
58
|
-
return fetchCurrentAccountPending(state);
|
|
59
|
-
|
|
60
|
-
case "FETCH_INITIAL_INFORMATION_REJECTED":
|
|
61
|
-
return fetchCurrentAccountRejected(state,
|
|
62
|
-
action);
|
|
63
|
-
|
|
64
|
-
case "FETCH_INITIAL_INFORMATION_FULFILLED":
|
|
65
|
-
return fetchCurrentAccountFulfilled(state,
|
|
66
|
-
action);
|
|
67
|
-
|
|
68
|
-
case "ACCOUNT_CHANGE_PASSWORD":
|
|
69
|
-
return accountChangePassword(state);
|
|
70
|
-
|
|
71
|
-
case "ACCOUNT_GAVE_CONSENT":
|
|
72
|
-
return accountGaveConsent(state);
|
|
73
|
-
|
|
74
|
-
default:
|
|
75
|
-
return state;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
getFetched = (state : State) => state.getIn([
|
|
81
|
-
"account",
|
|
82
|
-
"fetched",
|
|
83
|
-
]),
|
|
84
|
-
getError = (state : State) => state.getIn([
|
|
85
|
-
"account",
|
|
86
|
-
"error",
|
|
87
|
-
]);
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
getCurrentAccount = (state : State) => state.getIn([
|
|
91
|
-
"account",
|
|
92
|
-
"info",
|
|
93
|
-
]),
|
|
94
|
-
getCurrentAccountCompanies = (state : State) => state.getIn([
|
|
95
|
-
"account",
|
|
96
|
-
"companies",
|
|
97
|
-
]),
|
|
98
|
-
getCurrentAccountIsFetching = (state : State) => state.getIn([
|
|
99
|
-
"account",
|
|
100
|
-
"fetching",
|
|
101
|
-
]),
|
|
102
|
-
getCurrentAccountShouldFetch = createSelector(
|
|
103
|
-
getCurrentAccountIsFetching,
|
|
104
|
-
getFetched,
|
|
105
|
-
getError,
|
|
106
|
-
(isFetching, isFetched, error) => (
|
|
107
|
-
!isFetching && !isFetched && error === noError
|
|
108
|
-
),
|
|
109
|
-
),
|
|
110
|
-
getCurrentAccountIsFetched = createSelector(
|
|
111
|
-
getCurrentAccountIsFetching,
|
|
112
|
-
getFetched,
|
|
113
|
-
getError,
|
|
114
|
-
(isFetching, isFetched, error) => (
|
|
115
|
-
!isFetching && isFetched && error === noError
|
|
116
|
-
),
|
|
117
|
-
),
|
|
118
|
-
getCurrentAccountHasError = createSelector(
|
|
119
|
-
getError,
|
|
120
|
-
(error) => error !== noError,
|
|
121
|
-
),
|
|
122
|
-
getIsCurrentAccountAdministrator = createSelector(
|
|
123
|
-
getCurrentAccount,
|
|
124
|
-
(account) => (
|
|
125
|
-
isAdministratorAccount(account.get("Type"))
|
|
126
|
-
),
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
export const selectors = {
|
|
130
|
-
getCurrentAccountCompanies,
|
|
131
|
-
getCurrentAccount,
|
|
132
|
-
getCurrentAccountIsFetching,
|
|
133
|
-
getCurrentAccountShouldFetch,
|
|
134
|
-
getCurrentAccountIsFetched,
|
|
135
|
-
getCurrentAccountHasError,
|
|
136
|
-
getIsCurrentAccountAdministrator,
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
export default reducer;
|
package/src/Account/request.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import agent from "superagent";
|
|
4
|
-
import * as Immutable from "immutable";
|
|
5
|
-
|
|
6
|
-
import { noError, normalizeArrayByField, withPromiseCallback, normalizeArray } from "../utility";
|
|
7
|
-
|
|
8
|
-
const normalizeInitialInformation = (info : any) => {
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
{ Account, IsConnected, Counties, Companies } = info;
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
Account : Immutable.Map(Account || {}),
|
|
15
|
-
IsConnected,
|
|
16
|
-
Error : IsConnected ? noError : "Not connected",
|
|
17
|
-
Counties : (typeof Counties === "undefined") ? [] : (
|
|
18
|
-
normalizeArrayByField(Counties,
|
|
19
|
-
"Short").entities
|
|
20
|
-
),
|
|
21
|
-
Companies: (typeof Companies === "undefined") ? [] : (
|
|
22
|
-
normalizeArray(Companies).entities
|
|
23
|
-
),
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const fetchInitialInformation = (app : string) => (
|
|
28
|
-
new Promise((resolve, reject) => (
|
|
29
|
-
agent.
|
|
30
|
-
get("/api/extern/get-initial-information").
|
|
31
|
-
type("form").
|
|
32
|
-
query({ app }).
|
|
33
|
-
end(withPromiseCallback((reponse) => resolve(normalizeInitialInformation(reponse)),
|
|
34
|
-
reject))
|
|
35
|
-
)) : Promise<any>
|
|
36
|
-
);
|
package/src/Async/InitModule.jsx
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import type { RouteType, PaginatorType } from "./types";
|
|
4
|
-
|
|
5
|
-
import type { Dispatch, State } from "src\\types";
|
|
6
|
-
|
|
7
|
-
type Props = {
|
|
8
|
-
+ready: bool;
|
|
9
|
-
+props: any;
|
|
10
|
-
+route: RouteType;
|
|
11
|
-
+initModule: () => void;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
type OwnProps = {
|
|
15
|
-
route: RouteType,
|
|
16
|
-
props: any;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
import * as React from "react";
|
|
20
|
-
|
|
21
|
-
import { LoadingMessage } from "../Messages/Loading";
|
|
22
|
-
import { injectModals } from "../Modal/util";
|
|
23
|
-
import { injectReducer } from "redux-injector";
|
|
24
|
-
import { delay } from "../utility";
|
|
25
|
-
|
|
26
|
-
const injectPaginator = ({ key, itemsReducer, pagesReducer } : PaginatorType) => {
|
|
27
|
-
injectReducer(`entities.${key}`, itemsReducer);
|
|
28
|
-
injectReducer(`paginations.${key}`, pagesReducer);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
import { connect } from "react-redux";
|
|
32
|
-
|
|
33
|
-
import { getIsModuleReady, moduleIsReadyAction } from "../reducer/module";
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
mapStateToProps = (state : State, { route : { default : { module } } } : OwnProps) => ({
|
|
37
|
-
ready: getIsModuleReady(state, module),
|
|
38
|
-
}),
|
|
39
|
-
mapDispatchToProps = (dispatch : Dispatch, { route } : OwnProps) => ({
|
|
40
|
-
initModule () {
|
|
41
|
-
const { reducers, modals, paginators, module } = route.default;
|
|
42
|
-
|
|
43
|
-
delay().
|
|
44
|
-
then(() => {
|
|
45
|
-
if (reducers) {
|
|
46
|
-
if (Array.isArray(reducers)) {
|
|
47
|
-
for (const { key, func } of reducers) {
|
|
48
|
-
injectReducer(key, func);
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
const { key, func } = reducers;
|
|
52
|
-
|
|
53
|
-
injectReducer(key, func);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}).
|
|
57
|
-
then(() => {
|
|
58
|
-
if (modals) {
|
|
59
|
-
injectModals(modals);
|
|
60
|
-
}
|
|
61
|
-
}).
|
|
62
|
-
then(() => {
|
|
63
|
-
if (paginators) {
|
|
64
|
-
if (Array.isArray(paginators)) {
|
|
65
|
-
for (const paginator of paginators) {
|
|
66
|
-
injectPaginator(paginator);
|
|
67
|
-
}
|
|
68
|
-
} else {
|
|
69
|
-
injectPaginator(paginators);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}).
|
|
73
|
-
then(() => {
|
|
74
|
-
dispatch(moduleIsReadyAction(module));
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
class InitModule extends React.Component<Props> {
|
|
80
|
-
componentDidMount () {
|
|
81
|
-
if (!this.props.ready) {
|
|
82
|
-
this.props.initModule();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
shouldComponentUpdate () {
|
|
87
|
-
return (
|
|
88
|
-
true
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
render () {
|
|
93
|
-
const { route, ready, props } = this.props;
|
|
94
|
-
const { Component } = route.default;
|
|
95
|
-
|
|
96
|
-
if (ready) {
|
|
97
|
-
return <Component {...props} />;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return (
|
|
101
|
-
<div className="mt-3">
|
|
102
|
-
<LoadingMessage message="Așteaptă un pic..." />
|
|
103
|
-
</div>
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const WrapInitModule = connect(mapStateToProps, mapDispatchToProps)(InitModule);
|
|
109
|
-
|
|
110
|
-
const createWrap = (route : RouteType, props: any) => (
|
|
111
|
-
<WrapInitModule props={props} route={route} />
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
export default createWrap;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
type LoadingPropTypes = {
|
|
4
|
-
+error?: any;
|
|
5
|
-
+timedOut: bool;
|
|
6
|
-
+pastDelay: bool;
|
|
7
|
-
+retry: () => void;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
type FireErrorPropTypes = {
|
|
11
|
-
error: any;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
import React from "react";
|
|
15
|
-
|
|
16
|
-
import { LoadingMessage } from "../Messages/Loading";
|
|
17
|
-
import SimulatedException from "./SimulatedException";
|
|
18
|
-
|
|
19
|
-
import { ErrorBoundary } from "./index";
|
|
20
|
-
|
|
21
|
-
const IgnoreThisNode = ({ error : { message, stack } } : FireErrorPropTypes) => {
|
|
22
|
-
throw new SimulatedException(message, stack);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const RouteLoading = ({ error, retry, timedOut } : LoadingPropTypes) => {
|
|
26
|
-
if (error) {
|
|
27
|
-
return (
|
|
28
|
-
<ErrorBoundary>
|
|
29
|
-
<IgnoreThisNode error={error} />
|
|
30
|
-
</ErrorBoundary>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (timedOut) {
|
|
35
|
-
return (
|
|
36
|
-
<div>{"Se pare că se încarcă mai greu ca de obicei "}
|
|
37
|
-
<button
|
|
38
|
-
className="btn btn-primary btn-block"
|
|
39
|
-
onClick={retry} type="button">{"Încearcă din nou"}
|
|
40
|
-
</button>
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<div className="mt-3">
|
|
47
|
-
<LoadingMessage message="Așteaptă un pic..." />
|
|
48
|
-
</div>
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export default RouteLoading;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
/* eslint-disable max-classes-per-file */
|
|
3
|
-
|
|
4
|
-
class CustomError<Message: string, Stack: string> extends Error {
|
|
5
|
-
|
|
6
|
-
constructor (message: Message, stack: Stack) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.message = message;
|
|
9
|
-
this.name = message;
|
|
10
|
-
this.stack = stack;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
type Message = string;
|
|
15
|
-
type Stack = string;
|
|
16
|
-
|
|
17
|
-
class SimulatedException extends CustomError<Message, Stack> {}
|
|
18
|
-
|
|
19
|
-
export default SimulatedException;
|
package/src/Async/index.jsx
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
/* eslint-disable new-cap, react/prefer-stateless-function, react/require-optimization */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type LoaderType = (path : string) => void;
|
|
6
|
-
|
|
7
|
-
import Loadable from "react-loadable";
|
|
8
|
-
import * as React from "react";
|
|
9
|
-
|
|
10
|
-
import RouteLoading from "./RouteLoading";
|
|
11
|
-
import InitModule from "./InitModule";
|
|
12
|
-
|
|
13
|
-
// type injectPaginatorTypes = {
|
|
14
|
-
// key: string,
|
|
15
|
-
// itemsReducer: any;
|
|
16
|
-
// pagesReducer: any;
|
|
17
|
-
// };
|
|
18
|
-
// import { injectReducer } from "redux-injector";
|
|
19
|
-
// import { injectModals } from "../Modal/util";
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
timeout = 15000;
|
|
23
|
-
|
|
24
|
-
export let
|
|
25
|
-
ErrorBoundary = () => (
|
|
26
|
-
<div>{"No ErrorBoundary passed to x25"}</div>
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
// const injectPaginator = ({ key, itemsReducer, pagesReducer } : injectPaginatorTypes) => {
|
|
30
|
-
// injectReducer(`entities.${key}`, itemsReducer);
|
|
31
|
-
// injectReducer(`paginations.${key}`, pagesReducer);
|
|
32
|
-
// };
|
|
33
|
-
|
|
34
|
-
// const renderWithReducer = (route, props) => {
|
|
35
|
-
// const { Component, reducers, modals, paginators } = route.default;
|
|
36
|
-
//
|
|
37
|
-
// if (reducers) {
|
|
38
|
-
// if (Array.isArray(reducers)) {
|
|
39
|
-
// for (const { key, func } of reducers) {
|
|
40
|
-
// injectReducer(key, func);
|
|
41
|
-
// }
|
|
42
|
-
// } else {
|
|
43
|
-
// const { key, func } = reducers;
|
|
44
|
-
//
|
|
45
|
-
// injectReducer(key, func);
|
|
46
|
-
// }
|
|
47
|
-
// }
|
|
48
|
-
//
|
|
49
|
-
// if (modals) {
|
|
50
|
-
// injectModals(modals);
|
|
51
|
-
// }
|
|
52
|
-
//
|
|
53
|
-
// if (paginators) {
|
|
54
|
-
// if (Array.isArray(paginators)) {
|
|
55
|
-
// for (const paginator of paginators) {
|
|
56
|
-
// injectPaginator(paginator);
|
|
57
|
-
// }
|
|
58
|
-
// } else {
|
|
59
|
-
// injectPaginator(paginators);
|
|
60
|
-
// }
|
|
61
|
-
// }
|
|
62
|
-
//
|
|
63
|
-
// return <Component {...props} />;
|
|
64
|
-
// };
|
|
65
|
-
|
|
66
|
-
export const setErrorBoundary = (theError : React.Node) => {
|
|
67
|
-
ErrorBoundary = theError;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export const createAsyncRoute = (loader : LoaderType) => Loadable({
|
|
71
|
-
loader,
|
|
72
|
-
loading : RouteLoading,
|
|
73
|
-
render : InitModule,
|
|
74
|
-
timeout,
|
|
75
|
-
});
|
package/src/Async/types.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
// import * as React from "react";
|
|
4
|
-
|
|
5
|
-
import type { State } from "src\\types";
|
|
6
|
-
import type { ModalsTypes } from "../Modal/types";
|
|
7
|
-
|
|
8
|
-
type Reducer = (state : State, action : any) => void;
|
|
9
|
-
|
|
10
|
-
type ReducerOptionsType = {
|
|
11
|
-
key: string,
|
|
12
|
-
func: Reducer,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type PaginatorType = {
|
|
16
|
-
key: string,
|
|
17
|
-
itemsReducer: Reducer;
|
|
18
|
-
pagesReducer: Reducer;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
type ReducersTypes = Array<ReducerOptionsType> | ReducerOptionsType;
|
|
22
|
-
type PaginatorsTypes = Array<PaginatorType> | PaginatorType;
|
|
23
|
-
|
|
24
|
-
type RouteType = {
|
|
25
|
-
default: {
|
|
26
|
-
module: string,
|
|
27
|
-
Component: any,
|
|
28
|
-
reducers: ReducersTypes,
|
|
29
|
-
modals: ModalsTypes,
|
|
30
|
-
paginators: PaginatorsTypes,
|
|
31
|
-
},
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export type {
|
|
35
|
-
ReducersTypes,
|
|
36
|
-
PaginatorsTypes,
|
|
37
|
-
PaginatorType,
|
|
38
|
-
RouteType,
|
|
39
|
-
};
|
package/src/Company/Load.jsx
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
/* eslint-disable react/require-optimization */
|
|
3
|
-
|
|
4
|
-
import type { Dispatch, State } from "src\\types";
|
|
5
|
-
|
|
6
|
-
type PropTypes = {
|
|
7
|
-
+isAdministrator: bool;
|
|
8
|
-
+isFetching: bool;
|
|
9
|
-
+hasError: bool;
|
|
10
|
-
|
|
11
|
-
+data: any;
|
|
12
|
-
+shouldFetch: any;
|
|
13
|
-
+children: any;
|
|
14
|
-
|
|
15
|
-
+fetchCurrentCompany: () => void;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
import React from "react";
|
|
19
|
-
|
|
20
|
-
import { withRouter } from "react-router-dom";
|
|
21
|
-
// import moment from "moment";
|
|
22
|
-
import { connect } from "react-redux";
|
|
23
|
-
|
|
24
|
-
import { selectors } from "./reducer";
|
|
25
|
-
import { accountSelectors } from "../Account";
|
|
26
|
-
|
|
27
|
-
import { fetchCurrentCompany as fetchCurrentCompanyAction } from "./actions";
|
|
28
|
-
|
|
29
|
-
import { LargeErrorMessage, LoadingMessage } from "../Messages";
|
|
30
|
-
|
|
31
|
-
// import EstimatePrice from "../Payment/EstimatePrice";
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
mapStateToProps = (state : State) => ({
|
|
35
|
-
isAdministrator : accountSelectors.getIsCurrentAccountAdministrator(state),
|
|
36
|
-
data : selectors.getCurrentCompany(state),
|
|
37
|
-
hasError : selectors.getCurrentCompanyHasError(state),
|
|
38
|
-
fetched : selectors.getCurrentCompanyIsFetched(state),
|
|
39
|
-
isFetching : selectors.getCurrentCompanyIsFetching(state),
|
|
40
|
-
shouldFetch : selectors.getCurrentCompanyShouldFetch(state),
|
|
41
|
-
}),
|
|
42
|
-
mapDispatchToProps = (dispatch : Dispatch, { match : { params : { company } } }) => ({
|
|
43
|
-
fetchCurrentCompany () {
|
|
44
|
-
dispatch(fetchCurrentCompanyAction(company));
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const LoadCompany = (props : PropTypes) => {
|
|
50
|
-
const { children, data, isFetching, shouldFetch, hasError, fetchCurrentCompany } = props;
|
|
51
|
-
|
|
52
|
-
React.useEffect(() => {
|
|
53
|
-
if (shouldFetch) {
|
|
54
|
-
fetchCurrentCompany();
|
|
55
|
-
}
|
|
56
|
-
}, [
|
|
57
|
-
shouldFetch,
|
|
58
|
-
isFetching,
|
|
59
|
-
hasError,
|
|
60
|
-
]);
|
|
61
|
-
|
|
62
|
-
if (isFetching) {
|
|
63
|
-
return (
|
|
64
|
-
<LoadingMessage message="Așteaptă..." />
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (hasError) {
|
|
69
|
-
return (
|
|
70
|
-
<LargeErrorMessage
|
|
71
|
-
message="Nu am putut stabili conexiunea cu server-ul"
|
|
72
|
-
onRetry={fetchCurrentCompany}
|
|
73
|
-
/>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (data.size === 0) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return children;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(LoadCompany));
|
package/src/Company/actions.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import type { Action } from "src\\types";
|
|
4
|
-
|
|
5
|
-
import { fetchCurrentCompany as fetchCurrentCompanyRequest } from "./request";
|
|
6
|
-
|
|
7
|
-
export const fetchCurrentCompany = (rawID : string) : Action => ({
|
|
8
|
-
type : "FETCH_CURRENT_COMPANY_INFO",
|
|
9
|
-
payload : fetchCurrentCompanyRequest(rawID),
|
|
10
|
-
});
|