@stokr/components-library 3.0.21 → 3.0.23

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 (42) hide show
  1. package/README.md +217 -11
  2. package/dist/analytics/index.js +5 -1
  3. package/dist/api/authenticationApi.js +13 -0
  4. package/dist/auth/index.js +4 -2
  5. package/dist/components/2FA/login-with-otp-flow.js +9 -4
  6. package/dist/components/Footer/FooterLayout.js +98 -95
  7. package/dist/components/Footer/FooterMenu.js +1 -1
  8. package/dist/components/Header/Header.js +102 -54
  9. package/dist/components/MainMenu/MainMenu.js +14 -4
  10. package/dist/components/Modal/NewVentureModal/NewVentureModal.js +6 -2
  11. package/dist/components/Modal/SuccessModal/SuccessModal.js +7 -1
  12. package/dist/components/Payment/PaymentDetailsCard.js +1 -1
  13. package/dist/components/StatusDot/StatusDot.js +68 -0
  14. package/dist/components/StatusDot/StatusDot.styles.js +45 -0
  15. package/dist/components/VerifyEmailModal/VerifyEmailModal.js +2 -1
  16. package/dist/components/headerHo/HeaderHo.js +8 -5
  17. package/dist/config.js +5 -21
  18. package/dist/constants/globalVariables.js +6 -4
  19. package/dist/context/Auth.js +5 -2
  20. package/dist/context/AuthContext.js +22 -8
  21. package/dist/firebase-config.js +4 -18
  22. package/dist/index.js +38 -5
  23. package/dist/model/axios.js +3 -1
  24. package/dist/model/axiosPublic.js +2 -2
  25. package/dist/routing/RouterWrapper.js +17 -0
  26. package/dist/routing/app-routes.js +22 -0
  27. package/dist/routing/navigate-app.js +36 -0
  28. package/dist/routing/resolve-app-href.js +149 -0
  29. package/dist/runtime-config.js +94 -0
  30. package/dist/static/animations/upload.lottie +0 -0
  31. package/dist/static/animations/upload.lottie.js +4 -0
  32. package/dist/static/images/upload.svg +5 -1
  33. package/dist/utils/app-urls-analytics-backoffice.js +30 -0
  34. package/dist/utils/app-urls.js +28 -0
  35. package/dist/utils/checklistGenerator.js +6 -5
  36. package/dist/utils/customHooks.js +1 -1
  37. package/dist/utils/formatCurrencyValue.js +2 -1
  38. package/dist/utils/get-cookie-domain.js +4 -1
  39. package/dist/utils/set-redirect-cookie.js +4 -1
  40. package/dist/utils/withRouter.js +5 -3
  41. package/package.json +1 -1
  42. package/dist/api/auth.js +0 -15
@@ -0,0 +1,28 @@
1
+ import { AppSurface } from "../routing/app-routes.js";
2
+ import { AppRoute } from "../routing/app-routes.js";
3
+ import { resolveAppHref } from "../routing/resolve-app-href.js";
4
+ import { SURFACE_ROUTING_PATH_KEYS, getAppPublicOrigin, isAlreadyOnOnboardingFlow, isPathBasedRouting, isPathForSurface } from "../routing/resolve-app-href.js";
5
+ const getOnboardingAppBaseUrl = () => resolveAppHref(AppSurface.ONBOARDING, "");
6
+ const buildOnboardingUrl = (path = "") => resolveAppHref(AppSurface.ONBOARDING, path);
7
+ const getDashboardBaseUrl = () => resolveAppHref(AppSurface.DASHBOARD, "");
8
+ const buildDashboardUrl = (path = "") => resolveAppHref(AppSurface.DASHBOARD, path);
9
+ const getAdminAppUrl = () => resolveAppHref(AppSurface.ADMIN, "");
10
+ const getInvestorAppOrigin = () => resolveAppHref(AppSurface.INVESTOR_ROOT, "");
11
+ const getRegisterEntryUrl = () => resolveAppHref(AppSurface.REGISTER, "");
12
+ export {
13
+ AppRoute,
14
+ AppSurface,
15
+ SURFACE_ROUTING_PATH_KEYS,
16
+ buildDashboardUrl,
17
+ buildOnboardingUrl,
18
+ getAdminAppUrl,
19
+ getAppPublicOrigin,
20
+ getDashboardBaseUrl,
21
+ getInvestorAppOrigin,
22
+ getOnboardingAppBaseUrl,
23
+ getRegisterEntryUrl,
24
+ isAlreadyOnOnboardingFlow,
25
+ isPathBasedRouting,
26
+ isPathForSurface,
27
+ resolveAppHref
28
+ };
@@ -1,5 +1,6 @@
1
1
  import { walletTypes, UserTypes } from "../constants/globalVariables.js";
