@stokr/components-library 3.1.0 → 3.2.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/dist/analytics/index.js +1 -3
- package/dist/components/Checklist/ChecklistCard.js +1 -2
- package/dist/components/Checklist/ChecklistCard.styles.js +39 -0
- package/dist/components/CryptoAddressWrapper/CryptoAddressWrapper.js +1 -3
- package/dist/components/FAQ/FAQ.js +1 -3
- package/dist/components/Form/Form.js +1 -3
- package/dist/components/RefreshButton/RefreshButton.js +3 -5
- package/dist/components/SectionTitle/SectionTitle.styles.js +1 -2
- package/dist/index.js +34 -71
- package/package.json +1 -3
- package/dist/api/fetchData.js +0 -27
- package/dist/api/fetchDataPublic.js +0 -19
- package/dist/components/Newsletter/Newsletter.js +0 -120
- package/dist/components/Newsletter/Newsletter.styles.js +0 -186
- package/dist/components/ToDoList/ToDoList.js +0 -167
- package/dist/components/ToDoList/ToDoList.styles.js +0 -122
- package/dist/components/ToDoList/ToDoListTask.js +0 -89
- package/dist/components/ToDoList/ToDoListTask.styles.js +0 -119
- package/dist/components/taxId/complete.js +0 -45
- package/dist/components/taxId/flow.js +0 -63
- package/dist/components/taxId/register-taxid.js +0 -189
- package/dist/context/Checkbox/CheckboxContext.js +0 -151
- package/dist/model/axios.js +0 -10
- package/dist/model/axiosPublic.js +0 -9
- package/dist/routing/RouterWrapper.js +0 -17
- package/dist/routing/navigate-app.js +0 -24
- package/dist/runtime-config.js +0 -35
- package/dist/utils/app-urls-analytics-backoffice.js +0 -30
- package/dist/utils/app-urls.js +0 -10
- package/dist/utils/check-todo-status.js +0 -10
- package/dist/utils/checklistGenerator.js +0 -196
- package/dist/utils/delete-redirect-cookie-and-navigate.js +0 -12
- package/dist/utils/get-cookie-domain.js +0 -21
- package/dist/utils/redirect-url.js +0 -5
- package/dist/utils/set-redirect-cookie.js +0 -16
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
import { track } from "../../analytics/index.js";
|
|
4
|
-
import { Text } from "../Text/Text.styles.js";
|
|
5
|
-
import { useNavigate } from "react-router-dom";
|
|
6
|
-
import { ComponentWrapper } from "../ComponentWrapper/ComponentWrapper.styles.js";
|
|
7
|
-
import { TextButton } from "../TextLink/TextLink.styles.js";
|
|
8
|
-
import stdin_default$1 from "../Button/Button.styles.js";
|
|
9
|
-
const noop = () => {
|
|
10
|
-
};
|
|
11
|
-
const RegisterTaxIdComplete = ({ showBackButton, onClick = noop }) => {
|
|
12
|
-
let navigate = useNavigate();
|
|
13
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14
|
-
showBackButton && /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingVertical: true, children: /* @__PURE__ */ jsx(
|
|
15
|
-
TextButton,
|
|
16
|
-
{
|
|
17
|
-
"data-cy": "tax-id-complete-back-button",
|
|
18
|
-
onClick: () => {
|
|
19
|
-
track("tax_id_back_clicked", { surface: "tax_id_complete" });
|
|
20
|
-
navigate("/verify-identity");
|
|
21
|
-
},
|
|
22
|
-
children: "Back to verify identity"
|
|
23
|
-
}
|
|
24
|
-
) }),
|
|
25
|
-
/* @__PURE__ */ jsx(ComponentWrapper, { children: /* @__PURE__ */ jsxs(Text, { children: [
|
|
26
|
-
/* @__PURE__ */ jsx("h1", { children: "Your Tax Id has been submitted" }),
|
|
27
|
-
/* @__PURE__ */ jsx("p", { children: "You have successfully submitted your Tax ID information. You will be ready to invest once you have completed all required steps on your checklist. Please continue!" })
|
|
28
|
-
] }) }),
|
|
29
|
-
/* @__PURE__ */ jsx(ComponentWrapper, { noPaddingTop: true, children: /* @__PURE__ */ jsx(
|
|
30
|
-
stdin_default$1,
|
|
31
|
-
{
|
|
32
|
-
"data-cy": "tax-id-complete-continue-button",
|
|
33
|
-
onClick: () => {
|
|
34
|
-
track("tax_id_complete_continue_clicked");
|
|
35
|
-
onClick();
|
|
36
|
-
},
|
|
37
|
-
children: "Continue"
|
|
38
|
-
}
|
|
39
|
-
) })
|
|
40
|
-
] });
|
|
41
|
-
};
|
|
42
|
-
var stdin_default = RegisterTaxIdComplete;
|
|
43
|
-
export {
|
|
44
|
-
stdin_default as default
|
|
45
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect, useRef } from "react";
|
|
3
|
-
import { track } from "../../analytics/index.js";
|
|
4
|
-
import { Modal } from "../Modal/Modal.js";
|
|
5
|
-
import stdin_default$3 from "./register-taxid.js";
|
|
6
|
-
import stdin_default$1 from "../ComponentScroll/ComponentScroll.js";
|
|
7
|
-
import stdin_default$2 from "./complete.js";
|
|
8
|
-
import { ModalInner } from "../Modal/Modal.styles.js";
|
|
9
|
-
const RegisterTaxIdFlow = ({
|
|
10
|
-
showFlow,
|
|
11
|
-
setShowFlow,
|
|
12
|
-
showBackButton,
|
|
13
|
-
showSkipButton,
|
|
14
|
-
redirectUrl,
|
|
15
|
-
onComplete,
|
|
16
|
-
...props
|
|
17
|
-
}) => {
|
|
18
|
-
const [showComplete, setShowComplete] = useState(false);
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (showComplete && onComplete) {
|
|
21
|
-
onComplete();
|
|
22
|
-
}
|
|
23
|
-
}, [showComplete]);
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (showFlow) {
|
|
26
|
-
track("tax_id_modal_opened");
|
|
27
|
-
}
|
|
28
|
-
}, [showFlow]);
|
|
29
|
-
const handleClose = () => {
|
|
30
|
-
track("tax_id_modal_closed", { flow_step: showComplete ? "complete" : "form" });
|
|
31
|
-
setShowFlow(false);
|
|
32
|
-
};
|
|
33
|
-
const scrollRef = useRef();
|
|
34
|
-
const handleScroll = (values, ref) => {
|
|
35
|
-
if (ref) {
|
|
36
|
-
scrollRef.current = ref;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
return /* @__PURE__ */ jsx(Modal, { fullscreen: true, isOpen: showFlow, onClose: handleClose, children: /* @__PURE__ */ jsx(ModalInner, { noPaddingHorizontal: true, children: /* @__PURE__ */ jsx(stdin_default$1, { handleScroll, fullHeight: true, children: showComplete ? /* @__PURE__ */ jsx(
|
|
40
|
-
stdin_default$2,
|
|
41
|
-
{
|
|
42
|
-
showBackButton,
|
|
43
|
-
onClick: () => {
|
|
44
|
-
setShowComplete(false);
|
|
45
|
-
setShowFlow(false);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
49
|
-
stdin_default$3,
|
|
50
|
-
{
|
|
51
|
-
setShowComplete,
|
|
52
|
-
showBackButton,
|
|
53
|
-
showSkipButton,
|
|
54
|
-
scrollRef,
|
|
55
|
-
redirectUrl,
|
|
56
|
-
...props
|
|
57
|
-
}
|
|
58
|
-
) }) }) }) });
|
|
59
|
-
};
|
|
60
|
-
var stdin_default = RegisterTaxIdFlow;
|
|
61
|
-
export {
|
|
62
|
-
stdin_default as default
|
|
63
|
-
};
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { useNavigate } from "react-router-dom";
|
|
4
|
-
import { track } from "../../analytics/index.js";
|
|
5
|
-
import { Text } from "../Text/Text.styles.js";
|
|
6
|
-
import * as Yup from "yup";
|
|
7
|
-
import { Formik } from "formik";
|
|
8
|
-
import { Input } from "../Input/Input.js";
|
|
9
|
-
import stdin_default$1 from "../Form/Form.js";
|
|
10
|
-
import stdin_default$5 from "../ToDoList/ToDoListTask.js";
|
|
11
|
-
import { ToDoTaskState } from "../ToDoList/ToDoList.js";
|
|
12
|
-
import { iconsMap } from "../Icon/Icon.style.js";
|
|
13
|
-
import { ComponentWrapper } from "../ComponentWrapper/ComponentWrapper.styles.js";
|
|
14
|
-
import { TextButton } from "../TextLink/TextLink.styles.js";
|
|
15
|
-
import stdin_default$2 from "../Button/Button.styles.js";
|
|
16
|
-
import stdin_default$3 from "../CryptoAddressWrapper/CryptoAddressWrapper.js";
|
|
17
|
-
import stdin_default$4 from "../RefreshButton/RefreshButton.js";
|
|
18
|
-
import { SectionTitle } from "../SectionTitle/SectionTitle.styles.js";
|
|
19
|
-
import stdin_default$6 from "../FAQ/FAQ.js";
|
|
20
|
-
import deleteRedirectCookieAndNavigate from "../../utils/delete-redirect-cookie-and-navigate.js";
|
|
21
|
-
import { FormField, FormError } from "../Form/Form.styles.js";
|
|
22
|
-
const noop = () => {
|
|
23
|
-
};
|
|
24
|
-
const defaultAdditionalTextHeader = /* @__PURE__ */ jsx(Fragment, {});
|
|
25
|
-
const defaultTextHeader = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26
|
-
/* @__PURE__ */ jsx("h1", { children: "Provide your tax id" }),
|
|
27
|
-
/* @__PURE__ */ jsx("p", { children: "Some offers require you to provide your Tax ID before being able to invest in." })
|
|
28
|
-
] });
|
|
29
|
-
const defaultShowComplete = noop;
|
|
30
|
-
const defaultFaqItems = [
|
|
31
|
-
{
|
|
32
|
-
title: "Why do I need to provide my Tax ID?",
|
|
33
|
-
content: `We ask for the Tax ID when an offering may fall under speciific reporting requirements. For example the Common Reporting Standard requires investors to provide more information on their tax status.`
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
title: "How will my information be used?",
|
|
37
|
-
content: `Your tax information will be disclosed to the Luxembourg tax authorities annually for tax compliance purposes required by the Common Reporting Standard implementation.`
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
title: "What if I'd like to do this later?",
|
|
41
|
-
content: "You can always skip this step and complete it at a later point in time. However, you will not be able to invest before doing so and being verified."
|
|
42
|
-
}
|
|
43
|
-
];
|
|
44
|
-
const RegisterTaxId = ({
|
|
45
|
-
setShowComplete = defaultShowComplete,
|
|
46
|
-
showBackButton,
|
|
47
|
-
showSkipButton,
|
|
48
|
-
scrollRef,
|
|
49
|
-
redirectUrl,
|
|
50
|
-
onContinueClick,
|
|
51
|
-
additionalTextHeader = defaultAdditionalTextHeader,
|
|
52
|
-
backButtonText = "Back to verify identity",
|
|
53
|
-
textHeader = defaultTextHeader,
|
|
54
|
-
textFieldLabel = "enter your tax id",
|
|
55
|
-
faqItems = defaultFaqItems,
|
|
56
|
-
/** @deprecated Consumer no longer provides a local AuthContext — pass the authenticated user object explicitly. */
|
|
57
|
-
user = {},
|
|
58
|
-
/** @deprecated Consumer no longer provides a local AuthContext — pass the update-user function explicitly. */
|
|
59
|
-
updateUser
|
|
60
|
-
}) => {
|
|
61
|
-
let navigate = useNavigate();
|
|
62
|
-
const { taxId } = user;
|
|
63
|
-
const [isUpdatingUser, setIsUpdatingUser] = useState(false);
|
|
64
|
-
const [error, setError] = useState("");
|
|
65
|
-
const initialValues = {
|
|
66
|
-
taxId: ""
|
|
67
|
-
};
|
|
68
|
-
const validationSchema = Yup.object().shape({
|
|
69
|
-
taxId: Yup.string().required("Oops, this can‘t be blank")
|
|
70
|
-
});
|
|
71
|
-
const handleOnSubmit = async (e) => {
|
|
72
|
-
setIsUpdatingUser(true);
|
|
73
|
-
try {
|
|
74
|
-
await updateUser?.({
|
|
75
|
-
taxId: e.taxId
|
|
76
|
-
});
|
|
77
|
-
track("tax_id_form_submitted_success");
|
|
78
|
-
setShowComplete(true);
|
|
79
|
-
} catch (_error) {
|
|
80
|
-
track("tax_id_form_submit_failed");
|
|
81
|
-
setError("Something went wrong. Try again.");
|
|
82
|
-
setIsUpdatingUser(false);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
const onRefreshClick = () => {
|
|
86
|
-
setError(false);
|
|
87
|
-
};
|
|
88
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
89
|
-
showBackButton ? /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingVertical: true, children: /* @__PURE__ */ jsx(
|
|
90
|
-
TextButton,
|
|
91
|
-
{
|
|
92
|
-
"data-cy": "tax-id-back-button",
|
|
93
|
-
onClick: () => {
|
|
94
|
-
track("tax_id_back_clicked", { surface: "tax_id_form" });
|
|
95
|
-
navigate("/verify-identity");
|
|
96
|
-
},
|
|
97
|
-
children: backButtonText
|
|
98
|
-
}
|
|
99
|
-
) }) : /* @__PURE__ */ jsx("div", { style: { height: 14 } }),
|
|
100
|
-
/* @__PURE__ */ jsx(ComponentWrapper, { children: /* @__PURE__ */ jsxs(Text, { children: [
|
|
101
|
-
textHeader && textHeader,
|
|
102
|
-
additionalTextHeader && additionalTextHeader
|
|
103
|
-
] }) }),
|
|
104
|
-
taxId && /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingTop: true, children: /* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsx("p", { children: "You have successfully submitted your Tax ID information." }) }) }),
|
|
105
|
-
!isUpdatingUser && !error && !taxId && /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingVertical: true, children: /* @__PURE__ */ jsx(Formik, { initialValues, validationSchema, onSubmit: handleOnSubmit, children: ({ values, errors, touched, handleChange, handleBlur }) => {
|
|
106
|
-
const submitDisabled = !values.taxId;
|
|
107
|
-
return /* @__PURE__ */ jsxs(stdin_default$1, { children: [
|
|
108
|
-
/* @__PURE__ */ jsx(ComponentWrapper, { noPadding: true, children: /* @__PURE__ */ jsxs(FormField, { children: [
|
|
109
|
-
/* @__PURE__ */ jsx(
|
|
110
|
-
Input,
|
|
111
|
-
{
|
|
112
|
-
id: "tax-id",
|
|
113
|
-
name: "taxId",
|
|
114
|
-
type: "input",
|
|
115
|
-
label: textFieldLabel,
|
|
116
|
-
value: values.taxId,
|
|
117
|
-
onChange: handleChange,
|
|
118
|
-
onBlur: handleBlur,
|
|
119
|
-
error: !!errors.taxId,
|
|
120
|
-
touched: !!touched.taxId,
|
|
121
|
-
"data-cy": "tax-id-input"
|
|
122
|
-
}
|
|
123
|
-
),
|
|
124
|
-
/* @__PURE__ */ jsx(FormError, { show: errors.taxId && touched.taxId, children: errors.taxId })
|
|
125
|
-
] }) }),
|
|
126
|
-
/* @__PURE__ */ jsx("br", {}),
|
|
127
|
-
!taxId && /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingBottom: true, noPaddingHorizontal: true, children: /* @__PURE__ */ jsx(
|
|
128
|
-
stdin_default$2,
|
|
129
|
-
{
|
|
130
|
-
minWidth: "230px",
|
|
131
|
-
type: "submit",
|
|
132
|
-
id: "tax-id-submit-btn",
|
|
133
|
-
"data-cy": "tax-id-submit-btn",
|
|
134
|
-
disabled: submitDisabled || isUpdatingUser || taxId,
|
|
135
|
-
children: "Submit"
|
|
136
|
-
}
|
|
137
|
-
) })
|
|
138
|
-
] });
|
|
139
|
-
} }) }),
|
|
140
|
-
(isUpdatingUser || error) && /* @__PURE__ */ jsx(ComponentWrapper, { borderTop: true, borderBottom: true, center: true, children: /* @__PURE__ */ jsx(
|
|
141
|
-
stdin_default$3,
|
|
142
|
-
{
|
|
143
|
-
noFailedIcon: true,
|
|
144
|
-
relative: true,
|
|
145
|
-
refresh: isUpdatingUser && "Please wait while we submit your Tax ID.",
|
|
146
|
-
failed: error
|
|
147
|
-
}
|
|
148
|
-
) }),
|
|
149
|
-
error && /* @__PURE__ */ jsx(ComponentWrapper, { center: true, noPaddingBottom: true, children: /* @__PURE__ */ jsx(stdin_default$4, { "data-cy": "tax-id-try-again", onClick: onRefreshClick, children: "TRY AGAIN" }) }),
|
|
150
|
-
taxId && /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingVertical: true, children: /* @__PURE__ */ jsx(
|
|
151
|
-
stdin_default$5,
|
|
152
|
-
{
|
|
153
|
-
title: "Tax ID",
|
|
154
|
-
message: "You tax ID is submitted",
|
|
155
|
-
state: ToDoTaskState.APPROVED,
|
|
156
|
-
icon: iconsMap.check
|
|
157
|
-
}
|
|
158
|
-
) }),
|
|
159
|
-
showSkipButton && /* @__PURE__ */ jsx(ComponentWrapper, { children: /* @__PURE__ */ jsx(
|
|
160
|
-
TextButton,
|
|
161
|
-
{
|
|
162
|
-
"data-cy": taxId ? "tax-id-flow-continue" : "tax-id-skip-later",
|
|
163
|
-
onClick: () => {
|
|
164
|
-
if (taxId) {
|
|
165
|
-
track("tax_id_continue_clicked", { variant: "after_saved" });
|
|
166
|
-
} else {
|
|
167
|
-
track("tax_id_skip_clicked");
|
|
168
|
-
}
|
|
169
|
-
if (redirectUrl) {
|
|
170
|
-
if (onContinueClick) {
|
|
171
|
-
onContinueClick();
|
|
172
|
-
} else {
|
|
173
|
-
deleteRedirectCookieAndNavigate();
|
|
174
|
-
}
|
|
175
|
-
} else {
|
|
176
|
-
navigate("/register-liquid-securities");
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
children: taxId ? "Continue" : "I'll do this later"
|
|
180
|
-
}
|
|
181
|
-
) }),
|
|
182
|
-
/* @__PURE__ */ jsx(ComponentWrapper, { noPaddingBottom: true, children: /* @__PURE__ */ jsx(SectionTitle, { children: "Frequently Asked Questions" }) }),
|
|
183
|
-
/* @__PURE__ */ jsx(ComponentWrapper, { children: /* @__PURE__ */ jsx(stdin_default$6, { scrollRef, items: faqItems, dataCyPrefix: "tax-id-faq" }) })
|
|
184
|
-
] });
|
|
185
|
-
};
|
|
186
|
-
var stdin_default = RegisterTaxId;
|
|
187
|
-
export {
|
|
188
|
-
stdin_default as default
|
|
189
|
-
};
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useState, useCallback, useMemo, useContext } from "react";
|
|
3
|
-
import fetchDataPublic from "../../api/fetchDataPublic.js";
|
|
4
|
-
import fetchData from "../../api/fetchData.js";
|
|
5
|
-
const CheckboxContext = createContext();
|
|
6
|
-
const CheckboxProvider = ({ children }) => {
|
|
7
|
-
const [checkboxes, setCheckboxes] = useState({});
|
|
8
|
-
const [loadingStates, setLoadingStates] = useState({});
|
|
9
|
-
const [errorStates, setErrorStates] = useState({});
|
|
10
|
-
const fetchCheckboxes = useCallback(
|
|
11
|
-
async (key, options = {}) => {
|
|
12
|
-
const { group, labels } = options;
|
|
13
|
-
if (loadingStates[key] || checkboxes[key] !== void 0 || errorStates[key]) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
setLoadingStates((prev) => ({ ...prev, [key]: true }));
|
|
17
|
-
setErrorStates((prev) => {
|
|
18
|
-
const newState = { ...prev };
|
|
19
|
-
delete newState[key];
|
|
20
|
-
return newState;
|
|
21
|
-
});
|
|
22
|
-
try {
|
|
23
|
-
let response;
|
|
24
|
-
if (group) {
|
|
25
|
-
response = await fetchDataPublic("compliance/get-checkbox-group", {
|
|
26
|
-
group
|
|
27
|
-
});
|
|
28
|
-
} else if (labels) {
|
|
29
|
-
response = await fetchDataPublic("compliance/get-checkboxes", {
|
|
30
|
-
labels
|
|
31
|
-
});
|
|
32
|
-
} else {
|
|
33
|
-
throw new Error("Must provide either group or labels");
|
|
34
|
-
}
|
|
35
|
-
setCheckboxes((prev) => ({ ...prev, [key]: response }));
|
|
36
|
-
} catch (error) {
|
|
37
|
-
console.error(`Failed to fetch checkboxes for key: ${key}`, error);
|
|
38
|
-
setErrorStates((prev) => ({ ...prev, [key]: error }));
|
|
39
|
-
setCheckboxes((prev) => ({ ...prev, [key]: null }));
|
|
40
|
-
} finally {
|
|
41
|
-
setLoadingStates((prev) => ({ ...prev, [key]: false }));
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
[checkboxes, loadingStates, errorStates]
|
|
45
|
-
);
|
|
46
|
-
const getCheckboxes = useCallback(
|
|
47
|
-
(key, options = {}) => {
|
|
48
|
-
if (checkboxes[key] === void 0 && !loadingStates[key] && !errorStates[key]) {
|
|
49
|
-
fetchCheckboxes(key, options);
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
checkboxes: checkboxes[key] || null,
|
|
53
|
-
isLoading: loadingStates[key] || false,
|
|
54
|
-
error: errorStates[key] || null,
|
|
55
|
-
refetch: () => {
|
|
56
|
-
setErrorStates((prev) => {
|
|
57
|
-
const newState = { ...prev };
|
|
58
|
-
delete newState[key];
|
|
59
|
-
return newState;
|
|
60
|
-
});
|
|
61
|
-
setCheckboxes((prev) => {
|
|
62
|
-
const newState = { ...prev };
|
|
63
|
-
delete newState[key];
|
|
64
|
-
return newState;
|
|
65
|
-
});
|
|
66
|
-
fetchCheckboxes(key, options);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
},
|
|
70
|
-
[checkboxes, loadingStates, errorStates, fetchCheckboxes]
|
|
71
|
-
);
|
|
72
|
-
const checkCheckbox = useCallback(async (checkboxId, data = {}) => {
|
|
73
|
-
const { userId, investmentId, privateInvestorId } = data;
|
|
74
|
-
if (!userId) {
|
|
75
|
-
throw new Error("userId is required to check checkbox");
|
|
76
|
-
}
|
|
77
|
-
if (!checkboxId) {
|
|
78
|
-
throw new Error("checkboxId is required");
|
|
79
|
-
}
|
|
80
|
-
try {
|
|
81
|
-
const response = await fetchData("compliance/check-checkbox", {
|
|
82
|
-
userId,
|
|
83
|
-
checkboxId,
|
|
84
|
-
...investmentId != null ? { investmentId } : {},
|
|
85
|
-
...privateInvestorId != null ? { privateInvestorId } : {}
|
|
86
|
-
});
|
|
87
|
-
return response;
|
|
88
|
-
} catch (error) {
|
|
89
|
-
console.error(`Failed to check checkbox: ${checkboxId}`, error);
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
}, []);
|
|
93
|
-
const clearCheckboxes = useCallback((key) => {
|
|
94
|
-
if (key) {
|
|
95
|
-
setCheckboxes((prev) => {
|
|
96
|
-
const newState = { ...prev };
|
|
97
|
-
delete newState[key];
|
|
98
|
-
return newState;
|
|
99
|
-
});
|
|
100
|
-
setLoadingStates((prev) => {
|
|
101
|
-
const newState = { ...prev };
|
|
102
|
-
delete newState[key];
|
|
103
|
-
return newState;
|
|
104
|
-
});
|
|
105
|
-
setErrorStates((prev) => {
|
|
106
|
-
const newState = { ...prev };
|
|
107
|
-
delete newState[key];
|
|
108
|
-
return newState;
|
|
109
|
-
});
|
|
110
|
-
} else {
|
|
111
|
-
setCheckboxes({});
|
|
112
|
-
setLoadingStates({});
|
|
113
|
-
setErrorStates({});
|
|
114
|
-
}
|
|
115
|
-
}, []);
|
|
116
|
-
const value = useMemo(
|
|
117
|
-
() => ({
|
|
118
|
-
getCheckboxes,
|
|
119
|
-
checkCheckbox,
|
|
120
|
-
clearCheckboxes
|
|
121
|
-
}),
|
|
122
|
-
[getCheckboxes, checkCheckbox, clearCheckboxes]
|
|
123
|
-
);
|
|
124
|
-
return /* @__PURE__ */ jsx(CheckboxContext.Provider, { value, children });
|
|
125
|
-
};
|
|
126
|
-
const useCheckboxes = (key, options = {}) => {
|
|
127
|
-
const context = useContext(CheckboxContext);
|
|
128
|
-
if (!context) {
|
|
129
|
-
throw new Error("useCheckboxes must be used within CheckboxProvider");
|
|
130
|
-
}
|
|
131
|
-
if (!key) {
|
|
132
|
-
throw new Error("useCheckboxes requires a key parameter");
|
|
133
|
-
}
|
|
134
|
-
return context.getCheckboxes(key, options);
|
|
135
|
-
};
|
|
136
|
-
const useCheckboxActions = () => {
|
|
137
|
-
const context = useContext(CheckboxContext);
|
|
138
|
-
if (!context) {
|
|
139
|
-
throw new Error("useCheckboxActions must be used within CheckboxProvider");
|
|
140
|
-
}
|
|
141
|
-
return {
|
|
142
|
-
checkCheckbox: context.checkCheckbox,
|
|
143
|
-
clearCheckboxes: context.clearCheckboxes
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
export {
|
|
147
|
-
CheckboxContext,
|
|
148
|
-
CheckboxProvider,
|
|
149
|
-
useCheckboxActions,
|
|
150
|
-
useCheckboxes
|
|
151
|
-
};
|
package/dist/model/axios.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { getConfig } from "../runtime-config.js";
|
|
3
|
-
if (!getConfig("apiUrl") && false) ;
|
|
4
|
-
const axiosInstance = axios?.create({
|
|
5
|
-
headers: { "Content-Type": "application/json" },
|
|
6
|
-
baseURL: getConfig("apiUrl") || void 0
|
|
7
|
-
});
|
|
8
|
-
export {
|
|
9
|
-
axiosInstance as default
|
|
10
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import { useInRouterContext, BrowserRouter } from "react-router-dom";
|
|
5
|
-
function RouterWrapper({ children }) {
|
|
6
|
-
const inRouter = useInRouterContext();
|
|
7
|
-
if (inRouter) {
|
|
8
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
9
|
-
}
|
|
10
|
-
return /* @__PURE__ */ jsx(BrowserRouter, { future: { v7_relativeSplatPath: false, v7_startTransition: false }, children });
|
|
11
|
-
}
|
|
12
|
-
RouterWrapper.propTypes = {
|
|
13
|
-
children: PropTypes.node
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
RouterWrapper
|
|
17
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
function pathnameIfSameOrigin(absoluteHref) {
|
|
2
|
-
if (typeof window === "undefined" || !absoluteHref) return null;
|
|
3
|
-
try {
|
|
4
|
-
const u = new URL(absoluteHref, window.location.href);
|
|
5
|
-
if (u.origin === window.location.origin) {
|
|
6
|
-
return `${u.pathname}${u.search}${u.hash}`;
|
|
7
|
-
}
|
|
8
|
-
} catch {
|
|
9
|
-
}
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
function navigateToHref(navigate, href) {
|
|
13
|
-
if (!href) return;
|
|
14
|
-
const internal = pathnameIfSameOrigin(href);
|
|
15
|
-
if (internal != null && typeof navigate === "function") {
|
|
16
|
-
navigate(internal);
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
window.location.assign(href);
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
navigateToHref,
|
|
23
|
-
pathnameIfSameOrigin
|
|
24
|
-
};
|
package/dist/runtime-config.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const __vite_import_meta_env__ = { "BASE_URL": "/", "DEV": false, "MODE": "production", "PROD": true, "SSR": false };
|
|
2
|
-
const _overrides = {};
|
|
3
|
-
const ENV_KEY_BY_CONFIG = {
|
|
4
|
-
apiUrl: "VITE_API_URL",
|
|
5
|
-
baseUrlPublic: "VITE_BASE_URL_PUBLIC",
|
|
6
|
-
cookieDomain: "VITE_COOKIE_DOMAIN",
|
|
7
|
-
websiteDomain: "VITE_WEBSITE_DOMAIN",
|
|
8
|
-
onboardingUrl: "VITE_ONBOARDING_URL",
|
|
9
|
-
dashboardUrl: "VITE_DASHBOARD_URL",
|
|
10
|
-
adminUrl: "VITE_ADMIN_URL",
|
|
11
|
-
registerUrl: "VITE_REGISTER_URL"
|
|
12
|
-
};
|
|
13
|
-
function env(name) {
|
|
14
|
-
try {
|
|
15
|
-
return __vite_import_meta_env__?.[name];
|
|
16
|
-
} catch {
|
|
17
|
-
return void 0;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function getConfig(key) {
|
|
21
|
-
const envName = ENV_KEY_BY_CONFIG[key];
|
|
22
|
-
if (envName) {
|
|
23
|
-
return _overrides[key] ?? env(envName);
|
|
24
|
-
}
|
|
25
|
-
return _overrides[key];
|
|
26
|
-
}
|
|
27
|
-
function resetRuntimeConfig() {
|
|
28
|
-
for (const k of Object.keys(_overrides)) {
|
|
29
|
-
delete _overrides[k];
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export {
|
|
33
|
-
getConfig,
|
|
34
|
-
resetRuntimeConfig
|
|
35
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { getConfig } from "../runtime-config.js";
|
|
2
|
-
function trimmedWebsiteDomain() {
|
|
3
|
-
const d = getConfig("websiteDomain");
|
|
4
|
-
return d != null && String(d).trim() !== "" ? String(d).trim() : "";
|
|
5
|
-
}
|
|
6
|
-
function normalizeLeading(path) {
|
|
7
|
-
if (path == null || path === "") return "";
|
|
8
|
-
const p = String(path);
|
|
9
|
-
return p.startsWith("/") ? p : `/${p}`;
|
|
10
|
-
}
|
|
11
|
-
function stripTrailingSlash(s) {
|
|
12
|
-
return String(s).replace(/\/+$/, "");
|
|
13
|
-
}
|
|
14
|
-
function getAnalyticsIngestUrl() {
|
|
15
|
-
const domain = trimmedWebsiteDomain();
|
|
16
|
-
if (!domain) return "";
|
|
17
|
-
return `https://analytics.${domain}`;
|
|
18
|
-
}
|
|
19
|
-
function getBackofficeAppUrl(relativePath = "") {
|
|
20
|
-
const domain = trimmedWebsiteDomain();
|
|
21
|
-
if (!domain) return "";
|
|
22
|
-
const root = `https://backoffice.${domain}`;
|
|
23
|
-
const p = normalizeLeading(relativePath);
|
|
24
|
-
if (!p) return root;
|
|
25
|
-
return `${stripTrailingSlash(root)}${p}`;
|
|
26
|
-
}
|
|
27
|
-
export {
|
|
28
|
-
getAnalyticsIngestUrl,
|
|
29
|
-
getBackofficeAppUrl
|
|
30
|
-
};
|
package/dist/utils/app-urls.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { getConfig } from "../runtime-config.js";
|
|
2
|
-
function isAlreadyOnOnboardingFlow() {
|
|
3
|
-
if (typeof window === "undefined") return false;
|
|
4
|
-
const onboardingUrl = getConfig("onboardingUrl");
|
|
5
|
-
if (onboardingUrl) return window.location.href.startsWith(onboardingUrl);
|
|
6
|
-
return window.location.hostname.startsWith("signup.");
|
|
7
|
-
}
|
|
8
|
-
export {
|
|
9
|
-
isAlreadyOnOnboardingFlow
|
|
10
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { generateCoreChecklistTasks } from "./checklistGenerator.js";
|
|
2
|
-
const checkTodoStatus = (user) => {
|
|
3
|
-
if (user?.user_type === "investor" || user?.user_type === "investor-entity") {
|
|
4
|
-
const coreTasks = generateCoreChecklistTasks(user);
|
|
5
|
-
return coreTasks.remainingCount;
|
|
6
|
-
} else return 0;
|
|
7
|
-
};
|
|
8
|
-
export {
|
|
9
|
-
checkTodoStatus
|
|
10
|
-
};
|