@stokr/components-library 3.0.25 → 3.0.27

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 (43) 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 +18 -19
  6. package/dist/components/MainMenu/MainMenu.js +6 -7
  7. package/dist/components/Modal/NewVentureModal/NewVentureModal.js +3 -3
  8. package/dist/components/StepsProgress/StepsProgress.js +1 -1
  9. package/dist/components/VerifyEmailModal/VerifyEmailModal.js +1 -1
  10. package/dist/components/headerHo/HeaderHo.js +5 -5
  11. package/dist/components/icons/LinkIcon.js +2 -2
  12. package/dist/constants/globalVariables.js +0 -6
  13. package/dist/context/AuthContext.js +55 -36
  14. package/dist/index.js +3 -21
  15. package/dist/routing/navigate-app.js +0 -12
  16. package/dist/runtime-config.js +10 -6
  17. package/dist/static/country-list.json +251 -251
  18. package/dist/static/fonts/Ionicons/ionicons.min.css +2810 -2810
  19. package/dist/static/fonts/Ionicons/ionicons.min.css.js +1 -1
  20. package/dist/static/fonts/icomoon/selection.json +910 -910
  21. package/dist/static/fonts/icomoon/style.css +139 -139
  22. package/dist/static/images/copy_icon.svg +4 -4
  23. package/dist/static/images/download_icon.svg +3 -3
  24. package/dist/static/images/numbers/number_eight.svg +3 -3
  25. package/dist/static/images/numbers/number_five.svg +4 -4
  26. package/dist/static/images/numbers/number_four.svg +3 -3
  27. package/dist/static/images/numbers/number_nine.svg +4 -4
  28. package/dist/static/images/numbers/number_one.svg +4 -4
  29. package/dist/static/images/numbers/number_seven.svg +4 -4
  30. package/dist/static/images/numbers/number_six.svg +4 -4
  31. package/dist/static/images/numbers/number_three.svg +3 -3
  32. package/dist/static/images/numbers/number_two.svg +4 -4
  33. package/dist/static/images/numbers/number_zero.svg +3 -3
  34. package/dist/static/images/plus-icon.svg +4 -4
  35. package/dist/static/images/search-icon.svg +3 -3
  36. package/dist/static/images/transfer-icon.svg +10 -10
  37. package/dist/static/images/warning-filled.svg +3 -3
  38. package/dist/utils/app-urls.js +8 -26
  39. package/dist/utils/checklistGenerator.js +2 -3
  40. package/dist/utils/customHooks.js +4 -4
  41. package/package.json +1 -1
  42. package/dist/routing/app-routes.js +0 -22
  43. package/dist/routing/resolve-app-href.js +0 -149
@@ -6,10 +6,8 @@ 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
12
  import { getFirebaseAuth } from "../firebase-config.js";
15
13
  import { Auth } from "./Auth.js";
@@ -17,6 +15,7 @@ import { DEFAULT_TOKEN_EXPIRY_MS } from "./Auth.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();
21
20
  const INACTIVITY_TIME_MS = 5 * 60 * 1e3;
22
21
  const INACTIVITY_EVENTS = ["mousemove", "keydown", "click", "scroll", "touchstart"];
@@ -44,7 +43,9 @@ class AuthProviderClass extends Component {
44
43
  verifyEmailError: null,
45
44
  isVerifyingEmail: false,
46
45
  loggedOutDueToInactivity: false,
47
- loggedOutDueToCookieExpiry: false
46
+ loggedOutDueToCookieExpiry: false,
47
+ /** When set, show session modal but keep session until user dismisses (avoids login + session modals at once). */
48
+ sessionExpiryPendingReason: null
48
49
  };
