datastake-daf 0.6.843 → 0.6.845

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.
@@ -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({