@stokr/components-library 3.1.1 → 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.
Files changed (35) hide show
  1. package/dist/components/Checklist/ChecklistCard.js +1 -2
  2. package/dist/components/Checklist/ChecklistCard.styles.js +39 -0
  3. package/dist/components/CryptoAddressWrapper/CryptoAddressWrapper.js +1 -3
  4. package/dist/components/FAQ/FAQ.js +1 -3
  5. package/dist/components/Form/Form.js +1 -3
  6. package/dist/components/RefreshButton/RefreshButton.js +3 -5
  7. package/dist/components/SectionTitle/SectionTitle.styles.js +1 -2
  8. package/dist/index.js +34 -84
  9. package/package.json +1 -4
  10. package/dist/analytics/index.js +0 -187
  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
@@ -2,8 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { iconsMap } from "../Icon/Icon.style.js";
5
- import { CardContainer, IconBlock, IconCopy, CardTitle, CardDescription } from "./ChecklistCard.styles.js";
6
- import { Icon } from "../ToDoList/ToDoListTask.styles.js";
5
+ import { CardContainer, IconBlock, IconCopy, CardTitle, CardDescription, Icon } from "./ChecklistCard.styles.js";
7
6
  import { colors } from "../../styles/colors.js";
8
7
  import SvgWarningFilled from "../../static/images/warning-filled.svg.js";
9
8
  import { Link } from "react-router-dom";
@@ -1,5 +1,7 @@
1
1
  import styled from "styled-components";
2
2
  import rwd from "../../styles/rwd.js";
3
+ import { colors } from "../../styles/colors.js";
4
+ import { Icon as Icon$1 } from "../Icon/Icon.style.js";
3
5
  const CardContainer = styled.div.withConfig({
4
6
  shouldForwardProp: (props) => !["isClickable"].includes(props)
5
7
  })`
@@ -73,10 +75,47 @@ const CardDescription = styled.div`
73
75
  letter-spacing: 0.8px;
74
76
  `}
75
77
  `;
78
+ const TaskState = {
79
+ REJECTED: "rejected",
80
+ IN_PROGRESS: "in_progress",
81
+ APPROVED: "approved",
82
+ SKIPPED: "skipped",
83
+ NOT_AVAILABLE: "not_available"
84
+ };
85
+ const Icon = styled(Icon$1).withConfig({
86
+ shouldForwardProp: (props) => !["state"].includes(props)
87
+ })`
88
+ font-size: 20px;
89
+ width: 18px;
90
+ text-align: center;
91
+
92
+ ${(props) => props.state === TaskState.APPROVED && `
93
+ font-size: 13px;
94
+ color: ${colors.freshGreen};
95
+ `}
96
+
97
+ ${(props) => props.state === TaskState.REJECTED && `
98
+ color: ${colors.orangishRed};
99
+ `}
100
+
101
+ ${(props) => props.state === TaskState.IN_PROGRESS && `
102
+ opacity: 0.3;
103
+ `}
104
+
105
+ ${(props) => props.state === TaskState.SKIPPED && `
106
+ font-size: 13px;
107
+ `}
108
+
109
+ ${(props) => props.state === TaskState.NOT_AVAILABLE && `
110
+ font-size: 13px;
111
+ opacity: 0.3;
112
+ `}
113
+ `;
76
114
  export {
77
115
  CardContainer,
78
116
  CardDescription,
79
117
  CardTitle,
118
+ Icon,
80
119
  IconBlock,
81
120
  IconCopy
82
121
  };
@@ -18,8 +18,6 @@ CryptoAddressWrapper.propTypes = {
18
18
  refresh: PropTypes.string,
19
19
  failed: PropTypes.string
20
20
  };
21
- var stdin_default = CryptoAddressWrapper;
22
21
  export {
23
- CryptoAddressWrapper,
24
- stdin_default as default
22
+ CryptoAddressWrapper
25
23
  };
@@ -71,7 +71,6 @@ FAQ.propTypes = {
71
71
  /** Prefix for data-cy: `{prefix}-accordion`, `{prefix}-item-{slug}-toggle`, etc. */
72
72
  dataCyPrefix: PropTypes.string
73
73
  };