49
50
  componentDidMount() {
50
51
  if (this.props.config) {
@@ -121,12 +122,12 @@ class AuthProviderClass extends Component {
121
122
  if (!expiresAt) return;
122
123
  const delay = expiresAt - Date.now();
123
124
  if (delay <= 0) {
124
- this.logoutUser(false, { dueToCookieExpiry: true });
125
+ this.setState({ sessionExpiryPendingReason: "cookie" });
125
126
  return;
126
127
  }
127
128
  this.cookieExpiryTimerRef = setTimeout(() => {
128
129
  this.cookieExpiryTimerRef = null;
129
- this.logoutUser(false, { dueToCookieExpiry: true });
130
+ this.setState({ sessionExpiryPendingReason: "cookie" });
130
131
  }, delay);
131
132
  };
132
133
  getInactivityTimeMs = () => {
@@ -134,6 +135,7 @@ class AuthProviderClass extends Component {
134
135
  return typeof inactivityTimeMs === "number" && inactivityTimeMs > 0 ? inactivityTimeMs : INACTIVITY_TIME_MS;
135
136
  };
136
137
  resetInactivityTimer = () => {
138
+ if (this.state.sessionExpiryPendingReason) return;
137
139
  const now = Date.now();
138
140
  if (now - this._lastActivityAt < 1e3) return;
139
141
  this._lastActivityAt = now;
@@ -143,7 +145,7 @@ class AuthProviderClass extends Component {
143
145
  const delay = this.getInactivityTimeMs();
144
146
  this.inactivityTimerRef = setTimeout(() => {
145
147
  this.inactivityTimerRef = null;
146
- this.logoutUser(false, { dueToInactivity: true });
148
+ this.setState({ sessionExpiryPendingReason: "inactivity" });
147
149
  }, delay);
148
150
  }
149
151
  };
@@ -256,14 +258,16 @@ class AuthProviderClass extends Component {
256
258
  }
257
259
  };
258
260
  unenrollUser2FA = async () => {
259
- const { userMfaEnrollment, user } = this.state;
260
- if (userMfaEnrollment?.length === 0) {
261
+ const { userMfaEnrollment } = this.state;
262
+ if (!userMfaEnrollment || userMfaEnrollment.length === 0) {
261
263
  console.log("User is not enrolled in 2FA");
262
264
  return;
263
265
  }
266
+ const firebaseUser = this.state.firebaseUser || getFirebaseAuth()?.currentUser;
267
+ if (!firebaseUser) throw new Error("Firebase user not available for MFA unenroll.");
264
268
  try {
265
269
  for (let i = 0; i < userMfaEnrollment.length; i++) {
266
- await multiFactor(user).unenroll(userMfaEnrollment[i].uid);
270
+ await multiFactor(firebaseUser).unenroll(userMfaEnrollment[i].uid);
267
271
  }
268
272
  } catch (error) {
269
273
  console.log({ error });
@@ -287,15 +291,16 @@ class AuthProviderClass extends Component {
287
291
  this.clearInactivityTimer();
288
292
  try {
289
293
  const auth = getFirebaseAuth();
290
- if (auth) signOut(auth).then(() => {
294
+ if (auth) signOut(auth).catch(() => {
291
295
  });
292
296
  Auth.logout();
293
297
  } catch (_e) {
294
298
  }
295
299
  delete axiosInstance.defaults.headers.common.Authorization;
296
300
  reset();
297
- this.setUser(null);
301
+ this.userRef.current = null;
298
302
  this.setState({
303
+ user: null,
299
304
  firebaseUser: null,
300
305
  firebaseError: null,
301
306
  verifyEmailError: null,
@@ -304,11 +309,12 @@ class AuthProviderClass extends Component {
304
309
  isVerifyingEmail: false,
305
310
  avatar: avatarPlaceholder,
306
311
  isFetchingUser: false,
312
+ sessionExpiryPendingReason: null,
307
313
  loggedOutDueToInactivity: options.dueToInactivity === true,
308
314
  loggedOutDueToCookieExpiry: options.dueToCookieExpiry === true
309
315
  });
310
316
  if (redirect) {
311
- const home = resolveAppHref(AppSurface.INVESTOR_ROOT, "") || `https://${getConfig("websiteDomain")}`;
317
+ const home = getPlatformURL();
312
318
  navigateToHref(this.props.navigate, home);
313
319
  }
314
320
  };
@@ -318,6 +324,15 @@ class AuthProviderClass extends Component {
318
324
  clearLoggedOutDueToCookieExpiry = () => {
319
325
  this.setState({ loggedOutDueToCookieExpiry: false });
320
326
  };
327
+ /** Dismiss session modal: if expiry was deferred, perform logout; otherwise clear post-logout flags only. */
328
+ dismissSessionExpiryModal = () => {
329
+ if (this.state.sessionExpiryPendingReason) {
330
+ this.logoutUser(false, {});
331
+ return;
332
+ }
333
+ this.clearLoggedOutDueToInactivity();
334
+ this.clearLoggedOutDueToCookieExpiry();
335
+ };
321
336
  /** Call when user cancels the 2FA step (e.g. goes back to login to try another account). */
322
337
  reset2faFlow = () => {
323
338
  this.setState({ waitingFor2fa: false, firebaseError: null });
@@ -392,6 +407,7 @@ class AuthProviderClass extends Component {
392
407
  isFetchingUser: false
393
408
  });
394
409
  const code = error?.code;
410
+ const httpStatus = error?.response?.status;
395
411
  if (code === "auth/internal-error" || code === "auth/network-request-failed") {
396
412
  Auth.logout();
397
413
  if (typeof console !== "undefined" && console.warn) {
@@ -403,6 +419,16 @@ class AuthProviderClass extends Component {
403
419
  }
404
420
  return;
405
421
  }
422
+ if (httpStatus === 401 || httpStatus === 403) {
423
+ Auth.logout();
424
+ this.setState({ user: null, firebaseUser: null });
425
+ if (typeof console !== "undefined" && console.warn) {
426
+ console.warn(
427
+ "[@stokr/components-library] getUser() rejected by server (" + httpStatus + ") — stale session cleared."
428
+ );
429
+ }
430
+ return;
431
+ }
406
432
  console.log(`Error in getUser: ${error}`);
407
433
  throw error;
408
434
  }
@@ -411,10 +437,10 @@ class AuthProviderClass extends Component {
411
437
  if (!user) {
412
438
  throw new Error("User is not defined");
413
439
  } else if (!user?.emailVerified && !isAlreadyOnOnboardingFlow()) {
414
- navigateApp(this.props.navigate, AppSurface.ONBOARDING, AppRoute.RESEND_ACTIVATION);
440
+ navigateToHref(this.props.navigate, `${getConfig("onboardingUrl")}/resend-activation-email`);
415
441
  return false;
416
442
  } else if (!user?.country && user?.user_type === "investor" && !isAlreadyOnOnboardingFlow()) {
417
- navigateApp(this.props.navigate, AppSurface.ONBOARDING, AppRoute.WELCOME);
443
+ navigateToHref(this.props.navigate, `${getConfig("onboardingUrl")}/welcome`);
418
444
  return false;
419
445
  }
420
446
  return true;
@@ -713,27 +739,22 @@ class AuthProviderClass extends Component {
713
739
  refreshIdToken: Auth.refreshIdToken,
714
740
  clearLoggedOutDueToInactivity: this.clearLoggedOutDueToInactivity,
715
741
  clearLoggedOutDueToCookieExpiry: this.clearLoggedOutDueToCookieExpiry,
742
+ dismissSessionExpiryModal: this.dismissSessionExpiryModal,
716
743
  reset2faFlow: this.reset2faFlow
717
744
  },
718
745
  children: [
719
746
  children,
720
- (this.state.loggedOutDueToInactivity || this.state.loggedOutDueToCookieExpiry) && !this.props.hideInactivityModal && /* @__PURE__ */ jsx(
747
+ (this.state.loggedOutDueToInactivity || this.state.loggedOutDueToCookieExpiry || this.state.sessionExpiryPendingReason) && !this.props.hideInactivityModal && /* @__PURE__ */ jsx(
721
748
  ConfirmModalComponent,
722
749
  {
723
750
  isOpen: true,
724
751
  maxWidth: "600px",
725
752
  confirmText: "OK",
726
- onCancel: () => {
727
- this.clearLoggedOutDueToInactivity();
728
- this.clearLoggedOutDueToCookieExpiry();
729
- },
730
- onConfirm: () => {
731
- this.clearLoggedOutDueToInactivity();
732
- this.clearLoggedOutDueToCookieExpiry();
733
- },
753
+ onCancel: this.dismissSessionExpiryModal,
754
+ onConfirm: this.dismissSessionExpiryModal,
734
755
  showRedBar: true,
735
756
  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." }) })
757
+ 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
758
  }
738
759
  )
739
760
  ]
@@ -752,16 +773,14 @@ AuthProviderClass.propTypes = {
752
773
  cookieDomain: PropTypes.string,
753
774
  websiteDomain: PropTypes.string,
754
775
  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,
776
+ /** Full base URL for the onboarding / sign-up app (e.g. `'https://signup.stokr.io'` or `'https://stokr.io/signin'`). */
777
+ onboardingUrl: PropTypes.string,
778
+ /** Full base URL for the investor dashboard (e.g. `'https://dashboard.stokr.io'`). */
779
+ dashboardUrl: PropTypes.string,
780
+ /** Full base URL for the admin / venture dashboard (e.g. `'https://admin.stokr.io'`). */
781
+ adminUrl: PropTypes.string,
782
+ /** URL for the registration entry point (e.g. `'https://stokr.io/signup'`). */
783
+ registerUrl: PropTypes.string,
765
784
  firebase: PropTypes.shape({
766
785
  apiKey: PropTypes.string,
767
786
  authDomain: PropTypes.string,
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": "stokr.info", "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
  };