@stokr/components-library 3.1.1 → 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.
Files changed (35) hide show
  1. package/dist/analytics/index.js +1 -3
  2. package/dist/components/Checklist/ChecklistCard.js +1 -2
  3. package/dist/components/Checklist/ChecklistCard.styles.js +39 -0
  4. package/dist/components/CryptoAddressWrapper/CryptoAddressWrapper.js +1 -3
  5. package/dist/components/FAQ/FAQ.js +1 -3
  6. package/dist/components/Form/Form.js +1 -3
  7. package/dist/components/RefreshButton/RefreshButton.js +3 -5
  8. package/dist/components/SectionTitle/SectionTitle.styles.js +1 -2
  9. package/dist/index.js +34 -71
  10. package/package.json +1 -3
  11. package/dist/api/fetchData.js +0 -27
  12. package/dist/api/fetchDataPublic.js +0 -19
  13. package/dist/components/Newsletter/Newsletter.js +0 -120
  14. package/dist/components/Newsletter/Newsletter.styles.js +0 -186
  15. package/dist/components/ToDoList/ToDoList.js +0 -167
  16. package/dist/components/ToDoList/ToDoList.styles.js +0 -122
  17. package/dist/components/ToDoList/ToDoListTask.js +0 -89
  18. package/dist/components/ToDoList/ToDoListTask.styles.js +0 -119
  19. package/dist/components/taxId/complete.js +0 -45
  20. package/dist/components/taxId/flow.js +0 -63
  21. package/dist/components/taxId/register-taxid.js +0 -189
  22. package/dist/context/Checkbox/CheckboxContext.js +0 -151
  23. package/dist/model/axios.js +0 -10
  24. package/dist/model/axiosPublic.js +0 -9
  25. package/dist/routing/RouterWrapper.js +0 -17
  26. package/dist/routing/navigate-app.js +0 -24
  27. package/dist/runtime-config.js +0 -35
  28. package/dist/utils/app-urls-analytics-backoffice.js +0 -30
  29. package/dist/utils/app-urls.js +0 -10
  30. package/dist/utils/check-todo-status.js +0 -10
  31. package/dist/utils/checklistGenerator.js +0 -196
  32. package/dist/utils/delete-redirect-cookie-and-navigate.js +0 -12
  33. package/dist/utils/get-cookie-domain.js +0 -21
  34. package/dist/utils/redirect-url.js +0 -5
  35. package/dist/utils/set-redirect-cookie.js +0 -16