74
- var stdin_default = FAQ;
75
74
  export {
76
75
  FAQ,
77
76
  FaqContent,
@@ -79,6 +78,5 @@ export {
79
78
  FaqItem,
80
79
  FaqItems,
81
80
  FaqText,
82
- FaqTitle,
83
- stdin_default as default
81
+ FaqTitle
84
82
  };
@@ -10,12 +10,10 @@ const Form = ({ children, id }) => {
10
10
  Form.propTypes = {
11
11
  children: PropTypes.node.isRequired
12
12
  };
13
- var stdin_default = Form;
14
13
  export {
15
14
  Form,
16
15
  FormContainer,
17
16
  FormError,
18
17
  FormField,
19
- FormInfo,
20
- stdin_default as default
18
+ FormInfo
21
19
  };
@@ -1,20 +1,18 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import PropTypes from "prop-types";
4
- import stdin_default$1 from "../SvgIcons/RefreshSvg.js";
4
+ import stdin_default from "../SvgIcons/RefreshSvg.js";
5
5
  import { StyledButton, IconWrap, Content } from "./RefreshButton.styles.js";
6
6
  const RefreshButton = (props) => {
7
7
  const { children } = props;
8
8
  return /* @__PURE__ */ jsxs(StyledButton, { ...props, children: [
9
- /* @__PURE__ */ jsx(IconWrap, { children: /* @__PURE__ */ jsx(stdin_default$1, {}) }),
9
+ /* @__PURE__ */ jsx(IconWrap, { children: /* @__PURE__ */ jsx(stdin_default, {}) }),
10
10
  /* @__PURE__ */ jsx(Content, { children })
11
11
  ] });
12
12
  };
13
13
  RefreshButton.propTypes = {
14
14
  children: PropTypes.node.isRequired
15
15
  };
16
- var stdin_default = RefreshButton;
17
16
  export {
18
- RefreshButton,
19
- stdin_default as default
17
+ RefreshButton
20
18
  };
@@ -21,6 +21,5 @@ const SectionTitle = styled.h2`
21
21
  }
22
22
  `;
23
23
  export {
24
- SectionTitle,
25
- SectionTitle as default
24
+ SectionTitle
26
25
  };
package/dist/index.js CHANGED
@@ -22,7 +22,6 @@ import { CryptoAddressWrapper } from "./components/CryptoAddressWrapper/CryptoAd
22
22
  import { DoubleButtons } from "./components/DoubleButton/DoubleButton.styles.js";
23
23
  import { ErrorMessage } from "./components/ErrorMessage/ErrorMessage.styles.js";
24
24
  import { FAQ } from "./components/FAQ/FAQ.js";
25
- import { Newsletter } from "./components/Newsletter/Newsletter.js";
26
25
  import { Form } from "./components/Form/Form.js";
27
26
  import { Card, CardHeader, CardHeaderRegular, CardLeftText, CardRightText, CardTitle, CardTitleContainer } from "./components/Card/Card.styles.js";
28
27
  import { Column, FlexContainer, FlexGrid, PageWrapper, Row, Wrapper } from "./components/Grid/Grid.styles.js";
@@ -81,8 +80,6 @@ import { Tabs } from "./components/Tabs/Tabs.js";
81
80
  import { TeamOverview } from "./components/TeamOverview/TeamOverview.js";
82
81
  import { Text } from "./components/Text/Text.styles.js";
83
82
  import { TextButton, TextLink } from "./components/TextLink/TextLink.styles.js";
84
- import { ToDoList, ToDoModal, ToDoTaskMessage, ToDoTaskState } from "./components/ToDoList/ToDoList.js";
85
- import { ToDoTask } from "./components/ToDoList/ToDoListTask.js";
86
83
  import { TransactionDetails } from "./components/TransactionDetails/TransactionDetails.js";
87
84
  import { TransactionInfo } from "./components/TransactionInfo/TransactionInfo.js";
88
85
  import { QRCode, QRCodeWrapper } from "./components/QRCode/QRCode.js";
@@ -112,11 +109,7 @@ import { AnimatedSpan, LoadingDots, StokrLoader, StokrLoaderBox, loaderGif } fro
112
109
  import { InfoBox } from "./components/InfoBox/InfoBox.js";
113
110
  import { IdentityCountryRow, IdentityResidencyItem, IdentitySectionHeader } from "./components/IdentityInfo/IdentityInfo.js";
114
111
  import { Inner, Outer, ThumbH, ThumbV, TrackH, TrackV } from "./components/ComponentScroll/ComponentScroll.styles.js";
115
- import { CheckboxContext, CheckboxProvider, useCheckboxActions, useCheckboxes } from "./context/Checkbox/CheckboxContext.js";
116
- import { alias, getAmountBucket, getTokenBucket, hasOptedIn, identify, initAnalytics, optIn, optOut, reset, setUserProperties, timeEvent, track } from "./analytics/index.js";
117
112
  import { checkSaleTimeLeft } from "./utils/check-sale-time-left.js";
118
- import { checkTodoStatus } from "./utils/check-todo-status.js";
119
- import { generateCoreChecklistTasks, getVerifyIdentityChecklist } from "./utils/checklistGenerator.js";
120
113
  import { CopyToClipBoardTooltip, useCopyToClipboard, withCopyToClipboard } from "./utils/copyToClipboard.js";
121
114
  import { cooldownHOC, useComponentVisible, useContainerSize, useCooldown, useMobileView, usePrevious } from "./utils/customHooks.js";
122
115
  import { fixDecimals, formatDisplayNumber } from "./utils/fix-decimals.js";
@@ -129,10 +122,6 @@ import { openFile, saveAs } from "./utils/saveAs.js";
129
122
  import { ScrollToTop, scrollToElement, useScrollActions } from "./utils/scrollUtils.js";
130
123
  import { useTimer } from "./hooks/useTimer.js";
131
124
  import { useTransactionPolling } from "./hooks/useTransactionPolling.js";
132
- import { resetRuntimeConfig } from "./runtime-config.js";
133
- import { navigateToHref, pathnameIfSameOrigin } from "./routing/navigate-app.js";
134
- import { RouterWrapper } from "./routing/RouterWrapper.js";
135
- import { isAlreadyOnOnboardingFlow } from "./utils/app-urls.js";
136
125
  import { colors } from "./styles/colors.js";
137
126
  import { default as default2 } from "./styles/fonts.js";
138
127
  import { GlobalStyle } from "./styles/global.js";
@@ -183,40 +172,36 @@ import { default as default20 } from "./components/SvgIcons/OneSvg.js";
183
172
  import { default as default21 } from "./components/SvgIcons/PassportSvg.js";
184
173
  import { Reddit } from "./components/icons/Reddit.js";
185
174
  import { default as default22 } from "./components/SvgIcons/RefreshSvg.js";
186
- import { default as default23 } from "./components/taxId/register-taxid.js";
187
- import { default as default24 } from "./components/taxId/complete.js";
188
- import { default as default25 } from "./components/taxId/flow.js";
189
175
  import { SelectContainer, SelectControl, SelectIcon, SelectMenu, SelectMenuList, SelectOption, SelectValueContainer, SelectWrapper } from "./components/Input/Select.styles.js";
190
176
  import { Share } from "./components/icons/Share.js";
191
177
  import { Snackbar } from "./components/Snackbar/Snackbar.js";
192
178
  import { SnackbarContext, SnackbarProvider } from "./components/Snackbar/SnackbarProvider.js";
193
- import { default as default26 } from "./components/SvgIcons/SocialFacebook.js";
194
- import { default as default27 } from "./components/SvgIcons/SocialInstagram.js";
195
- import { default as default28 } from "./components/SvgIcons/SocialLinkedIn.js";
196
- import { default as default29 } from "./components/SvgIcons/SocialMedium.js";
197
- import { default as default30 } from "./components/SvgIcons/SocialReddit.js";
198
- import { default as default31 } from "./components/SvgIcons/SocialTelegram.js";
199
- import { default as default32 } from "./components/SvgIcons/SocialTwitter.js";
200
- import { default as default33 } from "./components/SvgIcons/SocialYoutube.js";
179
+ import { default as default23 } from "./components/SvgIcons/SocialFacebook.js";
180
+ import { default as default24 } from "./components/SvgIcons/SocialInstagram.js";
181
+ import { default as default25 } from "./components/SvgIcons/SocialLinkedIn.js";
182
+ import { default as default26 } from "./components/SvgIcons/SocialMedium.js";
183
+ import { default as default27 } from "./components/SvgIcons/SocialReddit.js";
184
+ import { default as default28 } from "./components/SvgIcons/SocialTelegram.js";
185
+ import { default as default29 } from "./components/SvgIcons/SocialTwitter.js";
186
+ import { default as default30 } from "./components/SvgIcons/SocialYoutube.js";
201
187
  import { StyledReactTable, Styles, TableWrap } from "./components/AdminDashboard/Table/Table.styles.js";
202
188
  import { SuccessModal, SuccessModal as SuccessModal2, showProgress, showSuccess } from "./components/Modal/SuccessModal/SuccessModal.js";
203
189
  import { Tab } from "./components/Tabs/Tabs.styles.js";
204
- import { default as default34 } from "./components/TabsNav/TabNav.js";
190
+ import { default as default31 } from "./components/TabsNav/TabNav.js";
205
191
  import { Telegram } from "./components/icons/Telegram.js";
206
- import { default as default35 } from "./components/SvgIcons/ThreeSvg.js";
192
+ import { default as default32 } from "./components/SvgIcons/ThreeSvg.js";
207
193
  import { Twitter } from "./components/icons/Twitter.js";
208
- import { default as default36 } from "./components/SvgIcons/TwoSidedDocumentSvg.js";
209
- import { default as default37 } from "./components/SvgIcons/TwoSvg.js";
210
- import { default as default38 } from "./components/SvgIcons/UpdateDefaultSvg.js";
211
- import { default as default39 } from "./components/SvgIcons/UpdateHardSvg.js";
212
- import { default as default40 } from "./components/SvgIcons/UpdateSoftSvg.js";
213
- import { default as default41 } from "./components/SvgIcons/UploadSvg.js";
214
- import { default as default42 } from "./components/SvgIcons/VerifiedBadge.js";
194
+ import { default as default33 } from "./components/SvgIcons/TwoSidedDocumentSvg.js";
195
+ import { default as default34 } from "./components/SvgIcons/TwoSvg.js";
196
+ import { default as default35 } from "./components/SvgIcons/UpdateDefaultSvg.js";
197
+ import { default as default36 } from "./components/SvgIcons/UpdateHardSvg.js";
198
+ import { default as default37 } from "./components/SvgIcons/UpdateSoftSvg.js";
199
+ import { default as default38 } from "./components/SvgIcons/UploadSvg.js";
200
+ import { default as default39 } from "./components/SvgIcons/VerifiedBadge.js";
215
201
  import { X } from "./components/icons/X.js";
216
202
  import { Youtube } from "./components/icons/Youtube.js";
217
203
  import { copyTextToClipboard } from "./utils/copy-text-to-clipboard.js";
218
204
  import { format } from "date-fns";
219
- import { getAnalyticsIngestUrl, getBackofficeAppUrl } from "./utils/app-urls-analytics-backoffice.js";
220
205
  import { useSnackbar } from "./components/Snackbar/useSnackbar.js";
221
206
  export {
222
207
  AccountBalance,
@@ -260,9 +245,7 @@ export {
260
245
  Check,
261
246
  CheckBoxCaption,
262
247
  Checkbox,
263
- CheckboxContext,
264
248
  CheckboxDiv,
265
- CheckboxProvider,
266
249
  CheckboxWrapperDiv,
267
250
  ChecklistCard,
268
251
  Chip,
@@ -389,7 +372,6 @@ export {
389
372
  ModalScroll,
390
373
  MultiProgressBar,
391
374
  MultiSelect,
392
- Newsletter,
393
375
  NotificationCounter,
394
376
  Number,
395
377
  NumberWithContainer,
@@ -429,11 +411,7 @@ export {
429
411
  Reddit,
430
412
  RefreshButton,
431
413
  default22 as RefreshSvg,
432
- default23 as RegisterTaxId,
433
- default24 as RegisterTaxIdComplete,
434
- default25 as RegisterTaxIdFlow,
435
414
  RequestDataBox,
436
- RouterWrapper,
437
415
  Row,
438
416
  SEO,
439
417
  SLIDER_HEIGHT,
@@ -460,14 +438,14 @@ export {
460
438
  Snackbar,
461
439
  SnackbarContext,
462
440
  SnackbarProvider,
463
- default26 as SocialFacebook,
464
- default27 as SocialInstagram,
465
- default28 as SocialLinkedIn,
466
- default29 as SocialMedium,
467
- default30 as SocialReddit,
468
- default31 as SocialTelegram,
469
- default32 as SocialTwitter,
470
- default33 as SocialYoutube,
441
+ default23 as SocialFacebook,
442
+ default24 as SocialInstagram,
443
+ default25 as SocialLinkedIn,
444
+ default26 as SocialMedium,
445
+ default27 as SocialReddit,
446
+ default28 as SocialTelegram,
447
+ default29 as SocialTwitter,
448
+ default30 as SocialYoutube,
471
449
  SpanButton,
472
450
  StatusBadge,
473
451
  StatusDot,
@@ -490,7 +468,7 @@ export {
490
468
  Switch,
491
469
  TABLET_MEDIA,
492
470
  Tab,
493
- default34 as TabNav,
471
+ default31 as TabNav,
494
472
  Table,
495
473
  TableFilterDropdown,
496
474
  TableWrap,
@@ -504,17 +482,12 @@ export {
504
482
  TextButton,
505
483
  TextLink,
506
484
  Textarea,
507
- default35 as ThreeSvg,
485
+ default32 as ThreeSvg,
508
486
  ThumbH,
509
487
  ThumbV,
510
488
  Timeline,
511
489
  TimelineStep,
512
490
  TimerComponent,
513
- ToDoList,
514
- ToDoModal,
515
- ToDoTask,
516
- ToDoTaskMessage,
517
- ToDoTaskState,
518
491
  Tooltip,
519
492
  Bubble as TooltipBubble,
520
493
  TooltipIcon,
@@ -524,24 +497,22 @@ export {
524
497
  TransactionInfo,
525
498
  TransactionTypes,
526
499
  Twitter,
527
- default36 as TwoSidedDocumentSvg,
528
- default37 as TwoSvg,
500
+ default33 as TwoSidedDocumentSvg,
501
+ default34 as TwoSvg,
529
502
  USInvestorAcreditationStatuses,
530
- default38 as UpdateDefaultSvg,
531
- default39 as UpdateHardSvg,
532
- default40 as UpdateSoftSvg,
533
- default41 as UploadSvg,
503
+ default35 as UpdateDefaultSvg,
504
+ default36 as UpdateHardSvg,
505
+ default37 as UpdateSoftSvg,
506
+ default38 as UploadSvg,
534
507
  UppercaseText,
535
508
  UserTypes,
536
- default42 as VerifiedBadge,
509
+ default39 as VerifiedBadge,
537
510
  WHITE_HEX,
538
511
  Wrapper,
539
512
  WrapperSlider,
540
513
  X,
541
514
  Youtube,
542
- alias,
543
515
  checkSaleTimeLeft,
544
- checkTodoStatus,
545
516
  colors,
546
517
  confirm,
547
518
  cooldownHOC,
@@ -554,10 +525,6 @@ export {
554
525
  formatAmountForDisplay,
555
526
  formatCurrencyValue,
556
527
  formatDisplayNumber,
557
- generateCoreChecklistTasks,
558
- getAmountBucket,
559
- getAnalyticsIngestUrl,
560
- getBackofficeAppUrl,
561
528
  getCopySource,
562
529
  getCurrencyConfig,
563
530
  getCurrencyIcon,
@@ -567,15 +534,9 @@ export {
567
534
  getPasswordCriteria,
568
535
  getPasswordEntropy,
569
536
  getProjectCurrencySign,
570
- getTokenBucket,
571
- getVerifyIdentityChecklist,
572
537
  default3 as grid,
573
- hasOptedIn,
574
538
  iconsMap,
575
- identify,
576
- initAnalytics,
577
539
  interpolate,
578
- isAlreadyOnOnboardingFlow,
579
540
  isCopyKey,
580
541
  isExternalUrl,
581
542
  isPasswordValid,
@@ -583,14 +544,8 @@ export {
583
544
  km_ify,
584
545
  loaderGif,
585
546
  momentUtils,
586
- navigateToHref,
587
547
  openFile,
588
- optIn,
589
- optOut,
590
- pathnameIfSameOrigin,
591
548
  reactTippyStyle,
592
- reset,
593
- resetRuntimeConfig,
594
549
  resolveCopy,
595
550
  default4 as rwd,
596
551
  rwdMax,
@@ -598,19 +553,14 @@ export {
598
553
  scrollToElement,
599
554
  default5 as semanticUiStyle,
600
555
  setCopySource,
601
- setUserProperties,
602
556
  showProgress,
603
557
  showSuccess,
604
558
  sizes,
605
559
  default6 as spacing,
606
560
  t,
607
561
  default7 as theme,
608
- timeEvent,
609
- track,
610
562
  transactionTypeDisplayNames,
611
563
  usCountries,
612
- useCheckboxActions,
613
- useCheckboxes,
614
564
  useComponentVisible,
615
565
  useContainerSize,
616
566
  useCooldown,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stokr/components-library",
3
- "version": "3.1.1",
3
+ "version": "3.3.0",
4
4
  "description": "STOKR - Components Library",
5
5
  "author": "Bilal Hodzic <bilal@stokr.io>",
6
6
  "license": "MIT",
@@ -51,15 +51,12 @@
51
51
  "dependencies": {
52
52
  "@floating-ui/react": "^0.27.20",
53
53
  "@lottiefiles/dotlottie-react": "^0.19.4",
54
- "axios": "^1.13.5",
55
54
  "country-flag-icons": "^1.6.17",
56
55
  "date-fns": "^4.1.0",
57
56
  "date-fns-tz": "^3.2.0",
58
57
  "dompurify": "^3.2.4",
59
58
  "formik": "^2.2.9",
60
59
  "html-react-parser": "^5.0.6",
61
- "js-cookie": "^3.0.5",
62
- "mixpanel-browser": "^2.74.0",
63
60
  "moment": "^2.30.1",
64
61
  "moment-timezone": "^0.6.0",
65
62
  "prop-types": "^15.8.1",
@@ -1,187 +0,0 @@
1
- import mixpanel from "mixpanel-browser";
2
- import { getAnalyticsIngestUrl } from "../utils/app-urls-analytics-backoffice.js";
3
- const BLOCKED_FIELDS = /* @__PURE__ */ new Set([
4
- // PII
5
- "email",
6
- "first_name",
7
- "last_name",
8
- "full_name",
9
- "name",
10
- "phone",
11
- "date_of_birth",
12
- "address",
13
- "nationality",
14
- "passport_number",
15
- // Blockchain
16
- "wallet_address",
17
- "tx_hash",
18
- "transaction_hash",
19
- "block_hash",
20
- "contract_address",
21
- "signing_address",
22
- // Financial precision — server sends bucketed values only
23
- "amount",
24
- "exact_amount",
25
- "investment_amount",
26
- "token_quantity",
27
- "token_price",
28
- "token_value",
29
- "price",
30
- "value",
31
- "balance",
32
- "nav",
33
- "net_asset_value",
34
- // Banking
35
- "iban",
36
- "bic",
37
- "swift",
38
- "bank_account",
39
- "routing_number",
40
- // KYC
41
- "kyc_data",
42
- "kyb_data",
43
- "document_id",
44
- "tax_id",
45
- "ssn"
46
- ]);
47
- const BLOCKED_PATTERNS = [
48
- /address$/i,
49
- // wallet_address, contract_address, billing_address
50
- /hash$/i,
51
- // tx_hash, block_hash
52
- /^raw_/i,
53
- /password/i,
54
- /secret/i,
55
- /private.*key/i,
56
- /\bprice\b/i,
57
- /exact/i
58
- ];
59
- function sanitize(props) {
60
- if (!props || typeof props !== "object" || Array.isArray(props)) {
61
- return props ?? {};
62
- }
63
- const cleaned = {};
64
- for (const [key, val] of Object.entries(props)) {
65
- const isBlocked = BLOCKED_FIELDS.has(key.toLowerCase()) || BLOCKED_PATTERNS.some((re) => re.test(key));
66
- if (isBlocked) {
67
- continue;
68
- }
69
- cleaned[key] = val && typeof val === "object" && !Array.isArray(val) ? sanitize(val) : val;
70
- }
71
- return cleaned;
72
- }
73
- let initialized = false;
74
- function initAnalytics({
75
- token,
76
- app,
77
- requireConsent = false,
78
- scroll = true,
79
- apiHost: apiHostArg
80
- } = {}) {
81
- const analyticsUrl = getAnalyticsIngestUrl();
82
- const apiHost = apiHostArg ?? (analyticsUrl || "https://api-eu.mixpanel.com");
83
- if (initialized) return;
84
- if (!token) return;
85
- if (typeof navigator !== "undefined" && /Ghost Inspector/i.test(navigator.userAgent)) {
86
- return;
87
- }
88
- mixpanel.init(token, {
89
- api_host: apiHost,
90
- autocapture: {
91
- pageview: "full-url",
92
- click: false,
93
- dead_click: false,
94
- input: false,
95
- rage_click: true,
96
- scroll,
97
- submit: true,
98
- capture_text_content: false,
99
- capture_extra_attrs: ["data-cy"]
100
- },
101
- record_sessions_percent: 100,
102
- record_heatmap_data: true,
103
- opt_out_tracking_by_default: requireConsent,
104
- persistence: "localStorage",
105
- debug: false
106
- });
107
- if (app) {
108
- mixpanel.register({ app });
109
- }
110
- mixpanel.register({ source: "frontend" });
111
- initialized = true;
112
- }
113
- function optIn() {
114
- if (!initialized) return;
115
- mixpanel.opt_in_tracking();
116
- }
117
- function optOut() {
118
- if (!initialized) return;
119
- mixpanel.opt_out_tracking();
120
- }
121
- function hasOptedIn() {
122
- if (!initialized) return false;
123
- return mixpanel.has_opted_in_tracking();
124
- }
125
- function track(eventName, props = {}) {
126
- if (!initialized) return;
127
- mixpanel.track(eventName, sanitize(props));
128
- }
129
- function timeEvent(eventName) {
130
- if (!initialized) return;
131
- mixpanel.time_event(eventName);
132
- }
133
- function identify(userId, traits = {}) {
134
- if (!initialized) return;
135
- mixpanel.identify(userId);
136
- const sanitizedTraits = sanitize(traits);
137
- if (Object.keys(sanitizedTraits).length > 0) {
138
- mixpanel.people.set(sanitizedTraits);
139
- }
140
- }
141
- function setUserProperties(props = {}) {
142
- if (!initialized) return;
143
- const sanitized = sanitize(props);
144
- if (Object.keys(sanitized).length > 0) {
145
- mixpanel.people.set(sanitized);
146
- }
147
- }
148
- function alias(userId) {
149
- if (!initialized) return;
150
- mixpanel.alias(userId);
151
- }
152
- function reset() {
153
- if (!initialized) return;
154
- mixpanel.reset();
155
- }
156
- function getAmountBucket(amount) {
157
- if (amount < 125e3) return "<125k";
158
- if (amount < 25e4) return "125k-250k";
159
- if (amount < 5e5) return "250k-500k";
160
- if (amount < 1e6) return "500k-1M";
161
- if (amount < 5e6) return "1M-5M";
162
- return "5M+";
163
- }
164
- function getTokenBucket(qty) {
165
- if (qty <= 1) return "0-1";
166
- if (qty <= 10) return "2-10";
167
- if (qty <= 100) return "11-100";
168
- if (qty <= 1e3) return "101-1k";
169
- if (qty <= 1e4) return "1k-10k";
170
- if (qty <= 1e5) return "10k-100k";
171
- if (qty <= 1e6) return "100k-1M";
172
- return "1M+";
173
- }
174
- export {
175
- alias,
176
- getAmountBucket,
177
- getTokenBucket,
178
- hasOptedIn,
179
- identify,
180
- initAnalytics,
181
- optIn,
182
- optOut,
183
- reset,
184
- setUserProperties,
185
- timeEvent,
186
- track
187
- };
@@ -1,27 +0,0 @@
1
- import Cookies from "js-cookie";
2
- import axiosInstance from "../model/axios.js";
3
- const fetchData = async (url, data) => {
4
- const accessToken = Cookies.get("STOKR_ACCESS_TOKEN");
5
- const parsedData = JSON.stringify(data ?? {});
6
- if (!accessToken) {
7
- console.log("no access token");
8
- }
9
- try {
10
- const result = await axiosInstance({
11
- method: "POST",
12
- url,
13
- data: parsedData,
14
- headers: {
15
- Authorization: `Bearer ${accessToken}`
16
- }
17
- });
18
- return result.data;
19
- } catch (error) {
20
- console.log(`Error: ${error}`);
21
- throw error;
22
- }
23
- };
24
- export {
25
- fetchData as default,
26
- fetchData
27
- };
@@ -1,19 +0,0 @@
1
- import axiosInstance from "../model/axiosPublic.js";
2
- const fetchDataPublic = async (url, data) => {
3
- const parsedData = JSON.stringify(data);
4
- try {
5
- const result = await axiosInstance({
6
- method: "POST",
7
- url,
8
- data: parsedData
9
- });
10
- return result.data;
11
- } catch (error) {
12
- console.log(`Error: ${error}`);
13
- throw error;
14
- }
15
- };
16
- export {
17
- fetchDataPublic as default,
18
- fetchDataPublic
19
- };