@stokr/components-library 3.0.26 → 3.0.28

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 (44) hide show
  1. package/README.md +33 -119
  2. package/dist/analytics/index.js +0 -1
  3. package/dist/components/2FA/login-with-otp-flow.js +4 -5
  4. package/dist/components/Footer/FooterLayout.js +1 -1
  5. package/dist/components/Header/Header.js +21 -21
  6. package/dist/components/MainMenu/MainMenu.js +7 -7
  7. package/dist/components/Modal/NewVentureModal/NewVentureModal.js +3 -3
  8. package/dist/components/VerifyEmailModal/VerifyEmailModal.js +1 -1
  9. package/dist/components/headerHo/HeaderHo.js +5 -5
  10. package/dist/components/icons/LinkIcon.js +2 -2
  11. package/dist/config.js +9 -4
  12. package/dist/constants/globalVariables.js +0 -6
  13. package/dist/context/AuthContext.js +91 -48
  14. package/dist/firebase-config.js +5 -4
  15. package/dist/index.js +3 -21
  16. package/dist/routing/navigate-app.js +0 -12
  17. package/dist/runtime-config.js +10 -6
  18. package/dist/static/country-list.json +251 -251
  19. package/dist/static/fonts/Ionicons/ionicons.min.css +2810 -2810
  20. package/dist/static/fonts/Ionicons/ionicons.min.css.js +1 -1
  21. package/dist/static/fonts/icomoon/selection.json +910 -910
  22. package/dist/static/fonts/icomoon/style.css +139 -139
  23. package/dist/static/images/copy_icon.svg +4 -4
  24. package/dist/static/images/download_icon.svg +3 -3
  25. package/dist/static/images/numbers/number_eight.svg +3 -3
  26. package/dist/static/images/numbers/number_five.svg +4 -4
  27. package/dist/static/images/numbers/number_four.svg +3 -3
  28. package/dist/static/images/numbers/number_nine.svg +4 -4
  29. package/dist/static/images/numbers/number_one.svg +4 -4
  30. package/dist/static/images/numbers/number_seven.svg +4 -4
  31. package/dist/static/images/numbers/number_six.svg +4 -4
  32. package/dist/static/images/numbers/number_three.svg +3 -3
  33. package/dist/static/images/numbers/number_two.svg +4 -4
  34. package/dist/static/images/numbers/number_zero.svg +3 -3
  35. package/dist/static/images/plus-icon.svg +4 -4
  36. package/dist/static/images/search-icon.svg +3 -3
  37. package/dist/static/images/transfer-icon.svg +10 -10
  38. package/dist/static/images/warning-filled.svg +3 -3
  39. package/dist/utils/app-urls.js +8 -26
  40. package/dist/utils/checklistGenerator.js +2 -3
  41. package/dist/utils/user-identity.js +7 -0
  42. package/package.json +1 -1
  43. package/dist/routing/app-routes.js +0 -22
  44. package/dist/routing/resolve-app-href.js +0 -149
@@ -6,18 +6,18 @@ import fetchData from "../api/fetchData.js";
6
6
  import { identify, reset } from "../analytics/index.js";
7
7
  import { withRouter } from "../utils/withRouter.js";
8
8
  import { configure } from "../config.js";
9
- import { AppSurface, AppRoute } from "../routing/app-routes.js";
10
- import { resolveAppHref, isAlreadyOnOnboardingFlow } from "../routing/resolve-app-href.js";
11
- import { navigateToHref, navigateApp } from "../routing/navigate-app.js";
12
- import { getConfig } from "../runtime-config.js";
9
+ import { getPlatformURL, getConfig } from "../runtime-config.js";
10
+ import { isAlreadyOnOnboardingFlow } from "../utils/app-urls.js";
13
11
  import { Text } from "../components/Text/Text.styles.js";
14
- import { getFirebaseAuth } from "../firebase-config.js";
15
12
  import { Auth } from "./Auth.js";
16
13
  import { DEFAULT_TOKEN_EXPIRY_MS } from "./Auth.js";
14
+ import { getFirebaseAuth, isValidFirebaseConfig } from "../firebase-config.js";
17
15
  import { ConfirmModal as ConfirmModalComponent } from "../components/ConfirmModal/ConfirmModal.js";
