@stokr/components-library 3.2.0 → 3.3.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/index.js +0 -13
- package/package.json +1 -2
- package/dist/analytics/index.js +0 -185
package/dist/index.js
CHANGED
|
@@ -109,7 +109,6 @@ import { AnimatedSpan, LoadingDots, StokrLoader, StokrLoaderBox, loaderGif } fro
|
|
|
109
109
|
import { InfoBox } from "./components/InfoBox/InfoBox.js";
|
|
110
110
|
import { IdentityCountryRow, IdentityResidencyItem, IdentitySectionHeader } from "./components/IdentityInfo/IdentityInfo.js";
|
|
111
111
|
import { Inner, Outer, ThumbH, ThumbV, TrackH, TrackV } from "./components/ComponentScroll/ComponentScroll.styles.js";
|
|
112
|
-
import { alias, getAmountBucket, getTokenBucket, hasOptedIn, identify, initAnalytics, optIn, optOut, reset, setUserProperties, timeEvent, track } from "./analytics/index.js";
|
|
113
112
|
import { checkSaleTimeLeft } from "./utils/check-sale-time-left.js";
|
|
114
113
|
import { CopyToClipBoardTooltip, useCopyToClipboard, withCopyToClipboard } from "./utils/copyToClipboard.js";
|
|
115
114
|
import { cooldownHOC, useComponentVisible, useContainerSize, useCooldown, useMobileView, usePrevious } from "./utils/customHooks.js";
|
|
@@ -513,7 +512,6 @@ export {
|
|
|
513
512
|
WrapperSlider,
|
|
514
513
|
X,
|
|
515
514
|
Youtube,
|
|
516
|
-
alias,
|
|
517
515
|
checkSaleTimeLeft,
|
|
518
516
|
colors,
|
|
519
517
|
confirm,
|
|
@@ -527,7 +525,6 @@ export {
|
|
|
527
525
|
formatAmountForDisplay,
|
|
528
526
|
formatCurrencyValue,
|
|
529
527
|
formatDisplayNumber,
|
|
530
|
-
getAmountBucket,
|
|
531
528
|
getCopySource,
|
|
532
529
|
getCurrencyConfig,
|
|
533
530
|
getCurrencyIcon,
|
|
@@ -537,12 +534,8 @@ export {
|
|
|
537
534
|
getPasswordCriteria,
|
|
538
535
|
getPasswordEntropy,
|
|
539
536
|
getProjectCurrencySign,
|
|
540
|
-
getTokenBucket,
|
|
541
537
|
default3 as grid,
|
|
542
|
-
hasOptedIn,
|
|
543
538
|
iconsMap,
|
|
544
|
-
identify,
|
|
545
|
-
initAnalytics,
|
|
546
539
|
interpolate,
|
|
547
540
|
isCopyKey,
|
|
548
541
|
isExternalUrl,
|
|
@@ -552,10 +545,7 @@ export {
|
|
|
552
545
|
loaderGif,
|
|
553
546
|
momentUtils,
|
|
554
547
|
openFile,
|
|
555
|
-
optIn,
|
|
556
|
-
optOut,
|
|
557
548
|
reactTippyStyle,
|
|
558
|
-
reset,
|
|
559
549
|
resolveCopy,
|
|
560
550
|
default4 as rwd,
|
|
561
551
|
rwdMax,
|
|
@@ -563,15 +553,12 @@ export {
|
|
|
563
553
|
scrollToElement,
|
|
564
554
|
default5 as semanticUiStyle,
|
|
565
555
|
setCopySource,
|
|
566
|
-
setUserProperties,
|
|
567
556
|
showProgress,
|
|
568
557
|
showSuccess,
|
|
569
558
|
sizes,
|
|
570
559
|
default6 as spacing,
|
|
571
560
|
t,
|
|
572
561
|
default7 as theme,
|
|
573
|
-
timeEvent,
|
|
574
|
-
track,
|
|
575
562
|
transactionTypeDisplayNames,
|
|
576
563
|
usCountries,
|
|
577
564
|
useComponentVisible,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stokr/components-library",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "STOKR - Components Library",
|
|
5
5
|
"author": "Bilal Hodzic <bilal@stokr.io>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
"dompurify": "^3.2.4",
|
|
58
58
|
"formik": "^2.2.9",
|
|
59
59
|
"html-react-parser": "^5.0.6",
|
|
60
|
-
"mixpanel-browser": "^2.74.0",
|
|
61
60
|
"moment": "^2.30.1",
|
|
62
61
|
"moment-timezone": "^0.6.0",
|
|
63
62
|
"prop-types": "^15.8.1",
|
package/dist/analytics/index.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import mixpanel from "mixpanel-browser";
|
|
2
|
-
const BLOCKED_FIELDS = /* @__PURE__ */ new Set([
|
|
3
|
-
// PII
|
|
4
|
-
"email",
|
|
5
|
-
"first_name",
|
|
6
|
-
"last_name",
|
|
7
|
-
"full_name",
|
|
8
|
-
"name",
|
|
9
|
-
"phone",
|
|
10
|
-
"date_of_birth",
|
|
11
|
-
"address",
|
|
12
|
-
"nationality",
|
|
13
|
-
"passport_number",
|
|
14
|
-
// Blockchain
|
|
15
|
-
"wallet_address",
|
|
16
|
-
"tx_hash",
|
|
17
|
-
"transaction_hash",
|
|
18
|
-
"block_hash",
|
|
19
|
-
"contract_address",
|
|
20
|
-
"signing_address",
|
|
21
|
-
// Financial precision — server sends bucketed values only
|
|
22
|
-
"amount",
|
|
23
|
-
"exact_amount",
|
|
24
|
-
"investment_amount",
|
|
25
|
-
"token_quantity",
|
|
26
|
-
"token_price",
|
|
27
|
-
"token_value",
|
|
28
|
-
"price",
|
|
29
|
-
"value",
|
|
30
|
-
"balance",
|
|
31
|
-
"nav",
|
|
32
|
-
"net_asset_value",
|
|
33
|
-
// Banking
|
|
34
|
-
"iban",
|
|
35
|
-
"bic",
|
|
36
|
-
"swift",
|
|
37
|
-
"bank_account",
|
|
38
|
-
"routing_number",
|
|
39
|
-
// KYC
|
|
40
|
-
"kyc_data",
|
|
41
|
-
"kyb_data",
|
|
42
|
-
"document_id",
|
|
43
|
-
"tax_id",
|
|
44
|
-
"ssn"
|
|
45
|
-
]);
|
|
46
|
-
const BLOCKED_PATTERNS = [
|
|
47
|
-
/address$/i,
|
|
48
|
-
// wallet_address, contract_address, billing_address
|
|
49
|
-
/hash$/i,
|
|
50
|
-
// tx_hash, block_hash
|
|
51
|
-
/^raw_/i,
|
|
52
|
-
/password/i,
|
|
53
|
-
/secret/i,
|
|
54
|
-
/private.*key/i,
|
|
55
|
-
/\bprice\b/i,
|
|
56
|
-
/exact/i
|
|
57
|
-
];
|
|
58
|
-
function sanitize(props) {
|
|
59
|
-
if (!props || typeof props !== "object" || Array.isArray(props)) {
|
|
60
|
-
return props ?? {};
|
|
61
|
-
}
|
|
62
|
-
const cleaned = {};
|
|
63
|
-
for (const [key, val] of Object.entries(props)) {
|
|
64
|
-
const isBlocked = BLOCKED_FIELDS.has(key.toLowerCase()) || BLOCKED_PATTERNS.some((re) => re.test(key));
|
|
65
|
-
if (isBlocked) {
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
cleaned[key] = val && typeof val === "object" && !Array.isArray(val) ? sanitize(val) : val;
|
|
69
|
-
}
|
|
70
|
-
return cleaned;
|
|
71
|
-
}
|
|
72
|
-
let initialized = false;
|
|
73
|
-
function initAnalytics({
|
|
74
|
-
token,
|
|
75
|
-
app,
|
|
76
|
-
requireConsent = false,
|
|
77
|
-
scroll = true,
|
|
78
|
-
apiHost: apiHostArg
|
|
79
|
-
} = {}) {
|
|
80
|
-
const apiHost = apiHostArg ?? "https://api-eu.mixpanel.com";
|
|
81
|
-
if (initialized) return;
|
|
82
|
-
if (!token) return;
|
|
83
|
-
if (typeof navigator !== "undefined" && /Ghost Inspector/i.test(navigator.userAgent)) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
mixpanel.init(token, {
|
|
87
|
-
api_host: apiHost,
|
|
88
|
-
autocapture: {
|
|
89
|
-
pageview: "full-url",
|
|
90
|
-
click: false,
|
|
91
|
-
dead_click: false,
|
|
92
|
-
input: false,
|
|
93
|
-
rage_click: true,
|
|
94
|
-
scroll,
|
|
95
|
-
submit: true,
|
|
96
|
-
capture_text_content: false,
|
|
97
|
-
capture_extra_attrs: ["data-cy"]
|
|
98
|
-
},
|
|
99
|
-
record_sessions_percent: 100,
|
|
100
|
-
record_heatmap_data: true,
|
|
101
|
-
opt_out_tracking_by_default: requireConsent,
|
|
102
|
-
persistence: "localStorage",
|
|
103
|
-
debug: false
|
|
104
|
-
});
|
|
105
|
-
if (app) {
|
|
106
|
-
mixpanel.register({ app });
|
|
107
|
-
}
|
|
108
|
-
mixpanel.register({ source: "frontend" });
|
|
109
|
-
initialized = true;
|
|
110
|
-
}
|
|
111
|
-
function optIn() {
|
|
112
|
-
if (!initialized) return;
|
|
113
|
-
mixpanel.opt_in_tracking();
|
|
114
|
-
}
|
|
115
|
-
function optOut() {
|
|
116
|
-
if (!initialized) return;
|
|
117
|
-
mixpanel.opt_out_tracking();
|
|
118
|
-
}
|
|
119
|
-
function hasOptedIn() {
|
|
120
|
-
if (!initialized) return false;
|
|
121
|
-
return mixpanel.has_opted_in_tracking();
|
|
122
|
-
}
|
|
123
|
-
function track(eventName, props = {}) {
|
|
124
|
-
if (!initialized) return;
|
|
125
|
-
mixpanel.track(eventName, sanitize(props));
|
|
126
|
-
}
|
|
127
|
-
function timeEvent(eventName) {
|
|
128
|
-
if (!initialized) return;
|
|
129
|
-
mixpanel.time_event(eventName);
|
|
130
|
-
}
|
|
131
|
-
function identify(userId, traits = {}) {
|
|
132
|
-
if (!initialized) return;
|
|
133
|
-
mixpanel.identify(userId);
|
|
134
|
-
const sanitizedTraits = sanitize(traits);
|
|
135
|
-
if (Object.keys(sanitizedTraits).length > 0) {
|
|
136
|
-
mixpanel.people.set(sanitizedTraits);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function setUserProperties(props = {}) {
|
|
140
|
-
if (!initialized) return;
|
|
141
|
-
const sanitized = sanitize(props);
|
|
142
|
-
if (Object.keys(sanitized).length > 0) {
|
|
143
|
-
mixpanel.people.set(sanitized);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
function alias(userId) {
|
|
147
|
-
if (!initialized) return;
|
|
148
|
-
mixpanel.alias(userId);
|
|
149
|
-
}
|
|
150
|
-
function reset() {
|
|
151
|
-
if (!initialized) return;
|
|
152
|
-
mixpanel.reset();
|
|
153
|
-
}
|
|
154
|
-
function getAmountBucket(amount) {
|
|
155
|
-
if (amount < 125e3) return "<125k";
|
|
156
|
-
if (amount < 25e4) return "125k-250k";
|
|
157
|
-
if (amount < 5e5) return "250k-500k";
|
|
158
|
-
if (amount < 1e6) return "500k-1M";
|
|
159
|
-
if (amount < 5e6) return "1M-5M";
|
|
160
|
-
return "5M+";
|
|
161
|
-
}
|
|
162
|
-
function getTokenBucket(qty) {
|
|
163
|
-
if (qty <= 1) return "0-1";
|
|
164
|
-
if (qty <= 10) return "2-10";
|
|
165
|
-
if (qty <= 100) return "11-100";
|
|
166
|
-
if (qty <= 1e3) return "101-1k";
|
|
167
|
-
if (qty <= 1e4) return "1k-10k";
|
|
168
|
-
if (qty <= 1e5) return "10k-100k";
|
|
169
|
-
if (qty <= 1e6) return "100k-1M";
|
|
170
|
-
return "1M+";
|
|
171
|
-
}
|
|
172
|
-
export {
|
|
173
|
-
alias,
|
|
174
|
-
getAmountBucket,
|
|
175
|
-
getTokenBucket,
|
|
176
|
-
hasOptedIn,
|
|
177
|
-
identify,
|
|
178
|
-
initAnalytics,
|
|
179
|
-
optIn,
|
|
180
|
-
optOut,
|
|
181
|
-
reset,
|
|
182
|
-
setUserProperties,
|
|
183
|
-
timeEvent,
|
|
184
|
-
track
|
|
185
|
-
};
|