@@ -1,196 +0,0 @@
1
- import { walletTypes, UserTypes } from "../constants/globalVariables.js";
2
- import { getConfig } from "../runtime-config.js";
3
- const TASK_COPY = {
4
- country: {
5
- title: {
6
- entity: "Country of Entity Registration",
7
- individual: "Country of Residence"
8
- },
9
- description: {
10
- missing: {
11
- entity: "Please select your jurisdiction of incorporation.",
12
- individual: "Please select your country of residence."
13
- },
14
- not_available: "STOKR is not yet available in your country of residence.",
15
- done: {
16
- entity: "Your jurisdiction of incorporation has been registered.",
17
- individual: "Your country of residence has been registered."
18
- }
19
- },
20
- iconCopy: {
21
- missing: "Missing step",
22
- not_available: "Not available",
23
- done: "Registered"
24
- }
25
- },
26
- identity: {
27
- title: {
28
- entity: "Verify Entity",
29
- individual: "Verify Identity"
30
- },
31
- description: {
32
- not_available: "Sorry, you are living in a country where this is not available.",
33
- missing: {
34
- entity: "Submit your entity documents for verification.",
35
- individual: "Submit identity verification for compliance clearance."
36
- },
37
- in_progress: "Identity verification is in progress.",
38
- done: {
39
- entity: "Entity verification complete.",
40
- individual: "Identity verification complete."
41
- },
42
- reapply: {
43
- entity: "Please re-verify your entity documentation.",
44
- individual: "Please re-verify your identity."
45
- }
46
- },
47
- iconCopy: {
48
- not_available: "Not available",
49
- missing: "Missing step",
50
- in_progress: "Under review",
51
- done: "Verified"
52
- }
53
- },
54
- wallet: {
55
- title: "Liquid Address",
56
- description: {
57
- missing: "Register a Liquid address where you will receive the securities.",
58
- not_available: "Sorry, you are living in a country where this is not available.",
59
- done: "Your address is registered."
60
- },
61
- iconCopy: {
62
- missing: "Missing step",
63
- not_available: "Not available",
64
- done: "Registered"
65
- }
66
- },
67
- selfCertification: {
68
- title: "Self Certification",
69
- description: {
70
- missing: "Certain investment products require tax identification before participation.",
71
- done: "Self-certification confirmed. You may now access products requiring tax compliance verification."
72
- },
73
- iconCopy: {
74
- missing: "Missing step",
75
- done: "Submitted"
76
- }
77
- }
78
- };
79
- const getVerifyIdentityChecklist = (isFromAllowedCountry, user, isEntity) => {
80
- const { kyc_status } = user;
81
- let state;
82
- let hasLink = false;
83
- let message;
84
- if (!isFromAllowedCountry) {
85
- state = "not_available";
86
- message = TASK_COPY.identity.description.not_available;
87
- } else if (!kyc_status || kyc_status.toUpperCase() === "DRAFT") {
88
- state = "missing";
89
- hasLink = true;
90
- message = isEntity ? TASK_COPY.identity.description.missing.entity : TASK_COPY.identity.description.missing.individual;
91
- } else if (kyc_status.toUpperCase() === "REJECTED" || kyc_status.toUpperCase() === "ESCALATED" || kyc_status.toUpperCase() === "IN PROGRESS" || kyc_status.toUpperCase() === "INCONCLUSIVE" || kyc_status.toUpperCase() === "APPROVED" || kyc_status.toUpperCase() === "DENIED") {
92
- state = "in_progress";
93
- message = TASK_COPY.identity.description.in_progress;
94
- } else if (kyc_status.toUpperCase() === "ACCEPTED") {
95
- state = "done";
96
- message = isEntity ? TASK_COPY.identity.description.done.entity : TASK_COPY.identity.description.done.individual;
97
- } else if (kyc_status.toUpperCase() === "REAPPLY" || kyc_status.toUpperCase() === "CANCELLED") {
98
- state = "missing";
99
- hasLink = true;
100
- message = isEntity ? TASK_COPY.identity.description.reapply.entity : TASK_COPY.identity.description.reapply.individual;
101
- }
102
- return { state, hasLink, message };
103
- };
104
- function getCountryDescription(user, isFromAllowedCountry) {
105
- const { country, user_type } = user;
106
- const isEntity = user_type === UserTypes.investor_entity;
107
- if (!country) {
108
- return isEntity ? TASK_COPY.country.description.missing.entity : TASK_COPY.country.description.missing.individual;
109
- }
110
- if (!isFromAllowedCountry) {
111
- return TASK_COPY.country.description.not_available;
112
- }
113
- return isEntity ? TASK_COPY.country.description.done.entity : TASK_COPY.country.description.done.individual;
114
- }
115
- function generateCoreChecklistTasks(user) {
116
- if (!user) {
117
- return {
118
- country: null,
119
- identity: null,
120
- wallet: null,
121
- selfCertification: null,
122
- taxId: null,
123
- isFromAllowedCountry: false,
124
- allTasks: [],
125
- remainingCount: 0
126
- };
127
- }
128
- const { country, user_type, wallets = [], self_declaration, countryObj, taxId } = user;
129
- const isFromAllowedCountry = Boolean(countryObj?.isAllowed) || Boolean(user.allowedByBoardResolution);
130
- const liquidWallets = wallets.filter((wallet2) => wallet2.type === walletTypes.LIQUID) || [];
131
- const hasWallet = liquidWallets.length > 0;
132
- const isEntity = user_type === UserTypes.investor_entity;
133
- const signupBase = getConfig("onboardingUrl") || "";
134
- const countryStatus = !country ? "missing" : !isFromAllowedCountry ? "not_available" : "done";
135
- const countryTask = {
136
- key: "country",
137
- title: isEntity ? TASK_COPY.country.title.entity : TASK_COPY.country.title.individual,
138
- description: getCountryDescription(user, isFromAllowedCountry),
139
- iconState: countryStatus,
140
- iconCopy: TASK_COPY.country.iconCopy[countryStatus],
141
- link: signupBase ? `${signupBase}/country-of-residence` : "",
142
- isClickable: countryStatus !== "done"
143
- };
144
- const verifyIdentityChecklist = getVerifyIdentityChecklist(isFromAllowedCountry, user, isEntity);
145
- const identity = {
146
- key: "kyc",
147
- title: isEntity ? TASK_COPY.identity.title.entity : TASK_COPY.identity.title.individual,
148
- description: verifyIdentityChecklist.message,
149
- iconState: verifyIdentityChecklist.state,
150
- iconCopy: TASK_COPY.identity.iconCopy[verifyIdentityChecklist.state],
151
- link: signupBase ? `${signupBase}/verify-identity` : "",
152
- isClickable: verifyIdentityChecklist.hasLink
153
- };
154
- const walletStatus = hasWallet ? "done" : "missing";
155
- const walletDescription = !isFromAllowedCountry ? TASK_COPY.wallet.description.not_available : hasWallet ? TASK_COPY.wallet.description.done : TASK_COPY.wallet.description.missing;
156
- const wallet = {
157
- key: "wallet",
158
- title: TASK_COPY.wallet.title,
159
- description: walletDescription,
160
- iconState: walletStatus,
161
- iconCopy: TASK_COPY.wallet.iconCopy[walletStatus],
162
- link: signupBase ? `${signupBase}/register-liquid-securities` : "",
163
- isClickable: isFromAllowedCountry && walletStatus !== "done"
164
- };
165
- const isSelfCertConfirmed = self_declaration?.confirmed === true;
166
- const selfCertStatus = isSelfCertConfirmed ? "done" : "missing";
167
- const selfCertification = {
168
- key: "selfCertification",
169
- title: TASK_COPY.selfCertification.title,
170
- description: TASK_COPY.selfCertification.description[selfCertStatus],
171
- iconState: selfCertStatus,
172
- iconCopy: TASK_COPY.selfCertification.iconCopy[selfCertStatus],
173
- link: selfCertStatus !== "done" && signupBase ? `${signupBase}/self-certification` : "",
174
- isClickable: selfCertStatus !== "done",
175
- meetsEligibility: isSelfCertConfirmed || !!taxId
176
- };
177
- const allTasks = [countryTask, identity, wallet, selfCertification].filter(Boolean);
178
- const remainingCount = allTasks.filter(
179
- (task) => task.iconState === "missing" || task.iconState === "not_available"
180
- ).length;
181
- return {
182
- country: countryTask,
183
- identity,
184
- wallet,
185
- selfCertification,
186
- /** @deprecated Use selfCertification — kept for consumers still reading taxId */
187
- taxId: selfCertification,
188
- isFromAllowedCountry,
189
- allTasks,
190
- remainingCount
191
- };
192
- }
193
- export {
194
- generateCoreChecklistTasks,
195
- getVerifyIdentityChecklist
196
- };
@@ -1,12 +0,0 @@
1
- import Cookies from "js-cookie";
2
- import getCookieDomain from "./get-cookie-domain.js";
3
- import redirectUrl from "./redirect-url.js";
4
- const deleteRedirectCookieAndNavigate = () => {
5
- const cookieDomain = getCookieDomain();
6
- Cookies.remove("STOKR_INVESTOR_DASHBOARD_REDIRECT", cookieDomain);
7
- Cookies.remove("STOKR_INVEST_IN_STO_REDIRECT", cookieDomain);
8
- window.location.href = redirectUrl;
9
- };
10
- export {
11
- deleteRedirectCookieAndNavigate as default
12
- };
@@ -1,21 +0,0 @@
1
- import { getConfig } from "../runtime-config.js";
2
- const getCookieDomain = () => {
3
- const domain = getConfig("cookieDomain");
4
- if (domain && domain !== "localhost") {
5
- return { domain };
6
- }
7
- if (typeof window !== "undefined") {
8
- const hostname = window.location.hostname;
9
- if (hostname && hostname !== "localhost" && hostname !== "127.0.0.1" && !/^\d+\.\d+\.\d+\.\d+$/.test(hostname)) {
10
- const parts = hostname.split(".");
11
- if (parts.length >= 2) {
12
- return { domain: "." + parts.slice(-2).join(".") };
13
- }
14
- }
15
- }
16
- return {};
17
- };
18
- export {
19
- getCookieDomain as default,
20
- getCookieDomain
21
- };
@@ -1,5 +0,0 @@
1
- import Cookies from "js-cookie";
2
- const redirectUrl = Cookies.get("STOKR_INVESTOR_DASHBOARD_REDIRECT") || Cookies.get("STOKR_INVEST_IN_STO_REDIRECT");
3
- export {
4
- redirectUrl as default
5
- };
@@ -1,16 +0,0 @@
1
- import Cookies from "js-cookie";
2
- import { getConfig } from "../runtime-config.js";
3
- const setRedirectCookie = (path = "") => {
4
- const inOneHour = 1 / 24;
5
- const cookieOptions = {
6
- expires: inOneHour
7
- };
8
- const domain = getConfig("cookieDomain");
9
- if (domain) {
10
- cookieOptions.domain = domain;
11
- }
12
- Cookies.set("STOKR_INVESTOR_DASHBOARD_REDIRECT", `${window.location.href}${path}`, cookieOptions);
13
- };
14
- export {
15
- setRedirectCookie as default
16
- };