@stokr/components-library 2.3.56 → 2.3.58-beta.2

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/index.js CHANGED
@@ -784,17 +784,6 @@ Object.keys(_RegisterConfirmModal).forEach(function (key) {
784
784
  }
785
785
  });
786
786
  });
787
- var _UserChecklist = require("./components/Checklist/UserChecklist");
788
- Object.keys(_UserChecklist).forEach(function (key) {
789
- if (key === "default" || key === "__esModule") return;
790
- if (key in exports && exports[key] === _UserChecklist[key]) return;
791
- Object.defineProperty(exports, key, {
792
- enumerable: true,
793
- get: function get() {
794
- return _UserChecklist[key];
795
- }
796
- });
797
- });
798
787
  var _taxId = require("./components/taxId");
799
788
  Object.keys(_taxId).forEach(function (key) {
800
789
  if (key === "default" || key === "__esModule") return;
@@ -1246,6 +1235,17 @@ Object.keys(_moment).forEach(function (key) {
1246
1235
  }
1247
1236
  });
1248
1237
  });
1238
+ var _checklistGenerator = require("./utils/checklistGenerator");
1239
+ Object.keys(_checklistGenerator).forEach(function (key) {
1240
+ if (key === "default" || key === "__esModule") return;
1241
+ if (key in exports && exports[key] === _checklistGenerator[key]) return;
1242
+ Object.defineProperty(exports, key, {
1243
+ enumerable: true,
1244
+ get: function get() {
1245
+ return _checklistGenerator[key];
1246
+ }
1247
+ });
1248
+ });
1249
1249
  var _FA = require("./components/2FA");
1250
1250
  Object.keys(_FA).forEach(function (key) {
1251
1251
  if (key === "default" || key === "__esModule") return;
@@ -1389,6 +1389,17 @@ Object.keys(_theme).forEach(function (key) {
1389
1389
  }
1390
1390
  });
1391
1391
  });
1392
+ var _rwd = require("./styles/rwd");
1393
+ Object.keys(_rwd).forEach(function (key) {
1394
+ if (key === "default" || key === "__esModule") return;
1395
+ if (key in exports && exports[key] === _rwd[key]) return;
1396
+ Object.defineProperty(exports, key, {
1397
+ enumerable: true,
1398
+ get: function get() {
1399
+ return _rwd[key];
1400
+ }
1401
+ });
1402
+ });
1392
1403
  var _logo = require("./components/logo");
