datastake-daf 0.6.843 → 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.
@@ -62422,7 +62422,8 @@ const namespaceMap = {
62422
62422
  "armed-groups": "stakeholder",
62423
62423
  scl: "location",
62424
62424
  testimonials: 'event',
62425
- 'corrective-actions': 'event'
62425
+ 'corrective-actions': 'event',
62426
+ kyc: 'stakeholder'
62426
62427
  };
62427
62428
 
62428
62429
  const getColumns = ({
@@ -62682,7 +62683,10 @@ const LinkingTemplate = ({
62682
62683
  }), [conf]);
62683
62684
  const id = conf.allData.id;
62684
62685
  const dataSource = conf?.linkingTemplateContextData?.[id];
62685
- const _namespace = namespaceMap[namespace];
62686
+
62687
+ // Derive namespace from conf.allData.form if not provided
62688
+ const derivedNamespace = namespace || conf.allData?.form;
62689
+ const _namespace = namespaceMap[derivedNamespace] || derivedNamespace;
62686
62690
  const changeData = async () => {
62687
62691
  try {
62688
62692
  const _data = await LinkedSubjectsService$1.getLinkedSubjects({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.843",
3
+ "version": "0.6.844",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -1,7 +1,7 @@
1
1
  import Modal from "../../../../Modal/index.jsx";
2
- import { Form, Select, Input, Alert } from "antd";
2
+ import { Form, Select, Input, Alert, message } from "antd";
3
3
  import { useState, useEffect, useMemo } from "react";
4
-
4
+ import { findOptions } from "../../../../../../../helpers/StringHelper.js";
5
5
  export default function NewAccount({
6
6
  t,
7
7
  isOpen,
@@ -12,26 +12,32 @@ export default function NewAccount({
12
12
  inviteAccount,
13
13
  isPending=false,
14
14
  accountToEdit,
15
+ countries
15
16
  }) {
16
17
  const [MainForm] = Form.useForm();
17
18
  const [loading, setLoading] = useState(false);
18
19
  const [accountUsed, setAccountUsed] = useState(false);
19
20
 
20
21
 
21
-
22
22
  const isEdit = useMemo(() => accountToEdit && typeof accountToEdit === "object", [accountToEdit]);
23
23
 
24
+ const selectedCountry = useMemo(
25
+ () => findOptions(accountToEdit?.otherData?.country, countries),
26
+ [accountToEdit?.otherData?.country, countries]
27
+ );
28
+ console.log(selectedCountry, "selectedCountry");
24
29
  useEffect(() => {
25
30
  if (accountToEdit && typeof accountToEdit === "object") {
26
31
  MainForm.setFieldsValue({
27
32
  name: accountToEdit.name,
28
33
  email: accountToEdit.email,
29
34
  type: accountToEdit?.otherData?.interface,
35
+ country: selectedCountry,
30
36
  });
31
37
  } else {
32
38
  MainForm.resetFields();
33
39
  }
34
- }, [accountToEdit, MainForm]);
40
+ }, [accountToEdit, MainForm, selectedCountry]);
35
41
 
36
42
  const onSubmit = async () => {
37
43
  try {
@@ -45,6 +51,7 @@ export default function NewAccount({
45
51
  data: val,
46
52
  isPending: accountToEdit.status === 'pending' || isPending
47
53
  });
54
+ message.success(t("Account successfully updated"));
48
55
  } else {
49
56
  if (!inviteAccount) {
50
57
  throw new Error("inviteAccount function is required for creating new accounts");
@@ -80,7 +87,7 @@ export default function NewAccount({
80
87
  <Input placeholder={t("Type")} />
81
88
  </Form.Item>
82
89
 
83
-
90
+ {!isEdit && (
84
91
  <Form.Item
85
92
  name="email"
86
93
  label={t("Email")}
@@ -88,7 +95,13 @@ export default function NewAccount({
88
95
  >
89
96
  <Input placeholder={t("Type")} />
90
97
  </Form.Item>
91
-
98
+ )}
99
+ {isEdit && (
100
+ <Form.Item name="country" label={t("Country")} rules={[{ required: true }]}>
101
+ <Select placeholder={t("Select")} options={countries} />
102
+ </Form.Item>
103
+
104
+ )}
92
105
  <Form.Item name="type" label={t("Type")} rules={[{ required: true }]}>
93
106
  <Select placeholder={t("Select")} options={accountTypes || []} />
94
107
  </Form.Item>
@@ -49,6 +49,7 @@ export default function AdminAccountsScreen({ config }) {
49
49
  const query = useQuery ? useQuery() : { get: () => null };
50
50
  const [addAccountVisible, setAddAccountVisible] = useState(!!query.get("create"));
51
51
  const [accountToEdit, setAccountToEdit] = useState(null);
52
+ const [refetchTrigger, setRefetchTrigger] = useState(0);
52
53
 
53
54
 
54
55
 
@@ -102,6 +103,7 @@ function handleCopyInvitation(account) {
102
103
  headerTitle="accounts"
103
104
  actionButton={actionButtons}
104
105
  getData={handleGetData}
106
+ refetchTrigger={refetchTrigger}
105
107
  config={{
106
108
  accountTypes,
107
109
  addAccountVisible,
@@ -125,8 +127,9 @@ function handleCopyInvitation(account) {
125
127
  setAccountToEdit(null);
126
128
  }}
127
129
  accountTypes={accountTypes}
128
- countriesOptions={options?.countries}
130
+ countries={options?.countries}
129
131
  fetchData={() => {
132
+ setRefetchTrigger((prev) => prev + 1);
130
133
  }}
131
134
  inviteAccount={(data) => AdminService.inviteAccount(data)}
132
135
  updateAccount={({ data, id, isPending }) => AdminService.updateAccount({ data, id, isPending })}
@@ -33,6 +33,7 @@ export default function AccountTable({
33
33
  defaultPageSize = 20,
34
34
  actionButton,
35
35
  inviteAccount,
36
+ refetchTrigger,
36
37
  }) {
37
38
  const accountTypes = config?.accountTypes;
38
39
  const [showFilters, setShowFilters] = useState(false);
@@ -61,6 +62,7 @@ export default function AccountTable({
61
62
  getRedirectLink,
62
63
  getData,
63
64
  fetchPendingOnMount: true,
65
+ refetchTrigger,
64
66
  });
65
67
 
66
68
  const selectOptions = useMemo(() => {
@@ -1,228 +1,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
- // }
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
+ }
@@ -90,4 +90,5 @@ export const namespaceMap = {
90
90
  scl: "location",
91
91
  testimonials: 'event',
92
92
  'corrective-actions': 'event',
93
+ kyc: 'stakeholder',
93
94
  }
@@ -44,7 +44,9 @@ const LinkingTemplate = ({
44
44
 
45
45
  const dataSource = conf?.linkingTemplateContextData?.[id];
46
46
 
47
- const _namespace = namespaceMap[namespace];
47
+ // Derive namespace from conf.allData.form if not provided
48
+ const derivedNamespace = namespace || conf.allData?.form;
49
+ const _namespace = namespaceMap[derivedNamespace] || derivedNamespace;
48
50
 
49
51
  const changeData = async () => {
50
52
  try {
@@ -60,6 +60,7 @@ class LinkedSubjectsService extends BaseService {
60
60
  params: { authorId: sourceId, source, version },
61
61
  });
62
62
  }
63
+
63
64
 
64
65
  getData(query, namespace) {
65
66
  return this.apiGet({
package/build/favicon.ico DELETED
Binary file
package/build/logo192.png DELETED
Binary file
package/build/logo512.png DELETED
Binary file