18
16
  import avatarPlaceholder from "../static/images/avatar-placeholder.png.js";
19
17
  import { signOut, getMultiFactorResolver, PhoneMultiFactorGenerator, TotpMultiFactorGenerator, multiFactor } from "firebase/auth";
18
+ import { navigateToHref } from "../routing/navigate-app.js";
20
19
  const AuthContext = React__default.createContext();
20
+ const FALLBACK_AUTH_CONTEXT_VALUE = { user: null, isFetchingUser: false };
21
21
  const INACTIVITY_TIME_MS = 5 * 60 * 1e3;
22
22
  const INACTIVITY_EVENTS = ["mousemove", "keydown", "click", "scroll", "touchstart"];
23
23
  class AuthProviderClass extends Component {
@@ -44,7 +44,9 @@ class AuthProviderClass extends Component {
44
44
  verifyEmailError: null,
45
45
  isVerifyingEmail: false,
46
46
  loggedOutDueToInactivity: false,
47
- loggedOutDueToCookieExpiry: false
47
+ loggedOutDueToCookieExpiry: false,
48
+ /** When set, show session modal but keep session until user dismisses (avoids login + session modals at once). */
49
+ sessionExpiryPendingReason: null
48
50
  };
49
51
  componentDidMount() {
50
52
  if (this.props.config) {
@@ -121,12 +123,12 @@ class AuthProviderClass extends Component {
121
123
  if (!expiresAt) return;
122
124
  const delay = expiresAt - Date.now();
123
125
  if (delay <= 0) {
124
- this.logoutUser(false, { dueToCookieExpiry: true });
126
+ this.setState({ sessionExpiryPendingReason: "cookie" });
125
127
  return;
126
128
  }
127
129
  this.cookieExpiryTimerRef = setTimeout(() => {
128
130
  this.cookieExpiryTimerRef = null;
129
- this.logoutUser(false, { dueToCookieExpiry: true });
131
+ this.setState({ sessionExpiryPendingReason: "cookie" });
130
132
  }, delay);
131
133
  };
132
134
  getInactivityTimeMs = () => {
@@ -134,6 +136,7 @@ class AuthProviderClass extends Component {
134
136
  return typeof inactivityTimeMs === "number" && inactivityTimeMs > 0 ? inactivityTimeMs : INACTIVITY_TIME_MS;
135
137
  };
136
138
  resetInactivityTimer = () => {
139
+ if (this.state.sessionExpiryPendingReason) return;
137
140
  const now = Date.now();
138
141
  if (now - this._lastActivityAt < 1e3) return;
139
142
  this._lastActivityAt = now;
@@ -143,7 +146,7 @@ class AuthProviderClass extends Component {
143
146
  const delay = this.getInactivityTimeMs();
144
147
  this.inactivityTimerRef = setTimeout(() => {
145
148
  this.inactivityTimerRef = null;
146
- this.logoutUser(false, { dueToInactivity: true });
149
+ this.setState({ sessionExpiryPendingReason: "inactivity" });
147
150
  }, delay);
148
151
  }
149
152
  };
@@ -256,14 +259,16 @@ class AuthProviderClass extends Component {
256
259
  }
257
260
  };
258
261
  unenrollUser2FA = async () => {
259
- const { userMfaEnrollment, user } = this.state;
260
- if (userMfaEnrollment?.length === 0) {
262
+ const { userMfaEnrollment } = this.state;
263
+ if (!userMfaEnrollment || userMfaEnrollment.length === 0) {
261
264
  console.log("User is not enrolled in 2FA");
262
265
  return;
263
266
  }
267
+ const firebaseUser = this.state.firebaseUser || getFirebaseAuth()?.currentUser;
268
+ if (!firebaseUser) throw new Error("Firebase user not available for MFA unenroll.");
264
269
  try {
265
270
  for (let i = 0; i < userMfaEnrollment.length; i++) {
266
- await multiFactor(user).unenroll(userMfaEnrollment[i].uid);
271
+ await multiFactor(firebaseUser).unenroll(userMfaEnrollment[i].uid);
267
272
  }
268
273
  } catch (error) {
269
274
  console.log({ error });
@@ -287,15 +292,16 @@ class AuthProviderClass extends Component {
287
292
  this.clearInactivityTimer();
288
293
  try {
289
294
  const auth = getFirebaseAuth();
290
- if (auth) signOut(auth).then(() => {
295
+ if (auth) signOut(auth).catch(() => {
291
296
  });
292
297
  Auth.logout();
293
298
  } catch (_e) {
294
299
  }
295
300
  delete axiosInstance.defaults.headers.common.Authorization;
296
301
  reset();
297
- this.setUser(null);
302
+ this.userRef.current = null;
298
303
  this.setState({
304
+ user: null,
299
305
  firebaseUser: null,
300
306
  firebaseError: null,
301
307
  verifyEmailError: null,
@@ -304,11 +310,12 @@ class AuthProviderClass extends Component {
304
310
  isVerifyingEmail: false,
305
311
  avatar: avatarPlaceholder,
306
312
  isFetchingUser: false,
313
+ sessionExpiryPendingReason: null,
307
314
  loggedOutDueToInactivity: options.dueToInactivity === true,
308
315
  loggedOutDueToCookieExpiry: options.dueToCookieExpiry === true
309
316
  });
310
317
  if (redirect) {
311
- const home = resolveAppHref(AppSurface.INVESTOR_ROOT, "") || `https://${getConfig("websiteDomain")}`;
318
+ const home = getPlatformURL();
312
319
  navigateToHref(this.props.navigate, home);
313
320
  }
314
321
  };
@@ -318,12 +325,24 @@ class AuthProviderClass extends Component {
318
325
  clearLoggedOutDueToCookieExpiry = () => {
319
326
  this.setState({ loggedOutDueToCookieExpiry: false });
320
327
  };
328
+ /** Dismiss session modal: if expiry was deferred, perform logout; otherwise clear post-logout flags only. */
329
+ dismissSessionExpiryModal = () => {
330
+ if (this.state.sessionExpiryPendingReason) {
331
+ this.logoutUser(false, {});
332
+ return;
333
+ }
334
+ this.clearLoggedOutDueToInactivity();
335
+ this.clearLoggedOutDueToCookieExpiry();
336
+ };
321
337
  /** Call when user cancels the 2FA step (e.g. goes back to login to try another account). */
322
338
  reset2faFlow = () => {
323
339
  this.setState({ waitingFor2fa: false, firebaseError: null });
324
340
  };
325
341
  patchUserObject = (user, firebaseUser) => {
326
- if (!user || !firebaseUser) return;
342
+ if (!user) return;
343
+ if (!firebaseUser) {
344
+ return { ...user, active: !!user.emailVerified };
345
+ }
327
346
  const merged = Object.assign(Object.create(Object.getPrototypeOf(firebaseUser)), firebaseUser, user);
328
347
  merged.active = merged.emailVerified;
329
348
  return merged;
@@ -349,11 +368,6 @@ class AuthProviderClass extends Component {
349
368
  user: null,
350
369
  firebaseUser: null
351
370
  });
352
- if (typeof console !== "undefined" && console.debug) {
353
- console.debug(
354
- "[@stokr/components-library] getUser() skipped: no access token. If you expected a session, ensure config.cookieDomain matches this origin (e.g. omit or use empty for localhost)."
355
- );
356
- }
357
371
  return;
358
372
  }
359
373
  this.setState({
@@ -370,7 +384,20 @@ class AuthProviderClass extends Component {
370
384
  let firebaseUser = existingFirebaseUser;
371
385
  if (!firebaseUser) {
372
386
  const customToken = tokenRes?.customToken ?? tokenRes?.custom_token ?? tokenRes?.token ?? tokenRes;
373
- firebaseUser = await Auth.signInWithToken(customToken);
387
+ try {
388
+ firebaseUser = await Auth.signInWithToken(customToken);
389
+ } catch (firebaseErr) {
390
+ const fbCode = firebaseErr?.code;
391
+ if (fbCode === "auth/internal-error" || fbCode === "auth/network-request-failed") {
392
+ if (typeof console !== "undefined" && console.warn) {
393
+ console.warn(
394
+ "[@stokr/components-library] Firebase signIn failed (" + fbCode + ") — session preserved. Add this domain to Firebase Console → Authentication → Authorized domains."
395
+ );
396
+ }
397
+ } else {
398
+ throw firebaseErr;
399
+ }
400
+ }
374
401
  }
375
402
  const user = this.patchUserObject(result.user, firebaseUser);
376
403
  this.checkUserIsValid(user);
@@ -392,13 +419,21 @@ class AuthProviderClass extends Component {
392
419
  isFetchingUser: false
393
420
  });
394
421
  const code = error?.code;
422
+ const httpStatus = error?.response?.status;
395
423
  if (code === "auth/internal-error" || code === "auth/network-request-failed") {
424
+ if (typeof console !== "undefined" && console.warn) {
425
+ console.warn(
426
+ "[@stokr/components-library] getUser() encountered Firebase error (" + code + "). Ensure AuthProvider receives config.firebase and the domain is in Firebase Console → Authorized domains."
427
+ );
428
+ }
429
+ return;
430
+ }
431
+ if (httpStatus === 401 || httpStatus === 403) {
396
432
  Auth.logout();
433
+ this.setState({ user: null, firebaseUser: null });
397
434
  if (typeof console !== "undefined" && console.warn) {
398
435
  console.warn(
399
- "[@stokr/components-library] getUser() failed with",
400
- code,
401
- "— session cleared. Ensure AuthProvider receives config.firebase for this origin and that the domain is authorized in Firebase Console (Authentication → Settings → Authorized domains)."
436
+ "[@stokr/components-library] getUser() rejected by server (" + httpStatus + ") — stale session cleared."
402
437
  );
403
438
  }
404
439
  return;
@@ -411,10 +446,10 @@ class AuthProviderClass extends Component {
411
446
  if (!user) {
412
447
  throw new Error("User is not defined");
413
448
  } else if (!user?.emailVerified && !isAlreadyOnOnboardingFlow()) {
414
- navigateApp(this.props.navigate, AppSurface.ONBOARDING, AppRoute.RESEND_ACTIVATION);
449
+ navigateToHref(this.props.navigate, `${getConfig("onboardingUrl")}/resend-activation-email`);
415
450
  return false;
416
451
  } else if (!user?.country && user?.user_type === "investor" && !isAlreadyOnOnboardingFlow()) {
417
- navigateApp(this.props.navigate, AppSurface.ONBOARDING, AppRoute.WELCOME);
452
+ navigateToHref(this.props.navigate, `${getConfig("onboardingUrl")}/welcome`);
418
453
  return false;
419
454
  }
420
455
  return true;
@@ -713,27 +748,22 @@ class AuthProviderClass extends Component {
713
748
  refreshIdToken: Auth.refreshIdToken,
714
749
  clearLoggedOutDueToInactivity: this.clearLoggedOutDueToInactivity,
715
750
  clearLoggedOutDueToCookieExpiry: this.clearLoggedOutDueToCookieExpiry,
751
+ dismissSessionExpiryModal: this.dismissSessionExpiryModal,
716
752
  reset2faFlow: this.reset2faFlow
717
753
  },
718
754
  children: [
719
755
  children,
720
- (this.state.loggedOutDueToInactivity || this.state.loggedOutDueToCookieExpiry) && !this.props.hideInactivityModal && /* @__PURE__ */ jsx(
756
+ (this.state.loggedOutDueToInactivity || this.state.loggedOutDueToCookieExpiry || this.state.sessionExpiryPendingReason) && !this.props.hideInactivityModal && /* @__PURE__ */ jsx(
721
757
  ConfirmModalComponent,
722
758
  {
723
759
  isOpen: true,
724
760
  maxWidth: "600px",
725
761
  confirmText: "OK",
726
- onCancel: () => {
727
- this.clearLoggedOutDueToInactivity();
728
- this.clearLoggedOutDueToCookieExpiry();
729
- },
730
- onConfirm: () => {
731
- this.clearLoggedOutDueToInactivity();
732
- this.clearLoggedOutDueToCookieExpiry();
733
- },
762
+ onCancel: this.dismissSessionExpiryModal,
763
+ onConfirm: this.dismissSessionExpiryModal,
734
764
  showRedBar: true,
735
765
  title: "Session expired",
736
- content: /* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsx("p", { style: { fontSize: 16 }, children: this.state.loggedOutDueToInactivity ? "You have been logged out due to inactivity." : "Your session has expired. Please log in again." }) })
766
+ content: /* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsx("p", { style: { fontSize: 16 }, children: this.state.sessionExpiryPendingReason === "inactivity" || this.state.loggedOutDueToInactivity ? "You have been logged out due to inactivity." : "Your session has expired. Please log in again." }) })
737
767
  }
738
768
  )
739
769
  ]
@@ -752,16 +782,14 @@ AuthProviderClass.propTypes = {
752
782
  cookieDomain: PropTypes.string,
753
783
  websiteDomain: PropTypes.string,
754
784
  photoApiUrl: PropTypes.string,
755
- /** Set to `'path'` for single-origin URLs (`/dashboard`, `/admin`, …). Omit for legacy `*.websiteDomain` subdomains. */
756
- routingMode: PropTypes.oneOf(["path"]),
757
- /** Path mode only: override first path segments (e.g. `{ onboarding: '/signup', dashboard: '/app/dashboard' }`). */
758
- appUrlPaths: PropTypes.object,
759
- /**
760
- * Optional per-surface URL style for incremental cutover. Keys: `onboarding`, `dashboard`, `admin`, `registerEntry`, `investorRoot`.
761
- * Each value: `'path'` (same-origin prefix from `appUrlPaths`) or `'subdomain'` (legacy `https://{sub}.{websiteDomain}`).
762
- * Omitted keys follow global `routingMode` (`path` vs default subdomain).
763
- */
764
- surfaceRoutingMode: PropTypes.object,
785
+ /** Full base URL for the onboarding / sign-up app (e.g. `'https://signup.stokr.io'` or `'https://stokr.io/signin'`). */
786
+ onboardingUrl: PropTypes.string,
787
+ /** Full base URL for the investor dashboard (e.g. `'https://dashboard.stokr.io'`). */
788
+ dashboardUrl: PropTypes.string,
789
+ /** Full base URL for the admin / venture dashboard (e.g. `'https://admin.stokr.io'`). */
790
+ adminUrl: PropTypes.string,
791
+ /** URL for the registration entry point (e.g. `'https://stokr.io/signup'`). */
792
+ registerUrl: PropTypes.string,
765
793
  firebase: PropTypes.shape({
766
794
  apiKey: PropTypes.string,
767
795
  authDomain: PropTypes.string,
@@ -779,8 +807,23 @@ AuthProviderClass.propTypes = {
779
807
  /** Override access token cookie lifetime in ms (e.g. for Storybook). Production uses 1 hour. */
780
808
  accessTokenExpiryMs: PropTypes.number
781
809
  };
810
+ function resolveFirebaseConfigForGuard(props) {
811
+ if (props.config?.firebase != null) return props.config.firebase;
812
+ return getConfig("firebase");
813
+ }
814
+ function AuthProviderGuard(props) {
815
+ if (props.config) {
816
+ configure(props.config);
817
+ }
818
+ const firebase = resolveFirebaseConfigForGuard(props);
819
+ if (!isValidFirebaseConfig(firebase)) {
820
+ return /* @__PURE__ */ jsx(AuthContext.Provider, { value: FALLBACK_AUTH_CONTEXT_VALUE, children: props.children });
821
+ }
822
+ return /* @__PURE__ */ jsx(AuthProviderClass, { ...props });
823
+ }
824
+ AuthProviderGuard.propTypes = AuthProviderClass.propTypes;
782
825
  const AuthConsumer = AuthContext.Consumer;
783
- const AuthProvider = withRouter(AuthProviderClass);
826
+ const AuthProvider = withRouter(AuthProviderGuard);
784
827
  export {
785
828
  AuthConsumer,
786
829
  AuthContext,
@@ -4,7 +4,7 @@ import { getConfig } from "./runtime-config.js";
4
4
  const __vite_import_meta_env__ = {};
5
5
  let app = null;
6
6
  let auth = null;
7
- function isValidConfig(config) {
7
+ function isValidFirebaseConfig(config) {
8
8
  return config?.apiKey != null && String(config.apiKey).trim() !== "";
9
9
  }
10
10
  function getFirebaseAuth() {
@@ -12,7 +12,7 @@ function getFirebaseAuth() {
12
12
  }
13
13
  function initFirebase(configOverride) {
14
14
  const firebaseConfig = configOverride != null ? configOverride : getConfig("firebase");
15
- if (!isValidConfig(firebaseConfig)) {
15
+ if (!isValidFirebaseConfig(firebaseConfig)) {
16
16
  if (configOverride && typeof console !== "undefined" && console.warn) {
17
17
  console.warn(
18
18
  "[firebase-config] initFirebase() received a config with no valid apiKey. Ensure all VITE_FIREBASE_* variables are defined in your .env file and the dev server was restarted."
@@ -49,11 +49,12 @@ function initFirebase(configOverride) {
49
49
  }
50
50
  }
51
51
  }
52
- if (typeof __vite_import_meta_env__ !== "undefined" && isValidConfig(getConfig("firebase"))) {
52
+ if (typeof __vite_import_meta_env__ !== "undefined" && isValidFirebaseConfig(getConfig("firebase"))) {
53
53
  initFirebase();
54
54
  }
55
55
  export {
56
56
  auth,
57
57
  getFirebaseAuth,
58
- initFirebase
58
+ initFirebase,
59
+ isValidFirebaseConfig
59
60
  };
package/dist/index.js CHANGED
@@ -193,11 +193,9 @@ import { ScrollToTop, scrollToElement, useScrollActions } from "./utils/scrollUt
193
193
  import { useTimer } from "./hooks/useTimer.js";
194
194
  import { useTransactionPolling } from "./hooks/useTransactionPolling.js";
195
195
  import { configure } from "./config.js";
196
- import { AppRoute, AppSurface } from "./routing/app-routes.js";
197
- import { SURFACE_ROUTING_PATH_KEYS, getAppPublicOrigin, isAlreadyOnOnboardingFlow, isPathBasedRouting, isPathForSurface, resolveAppHref } from "./routing/resolve-app-href.js";
198
- import { navigateApp, navigateToHref, pathnameIfSameOrigin } from "./routing/navigate-app.js";
196
+ import { navigateToHref, pathnameIfSameOrigin } from "./routing/navigate-app.js";
199
197
  import { RouterWrapper } from "./routing/RouterWrapper.js";
200
- import { buildDashboardUrl, buildOnboardingUrl, getAdminAppUrl, getDashboardBaseUrl, getInvestorAppOrigin, getOnboardingAppBaseUrl, getRegisterEntryUrl } from "./utils/app-urls.js";
198
+ import { isAlreadyOnOnboardingFlow } from "./utils/app-urls.js";
201
199
  import { authenticationApi } from "./api/authenticationApi.js";
202
200
  import { default as default39 } from "./components/2FA/Connect2FA.js";
203
201
  import { default as default40 } from "./components/2FA/enable-2fa-flow.js";
@@ -220,7 +218,7 @@ import { default as default51 } from "./styles/semanticUi.js";
220
218
  import { default as default52 } from "./styles/spacing.js";
221
219
  import { default as default53 } from "./styles/theme.js";
222
220
  import { BASE_COLOR_HEX, BASE_FONT_SIZE, BASE_MARGIN, BASE_MARGIN_2X_PX, BASE_MARGIN_PX, BLUE_BASE_HEX, BLUE_BASE_RELEASED_HEX, CAPITAL_ANIMATION_LENGTH, COLUMN, DESKTOP_MEDIA, GRAY_BASE_HEX, GRAY_DEEP_HEX, GRAY_SECONDARY_HEX, GREEN, MAX_WIDTH, PHONE_MEDIA, RED_BASE_HEX, RED_BASE_RELEASE_HEX, SLIDER_HEIGHT, SLIDER_MOBILE_HEIGHT, SLIDER_TABLET_HEIGHT, TABLET_MEDIA, WHITE_HEX } from "./constants/style.js";
223
- import { LoanActivityTypes, ProfessionalInvestorStatuses, ProjectStates, ProjectStatus, ProjectTypes, TransactionTypes, USInvestorAcreditationStatuses, UserTypes, emailRegex, getPlatformURL, transactionTypeDisplayNames, walletTypes } from "./constants/globalVariables.js";
221
+ import { LoanActivityTypes, ProfessionalInvestorStatuses, ProjectStates, ProjectStatus, ProjectTypes, TransactionTypes, USInvestorAcreditationStatuses, UserTypes, emailRegex, transactionTypeDisplayNames, walletTypes } from "./constants/globalVariables.js";
224
222
  import { BackButtonIcon, StyledBackButton, StyledBackButtonExternal, StyledWindowBackButton } from "./components/BackButton/BackButton.styles.js";
225
223
  import { ContainerWithLine } from "./components/RegisterConfirmModal/RegisterConfirmModal.styles.js";
226
224
  import { CopyToClipboard } from "react-copy-to-clipboard";
@@ -245,8 +243,6 @@ export {
245
243
  AgreementItem,
246
244
  AnimatedSpan,
247
245
  AnnouncementTitleMain,
248
- AppRoute,
249
- AppSurface,
250
246
  Arrow,
251
247
  ArrowSimple,
252
248
  Auth,
@@ -477,7 +473,6 @@ export {
477
473
  SLIDER_HEIGHT,
478
474
  SLIDER_MOBILE_HEIGHT,
479
475
  SLIDER_TABLET_HEIGHT,
480
- SURFACE_ROUTING_PATH_KEYS,
481
476
  Scroll,
482
477
  ScrollToTop,
483
478
  SearchInput,
@@ -582,8 +577,6 @@ export {
582
577
  Youtube,
583
578
  alias,
584
579
  authenticationApi,
585
- buildDashboardUrl,
586
- buildOnboardingUrl,
587
580
  checkSaleTimeLeft,
588
581
  checkTodoStatus,
589
582
  colors,
@@ -597,23 +590,16 @@ export {
597
590
  format,
598
591
  formatCurrencyValue,
599
592
  generateCoreChecklistTasks,
600
- getAdminAppUrl,
601
593
  getAmountBucket,
602
594
  getAnalyticsIngestUrl,
603
- getAppPublicOrigin,
604
595
  getBackofficeAppUrl,
605
596
  getConfig,
606
597
  getCurrencyIcon,
607
598
  getCurrencySymbol,
608
- getDashboardBaseUrl,
609
599
  getFooterGroups,
610
- getInvestorAppOrigin,
611
600
  getLiquidAssetIcon,
612
601
  getMedia,
613
- getOnboardingAppBaseUrl,
614
- getPlatformURL,
615
602
  getProjectCurrencySign,
616
- getRegisterEntryUrl,
617
603
  getTokenBucket,
618
604
  getVerifyIdentityChecklist,
619
605
  default48 as grid,
@@ -622,15 +608,12 @@ export {
622
608
  identify,
623
609
  initAnalytics,
624
610
  isAlreadyOnOnboardingFlow,
625
- isPathBasedRouting,
626
- isPathForSurface,
627
611
  isUSInvestor,
628
612
  km_ify,
629
613
  learnMoreCategoryPropTypes,
630
614
  learnMorePostPropTypes,
631
615
  loaderGif,
632
616
  momentUtils,
633
- navigateApp,
634
617
  navigateToHref,
635
618
  openFile,
636
619
  optIn,
@@ -639,7 +622,6 @@ export {
639
622
  default49 as reactTippyStyle,
640
623
  reset,
641
624
  resetRuntimeConfig,
642
- resolveAppHref,
643
625
  default50 as rwd,
644
626
  rwdMax,
645
627
  saveAs,
@@ -1,4 +1,3 @@
1
- import { resolveAppHref } from "./resolve-app-href.js";
2
1
  function pathnameIfSameOrigin(absoluteHref) {
3
2
  if (typeof window === "undefined" || !absoluteHref) return null;
4
3
  try {
@@ -10,16 +9,6 @@ function pathnameIfSameOrigin(absoluteHref) {
10
9
  }
11
10
  return null;
12
11
  }
13
- function navigateApp(navigate, surface, relativePath = "") {
14
- const href = resolveAppHref(surface, relativePath);
15
- if (!href) return;
16
- const internal = pathnameIfSameOrigin(href);
17
- if (internal != null && typeof navigate === "function") {
18
- navigate(internal);
19
- return;
20
- }
21
- window.location.assign(href);
22
- }
23
12
  function navigateToHref(navigate, href) {
24
13
  if (!href) return;
25
14
  const internal = pathnameIfSameOrigin(href);
@@ -30,7 +19,6 @@ function navigateToHref(navigate, href) {
30
19
  window.location.assign(href);
31
20
  }
32
21
  export {
33
- navigateApp,
34
22
  navigateToHref,
35
23
  pathnameIfSameOrigin
36
24
  };
@@ -1,4 +1,4 @@
1
- const __vite_import_meta_env__ = { "BASE_URL": "/", "DEV": false, "MODE": "production", "PROD": true, "SSR": false };
1
+ const __vite_import_meta_env__ = { "BASE_URL": "/", "DEV": false, "MODE": "production", "PROD": true, "SSR": false, "VITE_ADMIN_URL": "https://admin.stokr.info", "VITE_API_URL": "https://platform-api.stokr.info/api/v1", "VITE_BASE_URL_PUBLIC": "https://platform-api-no-auth.stokr.info/api/v1", "VITE_COOKIE_DOMAIN": "localhost", "VITE_DASHBOARD_URL": "https://dashboard.stokr.info", "VITE_FIREBASE_API_KEY": "AIzaSyBBp_3Romnfv--YpUuV0mJgDymvSp3oq0c", "VITE_FIREBASE_APP_ID": "1:568229412804:web:2391857e3e2a0b02346e91", "VITE_FIREBASE_AUTH_DOMAIN": "stokr-development-env.firebaseapp.com", "VITE_FIREBASE_MEASUREMENT_ID": "G-CP53SZVSMN", "VITE_FIREBASE_MESSAGING_SENDER_ID": "568229412804", "VITE_FIREBASE_PROJECT_ID": "stokr-development-env", "VITE_FIREBASE_STORAGE_BUCKET": "stokr-development-env.appspot.com", "VITE_MIXPANEL_TOKEN": "a7bb1e881f9b2600762fded84d8ce0ea", "VITE_ONBOARDING_URL": "https://signup.stokr.info", "VITE_PHOTO_API_URL": "https://platform-api.stokr.info/api/v1", "VITE_REGISTER_URL": "https://stokr.info/signup", "VITE_WEBSITE_DOMAIN": "stokr.info" };
2
2
  const _overrides = {};
3
3
  const ENV_KEY_BY_CONFIG = {
4
4
  apiUrl: "VITE_API_URL",
@@ -6,8 +6,10 @@ const ENV_KEY_BY_CONFIG = {
6
6
  cookieDomain: "VITE_COOKIE_DOMAIN",
7
7
  websiteDomain: "VITE_WEBSITE_DOMAIN",
8
8
  photoApiUrl: "VITE_PHOTO_API_URL",
9
- /** `'path'` = single-origin URLs (`https://DOMAIN/dashboard`, …). Anything else = legacy subdomains (`dashboard.`, `signup.`, …). */
10
- routingMode: "VITE_ROUTING_MODE"
9
+ onboardingUrl: "VITE_ONBOARDING_URL",
10
+ dashboardUrl: "VITE_DASHBOARD_URL",
11
+ adminUrl: "VITE_ADMIN_URL",
12
+ registerUrl: "VITE_REGISTER_URL"
11
13
  };
12
14
  const FIREBASE_ENV_VARS = [
13
15
  "VITE_FIREBASE_API_KEY",
@@ -77,18 +79,20 @@ function getConfig(key) {
77
79
  if (key === "firebase") {
78
80
  return _overrides.firebase ?? buildFirebaseConfigFromEnv();
79
81
  }
80
- if (key === "appUrlPaths") {
81
- return _overrides.appUrlPaths;
82
- }
83
82
  const envName = ENV_KEY_BY_CONFIG[key];
84
83
  if (envName) {
85
84
  return _overrides[key] ?? env(envName);
86
85
  }
87
86
  return _overrides[key];
88
87
  }
88
+ function getPlatformURL() {
89
+ const domain = getConfig("websiteDomain");
90
+ return domain ? `https://${domain}` : "";
91
+ }
89
92
  export {
90
93
  assignRuntimeConfig,
91
94
  getConfig,
92
95
  getMissingRuntimeEnvVarNames,
96
+ getPlatformURL,
93
97
  resetRuntimeConfig
94
98
  };