2
- const websiteUrl = void 0;
2
+ import { AppSurface } from "../routing/app-routes.js";
3
+ import { resolveAppHref } from "../routing/resolve-app-href.js";
3
4
  const TASK_COPY = {
4
5
  country: {
5
6
  title: {
@@ -132,7 +133,7 @@ function generateCoreChecklistTasks(user) {
132
133
  const liquidWallets = wallets.filter((wallet2) => wallet2.type === walletTypes.LIQUID) || [];
133
134
  const hasWallet = liquidWallets.length > 0;
134
135
  const isEntity = user_type === UserTypes.investor_entity;
135
- const platformURL = `https://signup.${websiteUrl}`;
136
+ const signupBase = resolveAppHref(AppSurface.ONBOARDING, "");
136
137
  const countryStatus = !country ? "missing" : !isFromAllowedCountry ? "not_available" : "done";
137
138
  const countryTask = {
138
139
  key: "country",
@@ -140,7 +141,7 @@ function generateCoreChecklistTasks(user) {
140
141
  description: getCountryDescription(user, isFromAllowedCountry),
141
142
  iconState: countryStatus,
142
143
  iconCopy: TASK_COPY.country.iconCopy[countryStatus],
143
- link: `${platformURL}/country-of-residence`,
144
+ link: signupBase ? `${signupBase}/country-of-residence` : "",
144
145
  isClickable: countryStatus !== "done"
145
146
  };
146
147
  const verifyIdentityChecklist = getVerifyIdentityChecklist(isFromAllowedCountry, user, isEntity);
@@ -150,7 +151,7 @@ function generateCoreChecklistTasks(user) {
150
151
  description: verifyIdentityChecklist.message,
151
152
  iconState: verifyIdentityChecklist.state,
152
153
  iconCopy: TASK_COPY.identity.iconCopy[verifyIdentityChecklist.state],
153
- link: `${platformURL}/verify-identity`,
154
+ link: signupBase ? `${signupBase}/verify-identity` : "",
154
155
  isClickable: verifyIdentityChecklist.hasLink
155
156
  };
156
157
  const walletStatus = hasWallet ? "done" : "missing";
@@ -161,7 +162,7 @@ function generateCoreChecklistTasks(user) {
161
162
  description: walletDescription,
162
163
  iconState: walletStatus,
163
164
  iconCopy: TASK_COPY.wallet.iconCopy[walletStatus],
164
- link: `${platformURL}/register-liquid-securities`,
165
+ link: signupBase ? `${signupBase}/register-liquid-securities` : "",
165
166
  isClickable: isFromAllowedCountry && walletStatus !== "done"
166
167
  };
167
168
  const taxStatus = taxId ? "done" : "missing";
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import React__default, { useRef, useState, useEffect, useCallback } from "react";
2
+ import React__default, { useState, useRef, useCallback, useEffect } from "react";
3
3
  import { sizes } from "../styles/rwd.js";
4
4
  const useMobileView = (breakpoint = sizes.Medium) => {
5
5
  var breakpointNumber = breakpoint.match(/\d/g);
@@ -57,7 +57,8 @@ const getProjectCurrencySign = (tokenCurrency) => {
57
57
  const getCurrencyIcon = (currency, customIcon) => {
58
58
  if (customIcon) return customIcon;
59
59
  if (!currency) return null;
60
- switch (currency.toLowerCase()) {
60
+ const value = String(currency).toLowerCase();
61
+ switch (value) {
61
62
  case "btc":
62
63
  case "bitcoin":
63
64
  case "btc-fb":
@@ -1,4 +1,7 @@
1
- import { getConfig } from "../config.js";
1
+ import "../firebase-config.js";
2
+ import "../model/axios.js";
3
+ import "../model/axiosPublic.js";
4
+ import { getConfig } from "../runtime-config.js";
2
5
  const getCookieDomain = () => {
3
6
  const domain = getConfig("cookieDomain");
4
7
  const useDomain = domain && domain !== "localhost";
@@ -1,5 +1,8 @@
1
1
  import Cookies from "js-cookie";
2
- import { getConfig } from "../config.js";
2
+ import "../firebase-config.js";
3
+ import "../model/axios.js";
4
+ import "../model/axiosPublic.js";
5
+ import { getConfig } from "../runtime-config.js";
3
6
  const setRedirectCookie = (path = "") => {
4
7
  const inOneHour = 1 / 24;
5
8
  const cookieOptions = {
@@ -1,9 +1,11 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { useInRouterContext, useNavigate, useLocation } from "react-router-dom";
4
- const noopNavigate = () => {
5
- };
6
4
  const fallbackLocation = { pathname: "/", search: "", hash: "", state: null, key: "default" };
5
+ const NAVIGATE_OUTSIDE_ROUTER_MSG = "[@stokr/components-library] Navigation requires a React Router context. Wrap the app root with BrowserRouter, or with RouterWrapper from this package (it adds BrowserRouter only when useInRouterContext() is false so you avoid duplicate routers in a host app).";
6
+ function navigateOutsideRouter() {
7
+ throw new Error(NAVIGATE_OUTSIDE_ROUTER_MSG);
8
+ }
7
9
  const withRouter = (Component) => {
8
10
  const InnerWithRouter = (props) => {
9
11
  const navigate = useNavigate();
@@ -15,7 +17,7 @@ const withRouter = (Component) => {
15
17
  if (inRouter) {
16
18
  return /* @__PURE__ */ jsx(InnerWithRouter, { ...props });
17
19
  }
18
- return /* @__PURE__ */ jsx(Component, { navigate: noopNavigate, location: fallbackLocation, ...props });
20
+ return /* @__PURE__ */ jsx(Component, { navigate: navigateOutsideRouter, location: fallbackLocation, ...props });
19
21
  };
20
22
  return Wrapper;
21
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stokr/components-library",
3
- "version": "3.0.21",
3
+ "version": "3.0.23",
4
4
  "description": "STOKR - Components Library",
5
5
  "author": "Bilal Hodzic <bilal@stokr.io>",
6
6
  "license": "MIT",
package/dist/api/auth.js DELETED
@@ -1,15 +0,0 @@
1
- import axiosInstance from "../model/axios.js";
2
- const authAPI = async (url, data) => {
3
- try {
4
- const result = await axiosInstance.post(`auth/${url}`, data);
5
- console.log("Success!");
6
- return result;
7
- } catch (error) {
8
- console.log(`Error: ${error}`);
9
- throw error;
10
- }
11
- };
12
- export {
13
- authAPI,
14
- authAPI as default
15
- };