datastake-daf 0.6.842 → 0.6.844
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.js +800 -774
- package/dist/hooks/index.js +4 -6
- package/dist/layouts/index.js +6 -0
- package/dist/pages/index.js +172 -115
- package/package.json +1 -1
- package/src/@daf/core/components/DynamicForm/hook.js +2 -2
- package/src/@daf/core/components/DynamicForm/index.jsx +1 -1
- package/src/@daf/core/components/Filters/selectFilters/index.jsx +7 -1
- package/src/@daf/core/components/Graphs/TradeRelationship/index.jsx +1 -27
- package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +22 -18
- package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +19 -6
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Accounts.jsx +4 -1
- package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +2 -0
- package/src/@daf/core/components/Select/MultiSelect/style.js +1 -1
- package/src/@daf/core/components/ViewForm/components/DataLink/flat.js +7 -3
- package/src/@daf/core/components/ViewForm/components/DataLink/index.js +6 -2
- package/src/@daf/core/components/ViewForm/components/input.js +7 -7
- package/src/@daf/hooks/useWidgetFetch.js +26 -35
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/IncidentsTime/index.js +1 -0
- package/src/@daf/pages/ResetPassword/index.jsx +228 -228
- package/src/@daf/pages/Summary/Operator/components/KeyInformation/config.js +0 -1
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/helper.js +7 -5
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/hook.js +29 -14
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +69 -20
- package/src/@daf/pages/Summary/Operator/index.jsx +1 -0
- package/src/@daf/pages/Template/components/LinkingTemplate/config.js +1 -0
- package/src/@daf/pages/Template/components/LinkingTemplate/index.jsx +3 -1
- package/src/@daf/pages/View/index.jsx +1 -1
- package/src/@daf/services/LinkedSubjects.js +1 -0
- package/src/helpers/Forms.js +7 -5
|
@@ -1,228 +1,228 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DafButton from "../../../Button/index.jsx";
|
|
3
|
+
import Loading from "../../../Loading/index.jsx";
|
|
4
|
+
import AuthForm from "../../../AuthForm/index.jsx";
|
|
5
|
+
|
|
6
|
+
const step = 1;
|
|
7
|
+
|
|
8
|
+
export default function ResetPassword({
|
|
9
|
+
resetRequestSuccedded,
|
|
10
|
+
resetRequestError,
|
|
11
|
+
submitting,
|
|
12
|
+
requestResetPassword,
|
|
13
|
+
resetPassword,
|
|
14
|
+
params: propParams = {},
|
|
15
|
+
Layout,
|
|
16
|
+
goTo,
|
|
17
|
+
t,
|
|
18
|
+
theme,
|
|
19
|
+
errors,
|
|
20
|
+
|
|
21
|
+
loginPath: loginPathProp,
|
|
22
|
+
}) {
|
|
23
|
+
const { app, confirmationToken } = propParams;
|
|
24
|
+
|
|
25
|
+
const getLogInLink = () => {
|
|
26
|
+
if (loginPathProp) return loginPathProp;
|
|
27
|
+
if (app) return `/${app}/login`;
|
|
28
|
+
return "/login";
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const handleGoToLogin = () => {
|
|
32
|
+
const link = getLogInLink();
|
|
33
|
+
if (goTo && typeof goTo === "function") {
|
|
34
|
+
goTo(link);
|
|
35
|
+
} else {
|
|
36
|
+
window.location.href = link;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const title = !confirmationToken
|
|
41
|
+
? resetRequestSuccedded
|
|
42
|
+
? "Thank you"
|
|
43
|
+
: "Reset Password"
|
|
44
|
+
: resetRequestSuccedded
|
|
45
|
+
? "Password updated"
|
|
46
|
+
: "Create Password";
|
|
47
|
+
|
|
48
|
+
const subTitle = !confirmationToken
|
|
49
|
+
? resetRequestSuccedded
|
|
50
|
+
? "A password reset link has been sent to your email address. If you can’t find the message in your inbox, please check your spam folder!"
|
|
51
|
+
: "Please enter your email, to get a link and request a new password."
|
|
52
|
+
: resetRequestSuccedded
|
|
53
|
+
? "Your password has been updated, click in the button below to log in."
|
|
54
|
+
: "Please set up your new password.";
|
|
55
|
+
|
|
56
|
+
const requestResetFields = [
|
|
57
|
+
{
|
|
58
|
+
name: "email",
|
|
59
|
+
label: t("Email"),
|
|
60
|
+
type: "input",
|
|
61
|
+
required: true,
|
|
62
|
+
rules: [
|
|
63
|
+
{
|
|
64
|
+
required: true,
|
|
65
|
+
message: t("errors::email should not be empty"),
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
pattern:
|
|
69
|
+
/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/,
|
|
70
|
+
message: t("errors::email is not valid"),
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
placeholder: t("Email"),
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
const resetPasswordFields = [
|
|
78
|
+
{
|
|
79
|
+
name: "password",
|
|
80
|
+
label: t("Enter password"),
|
|
81
|
+
type: "password",
|
|
82
|
+
required: true,
|
|
83
|
+
rules: [
|
|
84
|
+
{
|
|
85
|
+
required: true,
|
|
86
|
+
message: t("errors::password should not be empty"),
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
placeholder: t("••••••••"),
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: "confirmPassword",
|
|
93
|
+
label: t("Confirm password"),
|
|
94
|
+
type: "password",
|
|
95
|
+
required: true,
|
|
96
|
+
dependencies: ["password"],
|
|
97
|
+
rules: [
|
|
98
|
+
{
|
|
99
|
+
required: true,
|
|
100
|
+
message: t("errors::password should not be empty"),
|
|
101
|
+
},
|
|
102
|
+
({ getFieldValue }) => ({
|
|
103
|
+
validator(rule, value) {
|
|
104
|
+
if (!value || getFieldValue("password") === value) {
|
|
105
|
+
return Promise.resolve();
|
|
106
|
+
}
|
|
107
|
+
return Promise.reject(t("errors::passwordNotMatch"));
|
|
108
|
+
},
|
|
109
|
+
}),
|
|
110
|
+
],
|
|
111
|
+
placeholder: t("••••••••"),
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
const handleRequestResetSubmit = (values) => {
|
|
116
|
+
requestResetPassword(values);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const handleResetPasswordSubmit = (values) => {
|
|
120
|
+
|
|
121
|
+
resetPassword({
|
|
122
|
+
...values,
|
|
123
|
+
passConfirmationToken: confirmationToken,
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const currentTheme = theme || window.theme;
|
|
128
|
+
|
|
129
|
+
const Content = (
|
|
130
|
+
<>
|
|
131
|
+
{!resetRequestSuccedded && !confirmationToken && (
|
|
132
|
+
<>
|
|
133
|
+
<AuthForm
|
|
134
|
+
fields={requestResetFields}
|
|
135
|
+
onSubmit={handleRequestResetSubmit}
|
|
136
|
+
submitText={t("Get Link")}
|
|
137
|
+
errors={errors}
|
|
138
|
+
t={t}
|
|
139
|
+
executeRecaptcha={() => Promise.resolve(true)}
|
|
140
|
+
theme={currentTheme}
|
|
141
|
+
submitButtonProps={{
|
|
142
|
+
loading: submitting,
|
|
143
|
+
}}
|
|
144
|
+
/>
|
|
145
|
+
<div className="mt-4">
|
|
146
|
+
<DafButton
|
|
147
|
+
type="default"
|
|
148
|
+
className="normal-br"
|
|
149
|
+
style={
|
|
150
|
+
currentTheme
|
|
151
|
+
? {
|
|
152
|
+
borderColor: currentTheme.colorPrimary,
|
|
153
|
+
color: currentTheme.colorPrimary,
|
|
154
|
+
}
|
|
155
|
+
: {}
|
|
156
|
+
}
|
|
157
|
+
onClick={handleGoToLogin}
|
|
158
|
+
>
|
|
159
|
+
{t("Back")}
|
|
160
|
+
</DafButton>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
{resetRequestError ? (
|
|
164
|
+
<div
|
|
165
|
+
className="ant-form-item-explain errors-cont no-pt mt-3"
|
|
166
|
+
style={{ color: "#ff4d4f" }}
|
|
167
|
+
>
|
|
168
|
+
{t(resetRequestError)}
|
|
169
|
+
</div>
|
|
170
|
+
) : null}
|
|
171
|
+
</>
|
|
172
|
+
)}
|
|
173
|
+
|
|
174
|
+
{!resetRequestSuccedded && confirmationToken && (
|
|
175
|
+
<AuthForm
|
|
176
|
+
fields={resetPasswordFields}
|
|
177
|
+
onSubmit={handleResetPasswordSubmit}
|
|
178
|
+
submitText={t("Reset Password")}
|
|
179
|
+
errors={errors}
|
|
180
|
+
t={t}
|
|
181
|
+
executeRecaptcha={() => Promise.resolve(true)}
|
|
182
|
+
theme={currentTheme}
|
|
183
|
+
submitButtonProps={{
|
|
184
|
+
loading: submitting,
|
|
185
|
+
}}
|
|
186
|
+
/>
|
|
187
|
+
)}
|
|
188
|
+
|
|
189
|
+
{resetRequestSuccedded && confirmationToken && (
|
|
190
|
+
<div className="buttons">
|
|
191
|
+
<DafButton
|
|
192
|
+
type="primary"
|
|
193
|
+
className="normal-br"
|
|
194
|
+
style={
|
|
195
|
+
currentTheme
|
|
196
|
+
? {
|
|
197
|
+
backgroundColor: currentTheme.colorPrimary,
|
|
198
|
+
borderColor: currentTheme.colorPrimary,
|
|
199
|
+
}
|
|
200
|
+
: {}
|
|
201
|
+
}
|
|
202
|
+
onClick={handleGoToLogin}
|
|
203
|
+
>
|
|
204
|
+
{t("Log In")}
|
|
205
|
+
</DafButton>
|
|
206
|
+
</div>
|
|
207
|
+
)}
|
|
208
|
+
|
|
209
|
+
{resetRequestSuccedded && !confirmationToken && null}
|
|
210
|
+
</>
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
if (Layout) {
|
|
214
|
+
return (
|
|
215
|
+
<Layout app={app} step={step} title={title} subTitle={subTitle}>
|
|
216
|
+
{Content}
|
|
217
|
+
</Layout>
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return (
|
|
222
|
+
<div style={{ padding: 20, maxWidth: 400, margin: "0 auto" }}>
|
|
223
|
+
<h2>{title}</h2>
|
|
224
|
+
<p>{subTitle}</p>
|
|
225
|
+
{Content}
|
|
226
|
+
</div>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
@@ -43,7 +43,6 @@ export const getKeyIndicatorConfig = ({ t, data = {}, options = {} }) => [
|
|
|
43
43
|
label: t("Legal Form"),
|
|
44
44
|
render: () => {
|
|
45
45
|
const subCategory = findOptions(data?.subCategory, options?.subCategoriesOptions || options?.subCategory);
|
|
46
|
-
console.log({subCategory, initialSub: data?.subCategory, options: options?.subCategoriesOptions || options?.subCategory})
|
|
47
46
|
if(subCategory?.length > 22) {
|
|
48
47
|
const _subCategory = truncateString(subCategory, 22);
|
|
49
48
|
return <Tooltip title={subCategory}>
|
|
@@ -2,6 +2,7 @@ import { leftIcons, leftBackgroundColorLocation, leftBackgroundColorStakeholder,
|
|
|
2
2
|
import { findOptions } from '../../../../../../helpers/StringHelper.js';
|
|
3
3
|
|
|
4
4
|
export const getFilterConfig = ({operatorData = {}, options = {}, filters = {}, t = () => {}, APP}) => {
|
|
5
|
+
console.log({operatorData})
|
|
5
6
|
const productSet = new Set();
|
|
6
7
|
const allTradeMineralOptions = [
|
|
7
8
|
...(operatorData?.suppliers || []),
|
|
@@ -33,17 +34,18 @@ const label = options?.[
|
|
|
33
34
|
return option && index === self.findIndex((o) => o.value === option.value);
|
|
34
35
|
});
|
|
35
36
|
|
|
36
|
-
const value = filters
|
|
37
|
-
return
|
|
38
|
-
{
|
|
37
|
+
const value = filters?.products ? { value: filters?.products } : {};
|
|
38
|
+
return {
|
|
39
|
+
products: {
|
|
39
40
|
label: t("Products"),
|
|
40
41
|
placeholder: t("Select"),
|
|
41
42
|
key: "products",
|
|
42
43
|
type: "select",
|
|
43
|
-
...value,
|
|
44
|
+
// ...value,
|
|
45
|
+
style: { flex: 1 },
|
|
44
46
|
options: combinedMineralOptions,
|
|
45
47
|
},
|
|
46
|
-
|
|
48
|
+
};
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
export const getLeft = (data = {}, mapChildren = () => {}, supplierLocations = []) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useState, useMemo } from "react";
|
|
1
|
+
import { useEffect, useState, useMemo, useRef } from "react";
|
|
2
2
|
import { useWidgetFetch } from "../../../../../hooks/useWidgetFetch.js";
|
|
3
3
|
import { leftIcons, leftBackgroundColorLocation, leftBackgroundColorStakeholder, topIcons } from './config.js';
|
|
4
4
|
import { findOptions } from '../../../../../../helpers/StringHelper.js';
|
|
@@ -8,6 +8,8 @@ import { getLeft, mapItem as _mapItem } from './helper.js';
|
|
|
8
8
|
export const useTradeRelationship = ({
|
|
9
9
|
id,
|
|
10
10
|
selectedPartners,
|
|
11
|
+
isProductsFilterReady,
|
|
12
|
+
hasProducts,
|
|
11
13
|
options,
|
|
12
14
|
goTo,
|
|
13
15
|
getRedirectLink,
|
|
@@ -19,26 +21,38 @@ export const useTradeRelationship = ({
|
|
|
19
21
|
const [graphData, setGraphData] = useState({});
|
|
20
22
|
const [loading, setLoading] = useState(false);
|
|
21
23
|
const [fetchedProducts, setFetchedProducts] = useState(false);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const initFetchDoneRef = useRef(false);
|
|
25
|
+
|
|
26
|
+
const product = useMemo(() => {
|
|
27
|
+
return filters?.products
|
|
28
|
+
}, [filters?.products]);
|
|
29
|
+
|
|
30
|
+
console.log({hasProducts, product, isProductsFilterReady, stop: !selectedPartners?.partners?.length
|
|
31
|
+
|| selectedPartners?.loading || !isProductsFilterReady || (isProductsFilterReady && hasProducts && !product)},
|
|
32
|
+
!selectedPartners?.partners?.length,
|
|
33
|
+
selectedPartners?.loading,
|
|
34
|
+
!isProductsFilterReady,
|
|
35
|
+
(isProductsFilterReady && hasProducts && !product))
|
|
36
|
+
const config = useMemo(() => ({
|
|
37
|
+
basepath: "analytics",
|
|
38
|
+
url: `/widgets/trade-relationship-map`,
|
|
39
|
+
filters: {
|
|
27
40
|
datastakeId: id,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
stop: !selectedPartners?.partners?.length
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
...(product && {product: product}),
|
|
42
|
+
sources: selectedPartners?.partners || [],
|
|
43
|
+
},
|
|
44
|
+
stop: !selectedPartners?.partners?.length
|
|
45
|
+
|| selectedPartners?.loading || !isProductsFilterReady || (isProductsFilterReady && hasProducts && !product)
|
|
46
|
+
}), [id, product, selectedPartners?.partners, selectedPartners?.loading, isProductsFilterReady, hasProducts]);
|
|
47
|
+
|
|
48
|
+
const { data, loading: dataLoading } = useWidgetFetch({config: config});
|
|
35
49
|
|
|
36
50
|
const mapItem = (data) => {
|
|
37
51
|
return _mapItem(data, options, goTo, getRedirectLink, operatorData, APP);
|
|
38
52
|
}
|
|
39
53
|
|
|
40
54
|
useEffect(() => {
|
|
41
|
-
if (id && selectedPartners?.partners?.length > 0
|
|
55
|
+
if (id && selectedPartners?.partners?.length > 0) {
|
|
42
56
|
const _fetch = async () => {
|
|
43
57
|
setLoading(true);
|
|
44
58
|
|
|
@@ -156,5 +170,6 @@ export const useTradeRelationship = ({
|
|
|
156
170
|
setGraphData,
|
|
157
171
|
setLoading,
|
|
158
172
|
data,
|
|
173
|
+
dataLoading
|
|
159
174
|
}
|
|
160
175
|
}
|