1393
1404
  Object.keys(_logo).forEach(function (key) {
1394
1405
  if (key === "default" || key === "__esModule") return;
@@ -4,27 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.checkTodoStatus = void 0;
7
- var _globalVariables = require("../constants/globalVariables");
7
+ var _checklistGenerator = require("./checklistGenerator");
8
8
  var checkTodoStatus = function checkTodoStatus(user) {
9
- var _user$countryObj;
10
- var count = 0;
11
- if (!user) return count;
12
- var isFromAllowedCountry = user.country && ((_user$countryObj = user.countryObj) === null || _user$countryObj === void 0 ? void 0 : _user$countryObj.isAllowed);
13
-
14
- // Country
15
- if (isFromAllowedCountry && (user.user_type === 'investor' || user.user_type === 'investor-entity')) {
16
- var _user$wallets;
17
- //wallet (we only check for liquid wallet)
18
- !(user !== null && user !== void 0 && (_user$wallets = user.wallets) !== null && _user$wallets !== void 0 && _user$wallets.some(function (wallet) {
19
- return wallet.type === _globalVariables.walletTypes.LIQUID;
20
- })) && count++
21
-
22
- // KYC
23
- ;
24
- (!user.kyc_status || user.kyc_status.toUpperCase() === 'DRAFT' || user.kyc_status.toUpperCase() === 'REAPPLY' || user.kyc_status.toUpperCase() === 'CANCELLED') && count++;
25
- !user.taxId && count++;
26
- }
27
- return count;
9
+ var coreTasks = (0, _checklistGenerator.generateCoreChecklistTasks)(user);
10
+ return coreTasks.remainingCount;
28
11
  };
29
12
  exports.checkTodoStatus = checkTodoStatus;
30
13
  var _default = checkTodoStatus;
@@ -0,0 +1,239 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ exports.generateCoreChecklistTasks = generateCoreChecklistTasks;
8
+ exports.getVerifyIdentityChecklistState = void 0;
9
+ var _globalVariables = require("../constants/globalVariables");
10
+ var websiteUrl = process.env.REACT_APP_WEBSITE_DOMAIN;
11
+
12
+ // Unified copy for all checklist tasks - same everywhere
13
+ var TASK_COPY = {
14
+ country: {
15
+ title: {
16
+ entity: 'Country of Entity Registration',
17
+ individual: 'Country of Residence'
18
+ },
19
+ description: {
20
+ missing: {
21
+ entity: 'Please select your jurisdiction of incorporation.',
22
+ individual: 'Please select your country of residence.'
23
+ },
24
+ not_available: 'STOKR is not yet available in your country of residence.',
25
+ done: {
26
+ entity: 'Your jurisdiction of incorporation has been registered.',
27
+ individual: 'Your country of residence has been registered.'
28
+ }
29
+ },
30
+ iconCopy: {
31
+ missing: 'Missing step',
32
+ not_available: 'Not available',
33
+ done: 'Registered'
34
+ }
35
+ },
36
+ identity: {
37
+ title: {
38
+ entity: 'Verify Entity',
39
+ individual: 'Verify Identity'
40
+ },
41
+ description: {
42
+ not_available: 'Sorry, you are living in a country where this is not available.',
43
+ missing: {
44
+ entity: 'Submit your entity documents for verification.',
45
+ individual: 'Submit identity verification for compliance clearance.'
46
+ },
47
+ in_progress: 'Identity verification is in progress.',
48
+ done: {
49
+ entity: 'Entity verification complete.',
50
+ individual: 'Identity verification complete.'
51
+ },
52
+ reapply: {
53
+ entity: 'Please re-verify your entity documentation.',
54
+ individual: 'Please re-verify your identity.'
55
+ }
56
+ },
57
+ iconCopy: {
58
+ not_available: 'Not available',
59
+ missing: 'Missing step',
60
+ in_progress: 'Under review',
61
+ done: 'Verified',
62
+ reapply: 'Missing step'
63
+ }
64
+ },
65
+ wallet: {
66
+ title: 'Liquid Address',
67
+ description: {
68
+ missing: 'Register a Liquid address where you will receive the securities',
69
+ not_available: 'Sorry, you are living in a country where this is not available.',
70
+ done: 'Your address is registered'
71
+ },
72
+ iconCopy: {
73
+ missing: 'Missing step',
74
+ not_available: 'Not available',
75
+ done: 'Registered'
76
+ }
77
+ },
78
+ taxId: {
79
+ title: 'Tax ID',
80
+ description: {
81
+ missing: 'Certain investment products require tax identification before participation.',
82
+ done: 'Tax identification confirmed. You may now access products requiring tax compliance verification.'
83
+ },
84
+ iconCopy: {
85
+ missing: 'Missing step',
86
+ done: 'Submitted'
87
+ },
88
+ tooltip: "Some offers require you to provide your Tax ID before being able to invest.\nYour tax information will be disclosed to the Luxembourg tax authorities annually for tax compliance purposes required by the Common Reporting Standard implementation."
89
+ }
90
+ };
91
+
92
+ // Identity verification checklist function - simplified to just return state and hasLink
93
+ var getVerifyIdentityChecklistState = function getVerifyIdentityChecklistState(isFromAllowedCountry, user) {
94
+ var kyc_status = user.kyc_status;
95
+ var state;
96
+ var hasLink = false;
97
+ if (!isFromAllowedCountry) {
98
+ state = 'not_available';
99
+ } else if (!kyc_status || kyc_status.toUpperCase() === 'DRAFT') {
100
+ state = 'missing';
101
+ hasLink = true;
102
+ } 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') {
103
+ state = 'in_progress';
104
+ } else if (kyc_status.toUpperCase() === 'ACCEPTED') {
105
+ state = 'done';
106
+ } else if (kyc_status.toUpperCase() === 'REAPPLY' || kyc_status.toUpperCase() === 'CANCELLED') {
107
+ state = 'reapply';
108
+ hasLink = true;
109
+ }
110
+ return {
111
+ state: state,
112
+ hasLink: hasLink
113
+ };
114
+ };
115
+ exports.getVerifyIdentityChecklistState = getVerifyIdentityChecklistState;
116
+ var getIdentityDescription = function getIdentityDescription(state, isEntity) {
117
+ if (state === 'not_available') {
118
+ return TASK_COPY.identity.description.not_available;
119
+ }
120
+ if (state === 'in_progress') {
121
+ return TASK_COPY.identity.description.in_progress;
122
+ }
123
+ if (state === 'missing' || state === 'reapply') {
124
+ return isEntity ? TASK_COPY.identity.description.missing.entity : TASK_COPY.identity.description.missing.individual;
125
+ }
126
+ if (state === 'done') {
127
+ return isEntity ? TASK_COPY.identity.description.done.entity : TASK_COPY.identity.description.done.individual;
128
+ }
129
+ return TASK_COPY.identity.description.missing.individual;
130
+ };
131
+ function getCountryDescription(user, isFromAllowedCountry) {
132
+ var country = user.country,
133
+ user_type = user.user_type;
134
+ var isEntity = user_type === _globalVariables.UserTypes.investor_entity;
135
+ if (!country) {
136
+ return isEntity ? TASK_COPY.country.description.missing.entity : TASK_COPY.country.description.missing.individual;
137
+ }
138
+ if (!isFromAllowedCountry) {
139
+ return TASK_COPY.country.description.not_available;
140
+ }
141
+ return isEntity ? TASK_COPY.country.description.done.entity : TASK_COPY.country.description.done.individual;
142
+ }
143
+
144
+ /**
145
+ * Generate core checklist tasks (country, identity, wallet, tax ID) with unified copy
146
+ * @param {Object} user - User object
147
+ * @returns {Object} Core checklist tasks with unified copy, country status, all tasks, and remaining count
148
+ */
149
+ function generateCoreChecklistTasks(user) {
150
+ if (!user) {
151
+ return {
152
+ country: null,
153
+ identity: null,
154
+ wallet: null,
155
+ taxId: null,
156
+ isFromAllowedCountry: false,
157
+ allTasks: [],
158
+ remainingCount: 0
159
+ };
160
+ }
161
+ var country = user.country,
162
+ user_type = user.user_type,
163
+ _user$wallets = user.wallets,
164
+ wallets = _user$wallets === void 0 ? [] : _user$wallets,
165
+ taxId = user.taxId,
166
+ countryObj = user.countryObj;
167
+ var isFromAllowedCountry = countryObj === null || countryObj === void 0 ? void 0 : countryObj.isAllowed;
168
+ var liquidWallets = wallets.filter(function (wallet) {
169
+ return wallet.type === _globalVariables.walletTypes.LIQUID;
170
+ }) || [];
171
+ var hasWallet = liquidWallets.length > 0;
172
+ var isEntity = user_type === _globalVariables.UserTypes.investor_entity;
173
+ var platformURL = "https://signup.".concat(websiteUrl);
174
+
175
+ // Country task
176
+ var countryStatus = !country ? 'missing' : !isFromAllowedCountry ? 'not_available' : 'done';
177
+ var countryTask = {
178
+ key: 'country',
179
+ title: isEntity ? TASK_COPY.country.title.entity : TASK_COPY.country.title.individual,
180
+ description: getCountryDescription(user, isFromAllowedCountry),
181
+ iconState: countryStatus,
182
+ iconCopy: TASK_COPY.country.iconCopy[countryStatus],
183
+ link: "".concat(platformURL, "/country-of-residence")
184
+ };
185
+
186
+ // Identity task
187
+ var verifyIdentityChecklist = getVerifyIdentityChecklistState(isFromAllowedCountry, user);
188
+ var identity = {
189
+ key: 'kyc',
190
+ title: isEntity ? TASK_COPY.identity.title.entity : TASK_COPY.identity.title.individual,
191
+ description: getIdentityDescription(verifyIdentityChecklist.state, isEntity),
192
+ iconState: verifyIdentityChecklist.state,
193
+ iconCopy: TASK_COPY.identity.iconCopy[verifyIdentityChecklist.state],
194
+ link: verifyIdentityChecklist.hasLink ? "".concat(platformURL, "/verify-identity") : undefined
195
+ };
196
+
197
+ // Wallet
198
+ var walletStatus = hasWallet ? 'done' : 'missing';
199
+ var walletDescription = !isFromAllowedCountry ? TASK_COPY.wallet.description.not_available : hasWallet ? TASK_COPY.wallet.description.done : TASK_COPY.wallet.description.missing;
200
+ var wallet = {
201
+ key: 'wallet',
202
+ title: TASK_COPY.wallet.title,
203
+ description: walletDescription,
204
+ iconState: walletStatus,
205
+ iconCopy: TASK_COPY.wallet.iconCopy[walletStatus],
206
+ link: isFromAllowedCountry ? "".concat(platformURL, "/register-liquid-securities") : undefined
207
+ };
208
+
209
+ // Tax ID
210
+ var taxStatus = taxId ? 'done' : 'missing';
211
+ var taxIdTask = {
212
+ key: 'taxId',
213
+ title: TASK_COPY.taxId.title,
214
+ description: TASK_COPY.taxId.description[taxStatus],
215
+ iconState: taxStatus,
216
+ iconCopy: TASK_COPY.taxId.iconCopy[taxStatus],
217
+ openModal: 'taxId',
218
+ tooltip: TASK_COPY.taxId.tooltip
219
+ };
220
+
221
+ // Create all tasks array
222
+ var allTasks = [countryTask, identity, wallet, taxIdTask].filter(Boolean);
223
+
224
+ // Calculate remaining count based on missing items
225
+ var remainingCount = allTasks.filter(function (task) {
226
+ return task.iconState === 'missing' || task.iconState === 'not_available';
227
+ }).length;
228
+ return {
229
+ country: countryTask,
230
+ identity: identity,
231
+ wallet: wallet,
232
+ taxId: taxIdTask,
233
+ isFromAllowedCountry: isFromAllowedCountry,
234
+ allTasks: allTasks,
235
+ remainingCount: remainingCount
236
+ };
237
+ }
238
+ var _default = generateCoreChecklistTasks;
239
+ exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stokr/components-library",
3
- "version": "2.3.56",
3
+ "version": "2.3.58-beta.2",
4
4
  "description": "STOKR - Components Library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",