@stokr/components-library 3.0.20 → 3.0.22
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/README.md +217 -11
- package/dist/analytics/index.js +8 -1
- package/dist/api/authenticationApi.js +13 -0
- package/dist/auth/index.js +4 -2
- package/dist/components/2FA/login-with-otp-flow.js +9 -4
- package/dist/components/Footer/FooterLayout.js +98 -95
- package/dist/components/Footer/FooterMenu.js +1 -1
- package/dist/components/Header/Header.js +102 -54
- package/dist/components/MainMenu/MainMenu.js +14 -4
- package/dist/components/Modal/NewVentureModal/NewVentureModal.js +6 -2
- package/dist/components/Payment/PaymentDetailsCard.js +1 -1
- package/dist/components/VerifyEmailModal/VerifyEmailModal.js +2 -1
- package/dist/components/headerHo/HeaderHo.js +8 -5
- package/dist/config.js +5 -21
- package/dist/constants/globalVariables.js +6 -4
- package/dist/context/Auth.js +5 -2
- package/dist/context/AuthContext.js +22 -8
- package/dist/firebase-config.js +3 -17
- package/dist/index.js +36 -5
- package/dist/model/axios.js +4 -3
- package/dist/model/axiosPublic.js +2 -2
- package/dist/routing/RouterWrapper.js +17 -0
- package/dist/routing/app-routes.js +22 -0
- package/dist/routing/navigate-app.js +36 -0
- package/dist/routing/resolve-app-href.js +149 -0
- package/dist/runtime-config.js +94 -0
- package/dist/utils/app-urls-analytics-backoffice.js +30 -0
- package/dist/utils/app-urls.js +28 -0
- package/dist/utils/checklistGenerator.js +6 -5
- package/dist/utils/customHooks.js +1 -1
- package/dist/utils/formatCurrencyValue.js +2 -1
- package/dist/utils/get-cookie-domain.js +4 -1
- package/dist/utils/set-redirect-cookie.js +4 -1
- package/dist/utils/withRouter.js +5 -3
- package/package.json +1 -1
- package/dist/api/auth.js +0 -15
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@ React component library for STOKR applications. Includes modals, forms, buttons,
|
|
|
8
8
|
- [How to start](#how-to-start)
|
|
9
9
|
- [Configuration](#configuration)
|
|
10
10
|
- [Runtime config (npm consumers)](#runtime-config)
|
|
11
|
+
- [Path-based URLs vs subdomains](#path-based-urls-vs-subdomains)
|
|
12
|
+
- [Reading config with `getConfig()`](#reading-config-with-getconfig)
|
|
11
13
|
- [Ionicons](#ionicons)
|
|
12
14
|
- [React Router](#react-router)
|
|
13
15
|
- [Troubleshooting](#troubleshooting)
|
|
@@ -33,6 +35,19 @@ npm install react react-dom styled-components react-router-dom
|
|
|
33
35
|
|
|
34
36
|
---
|
|
35
37
|
|
|
38
|
+
## Implementing in your app
|
|
39
|
+
|
|
40
|
+
Minimal path to use the library in a **Vite + React** consumer:
|
|
41
|
+
|
|
42
|
+
1. **Install** the package and [peer dependencies](#installation) (`react`, `react-dom`, `styled-components`, and `react-router-dom` if you use routing-heavy components).
|
|
43
|
+
2. **Router** — Wrap the tree with `BrowserRouter` (or another React Router v6 router) if you use `HeaderHo`, `MainMenu`, `LearnMore`, etc. If the host app may already provide a router (e.g. micro-frontend), use **`RouterWrapper`** from the package once at your root so you do not nest two `BrowserRouter` instances (see [step 2](#2-wrap-your-app-with-a-router-if-you-use-routing)).
|
|
44
|
+
3. **Runtime config** — Wrap your authenticated area with `<AuthProvider config={…}>` and pass **your** `import.meta.env.VITE_*` values (see [Runtime config](#runtime-config)). This is required for correct API URLs, Firebase, cookies, and domain-based links in pre-built npm installs.
|
|
45
|
+
4. **Optional** — `configure()` before `AuthProvider` if something (e.g. analytics) must read config earlier; `IoniconsStyles` or `styles.css` if you use icons or shared fonts (see below).
|
|
46
|
+
|
|
47
|
+
Then import components from `@stokr/components-library` as in [step 4 under How to start](#4-import-and-use-components).
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
36
51
|
## How to start
|
|
37
52
|
|
|
38
53
|
### 1. Install the package and peers
|
|
@@ -43,7 +58,9 @@ npm install @stokr/components-library react react-dom styled-components react-ro
|
|
|
43
58
|
|
|
44
59
|
### 2. Wrap your app with a Router (if you use routing)
|
|
45
60
|
|
|
46
|
-
Components that use navigation (e.g. `MainMenu`, `LearnMore`, `HeaderHo`) must live inside a React Router
|
|
61
|
+
Components that use navigation (e.g. `MainMenu`, `LearnMore`, `HeaderHo`) must live inside a React Router.
|
|
62
|
+
|
|
63
|
+
**Simple app** — wrap with `BrowserRouter`:
|
|
47
64
|
|
|
48
65
|
```jsx
|
|
49
66
|
// main.jsx or App.jsx
|
|
@@ -57,6 +74,30 @@ root.render(
|
|
|
57
74
|
)
|
|
58
75
|
```
|
|
59
76
|
|
|
77
|
+
**Host already has a router** (or you want one `BrowserRouter` only when needed) — wrap the library subtree with **`RouterWrapper`** from `@stokr/components-library`. It renders `BrowserRouter` only when `useInRouterContext()` is false, so you avoid duplicate routers and keep SPA navigation for `withRouter` / `useNavigate`:
|
|
78
|
+
|
|
79
|
+
```jsx
|
|
80
|
+
import { RouterWrapper } from '@stokr/components-library'
|
|
81
|
+
import { BrowserRouter } from 'react-router-dom'
|
|
82
|
+
import App from './App'
|
|
83
|
+
|
|
84
|
+
// Host owns the router:
|
|
85
|
+
root.render(
|
|
86
|
+
<BrowserRouter>
|
|
87
|
+
<RouterWrapper>
|
|
88
|
+
<App />
|
|
89
|
+
</RouterWrapper>
|
|
90
|
+
</BrowserRouter>,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
// Standalone shell (no outer router): RouterWrapper adds BrowserRouter once.
|
|
94
|
+
root.render(
|
|
95
|
+
<RouterWrapper>
|
|
96
|
+
<App />
|
|
97
|
+
</RouterWrapper>,
|
|
98
|
+
)
|
|
99
|
+
```
|
|
100
|
+
|
|
60
101
|
### 3. (Optional) Add Ionicons for icons
|
|
61
102
|
|
|
62
103
|
If you use **Modal**, **ConfirmModal**, **BackButton**, **Select**, **InfoIcon**, etc., add the icon styles once at the root:
|
|
@@ -128,14 +169,17 @@ function App() {
|
|
|
128
169
|
}
|
|
129
170
|
```
|
|
130
171
|
|
|
131
|
-
| Prop key
|
|
132
|
-
|
|
|
133
|
-
| `apiUrl`
|
|
134
|
-
| `baseUrlPublic`
|
|
135
|
-
| `cookieDomain`
|
|
136
|
-
| `websiteDomain`
|
|
137
|
-
| `photoApiUrl`
|
|
138
|
-
| `firebase`
|
|
172
|
+
| Prop key | Env variable it replaces | Purpose |
|
|
173
|
+
| -------------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
174
|
+
| `apiUrl` | `VITE_API_URL` | Backend API base URL |
|
|
175
|
+
| `baseUrlPublic` | `VITE_BASE_URL_PUBLIC` | Public (no-auth) API base URL |
|
|
176
|
+
| `cookieDomain` | `VITE_COOKIE_DOMAIN` | Domain attribute for auth cookies |
|
|
177
|
+
| `websiteDomain` | `VITE_WEBSITE_DOMAIN` | Platform domain (redirects, links) |
|
|
178
|
+
| `photoApiUrl` | `VITE_PHOTO_API_URL` | Photo upload / avatar API URL |
|
|
179
|
+
| `firebase` | `VITE_FIREBASE_*` | Full Firebase config object |
|
|
180
|
+
| `routingMode` | `VITE_ROUTING_MODE` | Set to `path` for single-origin app URLs (see below). |
|
|
181
|
+
| `appUrlPaths` | — | Optional object overriding first path segments in path mode (e.g. `{ onboarding: '/signup', dashboard: '/app' }`). |
|
|
182
|
+
| `surfaceRoutingMode` | — | Optional per-surface `'path'` / `'subdomain'` overrides for incremental URL migration (see [below](#incremental-url-migration-surfaceRoutingMode)). |
|
|
139
183
|
|
|
140
184
|
> **Why is this needed?** With the old CRA / `react-scripts` build, Webpack re-processed library code through the consuming app's build pipeline, so the app's `.env` values were injected automatically. Vite treats npm packages as pre-built — `import.meta.env` values in the compiled library are frozen at library build time. The `config` prop passes them at runtime instead.
|
|
141
185
|
|
|
@@ -151,6 +195,158 @@ configure({
|
|
|
151
195
|
})
|
|
152
196
|
```
|
|
153
197
|
|
|
198
|
+
After `configure()` / `<AuthProvider config>`, the library may log a **one-time `console.warn`** listing any **`VITE_*`** variables that are still missing (no override and no env fallback). Fix your `.env` or extend the `config` object until the list is empty.
|
|
199
|
+
|
|
200
|
+
### Path-based URLs vs subdomains {#path-based-urls-vs-subdomains}
|
|
201
|
+
|
|
202
|
+
By default the library builds **subdomain** links (`https://dashboard.{websiteDomain}`, `https://signup.{websiteDomain}/welcome`, `https://admin.{websiteDomain}`, etc.), matching historical STOKR hosting.
|
|
203
|
+
|
|
204
|
+
To switch to **one origin + path prefixes** (for example `https://example.com/dashboard`, `https://example.com/signin/welcome`, `https://example.com/admin`), pass **`routingMode: 'path'`** (or `VITE_ROUTING_MODE=path`) and optionally **`appUrlPaths`** overrides. The public origin for path mode is always **`https://{websiteDomain}`** (same as **`getPlatformURL()`**).
|
|
205
|
+
|
|
206
|
+
```jsx
|
|
207
|
+
<AuthProvider
|
|
208
|
+
config={{
|
|
209
|
+
apiUrl: import.meta.env.VITE_API_URL,
|
|
210
|
+
websiteDomain: import.meta.env.VITE_WEBSITE_DOMAIN,
|
|
211
|
+
routingMode: 'path',
|
|
212
|
+
appUrlPaths: {
|
|
213
|
+
onboarding: '/signin', // flows that used https://signup.{domain}
|
|
214
|
+
registerEntry: '/signup', // CTA from login; default in code is /signup
|
|
215
|
+
dashboard: '/dashboard',
|
|
216
|
+
admin: '/admin',
|
|
217
|
+
},
|
|
218
|
+
firebase: { /* … */ },
|
|
219
|
+
/* …other keys */
|
|
220
|
+
}}>
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
**Analytics and backoffice** always use legacy subdomains **`https://analytics.{websiteDomain}`** and **`https://backoffice.{websiteDomain}`**, even in path mode. They are implemented in **`src/utils/app-urls-analytics-backoffice.js`** and re-exported from **`app-urls.js`** (`getAnalyticsIngestUrl`, `getBackofficeAppUrl`); they are not driven by **`appUrlPaths`**.
|
|
224
|
+
|
|
225
|
+
#### Incremental URL migration (`surfaceRoutingMode`) {#incremental-url-migration-surfaceRoutingMode}
|
|
226
|
+
|
|
227
|
+
You do not have to flip every surface at once.
|
|
228
|
+
|
|
229
|
+
- **Global default:** `routingMode: 'path'` means “use path URLs for every surface that supports it”, unless overridden. Leaving `routingMode` unset (or not `'path'`) keeps **subdomain** URLs by default.
|
|
230
|
+
- **Per-surface override:** pass **`surfaceRoutingMode`** on `configure()` / `<AuthProvider config>`. Each key is one of **`onboarding`**, **`dashboard`**, **`admin`**, **`registerEntry`**, **`investorRoot`** (see **`SURFACE_ROUTING_PATH_KEYS`** on the package entry). Each value is **`'path'`** or **`'subdomain'`**. Any surface **omitted** from the object follows the global **`routingMode`**.
|
|
231
|
+
|
|
232
|
+
Examples:
|
|
233
|
+
|
|
234
|
+
1. **Path everywhere except admin** (admin still `https://admin.{domain}` until infra is ready):
|
|
235
|
+
|
|
236
|
+
```js
|
|
237
|
+
configure({
|
|
238
|
+
websiteDomain: 'example.com',
|
|
239
|
+
routingMode: 'path',
|
|
240
|
+
appUrlPaths: { dashboard: '/dashboard', onboarding: '/signin', registerEntry: '/signup', admin: '/admin' },
|
|
241
|
+
surfaceRoutingMode: { admin: 'subdomain' },
|
|
242
|
+
})
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
2. **Subdomains by default, dashboard and admin on path** (e.g. first rollout):
|
|
246
|
+
|
|
247
|
+
```js
|
|
248
|
+
configure({
|
|
249
|
+
websiteDomain: 'example.com',
|
|
250
|
+
appUrlPaths: { dashboard: '/dashboard', admin: '/admin' },
|
|
251
|
+
surfaceRoutingMode: { dashboard: 'path', admin: 'path' },
|
|
252
|
+
})
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
In host UI or guards, use **`isPathForSurface('dashboard')`** / **`isPathForSurface('admin')`** (exported from **`@stokr/components-library`**) so behaviour matches **`resolveAppHref`**.
|
|
256
|
+
|
|
257
|
+
##### Worked example (no script)
|
|
258
|
+
|
|
259
|
+
Assume **`websiteDomain: 'acme.com'`** and default **`appUrlPaths`** (among others: **`dashboard`** → **`/dashboard`**, **`admin`** → **`/admin`**).
|
|
260
|
+
|
|
261
|
+
**A — Full path mode** (every surface that supports paths uses **`https://acme.com`** + prefix):
|
|
262
|
+
|
|
263
|
+
```js
|
|
264
|
+
import { configure, resolveAppHref, isPathForSurface, AppSurface } from '@stokr/components-library'
|
|
265
|
+
|
|
266
|
+
configure({ websiteDomain: 'acme.com', routingMode: 'path' })
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
| Call | Result |
|
|
270
|
+
| ---------------------------------------------------- | -------------------------------------- |
|
|
271
|
+
| `resolveAppHref(AppSurface.DASHBOARD, '')` | `https://acme.com/dashboard` |
|
|
272
|
+
| `resolveAppHref(AppSurface.DASHBOARD, '/checklist')` | `https://acme.com/dashboard/checklist` |
|
|
273
|
+
| `resolveAppHref(AppSurface.ADMIN, '')` | `https://acme.com/admin` |
|
|
274
|
+
| `isPathForSurface('dashboard')` | `true` |
|
|
275
|
+
| `isPathForSurface('admin')` | `true` |
|
|
276
|
+
|
|
277
|
+
**B — Path mode, but admin stays on subdomain** until infra is ready:
|
|
278
|
+
|
|
279
|
+
```js
|
|
280
|
+
configure({
|
|
281
|
+
websiteDomain: 'acme.com',
|
|
282
|
+
routingMode: 'path',
|
|
283
|
+
surfaceRoutingMode: { admin: 'subdomain' },
|
|
284
|
+
})
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
| Call | Result |
|
|
288
|
+
| ---------------------------------------------------- | -------------------------------------------------- |
|
|
289
|
+
| `resolveAppHref(AppSurface.DASHBOARD, '/checklist')` | `https://acme.com/dashboard/checklist` (unchanged) |
|
|
290
|
+
| `resolveAppHref(AppSurface.ADMIN, '')` | `https://admin.acme.com` |
|
|
291
|
+
| `isPathForSurface('admin')` | `false` |
|
|
292
|
+
|
|
293
|
+
**C — Global default is still subdomain; dashboard and admin use path** (incremental first step):
|
|
294
|
+
|
|
295
|
+
```js
|
|
296
|
+
configure({
|
|
297
|
+
websiteDomain: 'acme.com',
|
|
298
|
+
surfaceRoutingMode: { dashboard: 'path', admin: 'path' },
|
|
299
|
+
})
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
(`routingMode` is not **`'path'`**, so any surface **not** listed in **`surfaceRoutingMode`** keeps subdomain URLs.)
|
|
303
|
+
|
|
304
|
+
| Call | Result |
|
|
305
|
+
| ------------------------------------------ | ---------------------------- |
|
|
306
|
+
| `resolveAppHref(AppSurface.DASHBOARD, '')` | `https://acme.com/dashboard` |
|
|
307
|
+
| `resolveAppHref(AppSurface.ADMIN, '')` | `https://acme.com/admin` |
|
|
308
|
+
| `isPathForSurface('dashboard')` | `true` |
|
|
309
|
+
| `isPathForSurface('admin')` | `true` |
|
|
310
|
+
|
|
311
|
+
**Rule of thumb:** for each routable surface, the code checks **`surfaceRoutingMode[surfaceKey]`** first (`'path'` or `'subdomain'`). If that key is **omitted**, it falls back to the global flag **`routingMode === 'path'`**. **`resolveAppHref`** and **`isPathForSurface`** use the same logic.
|
|
312
|
+
|
|
313
|
+
Readable routing API (recommended):
|
|
314
|
+
|
|
315
|
+
- **`AppSurface`** / **`AppRoute`** — named surfaces and path suffixes (`src/routing/app-routes.js`).
|
|
316
|
+
- **`resolveAppHref(surface, path)`** — one function that returns the absolute URL for any surface + suffix.
|
|
317
|
+
- **`isPathForSurface(key)`** / **`SURFACE_ROUTING_PATH_KEYS`** — align host code with per-surface path vs subdomain resolution when using **`surfaceRoutingMode`**.
|
|
318
|
+
- **`navigateApp(navigate, surface, path)`** / **`navigateToHref(navigate, url)`** — use the `navigate` function from `react-router-dom` when the target is **same-origin** (SPA transition); otherwise they fall back to `location.assign` (e.g. `admin.` / `signup.` subdomains).
|
|
319
|
+
- **`RouterWrapper`** — optional root helper: mounts `BrowserRouter` only when the tree is not already under a Router (same-origin SPA navigation without nesting two browser routers).
|
|
320
|
+
|
|
321
|
+
Legacy helpers (`buildDashboardUrl`, `getAdminAppUrl`, …) remain on **`./utils/app-urls`** for compatibility.
|
|
322
|
+
|
|
323
|
+
**Authentication-only HTTP** — backend routes under `auth/*` (e.g. forgot password) are exposed as **`authenticationApi.post(segment, body)`** from `src/api/authenticationApi.js` (also re-exported from the package entry). The default axios instance is the **general API client** for all authenticated backend calls, not auth-only.
|
|
324
|
+
|
|
325
|
+
### Reading config with `getConfig()` {#reading-config-with-getconfig}
|
|
326
|
+
|
|
327
|
+
In your app (or in code next to the library), read the same resolved values the package uses:
|
|
328
|
+
|
|
329
|
+
```js
|
|
330
|
+
import { getConfig } from '@stokr/components-library'
|
|
331
|
+
|
|
332
|
+
const api = getConfig('apiUrl')
|
|
333
|
+
const domain = getConfig('websiteDomain')
|
|
334
|
+
const firebaseOptions = getConfig('firebase') // override object or env-built fallback
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Supported keys: `apiUrl`, `baseUrlPublic`, `cookieDomain`, `websiteDomain`, `photoApiUrl`, `routingMode`, `appUrlPaths`, `surfaceRoutingMode`, `firebase`. Resolution order is always **explicit `configure()` / `AuthProvider` `config`** first, then **`import.meta.env`** in the consuming Vite app (where a `VITE_*` mapping exists).
|
|
338
|
+
|
|
339
|
+
**Marketing site origin** — the old `platformDomain` / `platformURL` exports were removed. Use **`getPlatformURL()`** for `https://{websiteDomain}`, or **`getConfig('websiteDomain')`** for the bare host (e.g. `"example.com"`). Both read the same runtime config after **`configure()`** / **`AuthProvider`**.
|
|
340
|
+
|
|
341
|
+
```js
|
|
342
|
+
import { getConfig, getPlatformURL } from '@stokr/components-library'
|
|
343
|
+
|
|
344
|
+
const host = getConfig('websiteDomain') // e.g. "example.com"
|
|
345
|
+
const origin = getPlatformURL() // e.g. "https://example.com"
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
**Footer link groups** — if you previously imported the static `footerGroups` from `FooterLayout`, import **`getFooterGroups`** instead (same package entry as other footer exports). It returns fresh URLs using the current `getPlatformURL()`.
|
|
349
|
+
|
|
154
350
|
### Ionicons
|
|
155
351
|
|
|
156
352
|
Components such as **Modal**, **ConfirmModal**, **BackButton**, **InfoIcon**, **Select**, **MainMenu**, and **RegisterLiquidSteps** use [Ionicons](http://ionicons.com/). You can enable them in three ways:
|
|
@@ -184,7 +380,7 @@ import '@stokr/components-library/styles.css'
|
|
|
184
380
|
|
|
185
381
|
### React Router
|
|
186
382
|
|
|
187
|
-
Any component that uses `useNavigate()` or routing must be rendered inside a `Router` from `react-router-dom` (e.g. `BrowserRouter`). See [How to start – step 2](#2-wrap-your-app-with-a-router-if-you-use-routing).
|
|
383
|
+
Any component that uses `useNavigate()` or routing must be rendered inside a `Router` from `react-router-dom` (e.g. `BrowserRouter`), or under **`RouterWrapper`** so a router exists when the host does not provide one. Components wrapped with **`withRouter`** receive `navigate` from `useNavigate()` when inside a Router; outside a Router, `navigate` throws with a message to add `BrowserRouter` or `RouterWrapper`. See [How to start – step 2](#2-wrap-your-app-with-a-router-if-you-use-routing).
|
|
188
384
|
|
|
189
385
|
---
|
|
190
386
|
|
|
@@ -192,7 +388,7 @@ Any component that uses `useNavigate()` or routing must be rendered inside a `Ro
|
|
|
192
388
|
|
|
193
389
|
### "useNavigate() may be used only in the context of a \<Router\> component"
|
|
194
390
|
|
|
195
|
-
Wrap your app with a Router
|
|
391
|
+
Wrap your app with a Router, or use **`RouterWrapper`** at the root when you are not already inside a host `BrowserRouter`:
|
|
196
392
|
|
|
197
393
|
```jsx
|
|
198
394
|
import { BrowserRouter } from 'react-router-dom'
|
|
@@ -204,6 +400,16 @@ root.render(
|
|
|
204
400
|
)
|
|
205
401
|
```
|
|
206
402
|
|
|
403
|
+
```jsx
|
|
404
|
+
import { RouterWrapper } from '@stokr/components-library'
|
|
405
|
+
|
|
406
|
+
root.render(
|
|
407
|
+
<RouterWrapper>
|
|
408
|
+
<App />
|
|
409
|
+
</RouterWrapper>,
|
|
410
|
+
)
|
|
411
|
+
```
|
|
412
|
+
|
|
207
413
|
Install the peer dependency: `npm install react-router-dom`
|
|
208
414
|
|
|
209
415
|
### "Invalid hook call" / "Cannot read properties of null (reading 'use')"
|
package/dist/analytics/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import mixpanel from "mixpanel-browser";
|
|
2
|
+
import "../constants/globalVariables.js";
|
|
3
|
+
import { getAnalyticsIngestUrl } from "../utils/app-urls-analytics-backoffice.js";
|
|
2
4
|
const BLOCKED_FIELDS = /* @__PURE__ */ new Set([
|
|
3
5
|
// PII
|
|
4
6
|
"email",
|
|
@@ -75,10 +77,15 @@ function initAnalytics({
|
|
|
75
77
|
app,
|
|
76
78
|
requireConsent = false,
|
|
77
79
|
scroll = true,
|
|
78
|
-
apiHost
|
|
80
|
+
apiHost: apiHostArg
|
|
79
81
|
} = {}) {
|
|
82
|
+
const analyticsUrl = getAnalyticsIngestUrl();
|
|
83
|
+
const apiHost = apiHostArg ?? (analyticsUrl || "https://api-eu.mixpanel.com");
|
|
80
84
|
if (initialized) return;
|
|
81
85
|
if (!token) return;
|
|
86
|
+
if (typeof navigator !== "undefined" && /Ghost Inspector/i.test(navigator.userAgent)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
82
89
|
mixpanel.init(token, {
|
|
83
90
|
api_host: apiHost,
|
|
84
91
|
autocapture: {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import axiosInstance from "../model/axios.js";
|
|
2
|
+
const authenticationApi = {
|
|
3
|
+
/**
|
|
4
|
+
* @param {string} pathSegment — appended to `auth/` (e.g. `forgotPass` → `POST auth/forgotPass`)
|
|
5
|
+
* @param {Record<string, unknown>} body
|
|
6
|
+
*/
|
|
7
|
+
post(pathSegment, body) {
|
|
8
|
+
return axiosInstance.post(`auth/${pathSegment}`, body);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
authenticationApi
|
|
13
|
+
};
|
package/dist/auth/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { configure
|
|
1
|
+
import { configure } from "../config.js";
|
|
2
2
|
import { default as default2 } from "../components/2FA/Connect2FA.js";
|
|
3
3
|
import { default as default3 } from "../components/2FA/enable-2fa-flow.js";
|
|
4
4
|
import { default as default4 } from "../components/2FA/EnterCode.js";
|
|
@@ -10,6 +10,7 @@ import { default as default9 } from "../components/2FA/ResetCode.js";
|
|
|
10
10
|
import { Auth, DEFAULT_TOKEN_EXPIRY_MS } from "../context/Auth.js";
|
|
11
11
|
import { AuthConsumer, AuthContext, AuthProvider } from "../context/AuthContext.js";
|
|
12
12
|
import { LoadingDots, StokrLoader, StokrLoaderBox } from "../components/StokrLoader/StokrLoader.js";
|
|
13
|
+
import { getConfig, resetRuntimeConfig } from "../runtime-config.js";
|
|
13
14
|
export {
|
|
14
15
|
Auth,
|
|
15
16
|
AuthConsumer,
|
|
@@ -28,5 +29,6 @@ export {
|
|
|
28
29
|
StokrLoaderBox,
|
|
29
30
|
default7 as Sucess2FA,
|
|
30
31
|
configure,
|
|
31
|
-
getConfig
|
|
32
|
+
getConfig,
|
|
33
|
+
resetRuntimeConfig
|
|
32
34
|
};
|
|
@@ -7,8 +7,13 @@ import stdin_default$4 from "../ForgotPasswordModal/ForgotPasswordModal.js";
|
|
|
7
7
|
import stdin_default$2 from "./EnterCode.js";
|
|
8
8
|
import background from "../../static/images/background3.png.js";
|
|
9
9
|
import stdin_default$3 from "./ResetCode.js";
|
|
10
|
-
import {
|
|
10
|
+
import { authenticationApi } from "../../api/authenticationApi.js";
|
|
11
|
+
import { AppSurface } from "../../routing/app-routes.js";
|
|
12
|
+
import "../../constants/globalVariables.js";
|
|
13
|
+
import { navigateApp } from "../../routing/navigate-app.js";
|
|
14
|
+
import { useNavigate } from "react-router-dom";
|
|
11
15
|
const LoginWithOTP = ({ withBackground }) => {
|
|
16
|
+
const navigate = useNavigate();
|
|
12
17
|
const { loginUser, waitingFor2fa, firebaseError, loginUserWithTotp, reset2faFlow } = useContext(AuthContext);
|
|
13
18
|
const [isModalOpen, setIsModalOpen] = useState({
|
|
14
19
|
login: true,
|
|
@@ -65,10 +70,10 @@ const LoginWithOTP = ({ withBackground }) => {
|
|
|
65
70
|
background: withBackground && backgroundProp,
|
|
66
71
|
isModalOpen: isModalOpen.login,
|
|
67
72
|
onModalClose: () => {
|
|
68
|
-
|
|
73
|
+
navigateApp(navigate, AppSurface.INVESTOR_ROOT, "");
|
|
69
74
|
},
|
|
70
75
|
onModalSwitch: () => {
|
|
71
|
-
|
|
76
|
+
navigateApp(navigate, AppSurface.REGISTER, "");
|
|
72
77
|
},
|
|
73
78
|
onForgotPassword: () => {
|
|
74
79
|
switchOpenModal("login", "forgot");
|
|
@@ -177,7 +182,7 @@ const LoginWithOTP = ({ withBackground }) => {
|
|
|
177
182
|
clearPopupError();
|
|
178
183
|
setIsActionLoading("forgot");
|
|
179
184
|
try {
|
|
180
|
-
await
|
|
185
|
+
await authenticationApi.post("forgotPass", {
|
|
181
186
|
email
|
|
182
187
|
});
|
|
183
188
|
handleSetPopupSuccess(
|
|
@@ -4,99 +4,102 @@ import PropTypes from "prop-types";
|
|
|
4
4
|
import stdin_default$1 from "./FooterMenu.js";
|
|
5
5
|
import stdin_default$2 from "../Newsletter/Newsletter.js";
|
|
6
6
|
import stdin_default$3 from "./Footer.js";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
]
|
|
7
|
+
import { getPlatformURL } from "../../constants/globalVariables.js";
|
|
8
|
+
function getFooterGroups() {
|
|
9
|
+
const platformURL = getPlatformURL();
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
name: "New to STOKR",
|
|
13
|
+
collapse: true,
|
|
14
|
+
items: [
|
|
15
|
+
{
|
|
16
|
+
name: "Solutions",
|
|
17
|
+
url: `${platformURL}/solutions`
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "101s",
|
|
21
|
+
url: `${platformURL}/101`
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "Support",
|
|
25
|
+
url: "https://support.stokr.io/",
|
|
26
|
+
external: true
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "STOKE POST",
|
|
30
|
+
url: `${platformURL}/stoke-post`
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "About us",
|
|
36
|
+
collapse: true,
|
|
37
|
+
items: [
|
|
38
|
+
{
|
|
39
|
+
name: "Team",
|
|
40
|
+
url: `${platformURL}/team`
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "Careers",
|
|
44
|
+
url: `${platformURL}/careers`,
|
|
45
|
+
showNumber: true
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "Memberships",
|
|
49
|
+
url: `${platformURL}/memberships`
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "Press Releases",
|
|
53
|
+
url: `${platformURL}/press-releases`
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "General",
|
|
59
|
+
collapse: true,
|
|
60
|
+
items: [
|
|
61
|
+
{
|
|
62
|
+
name: "Legal",
|
|
63
|
+
url: `${platformURL}/legal`
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "Privacy Terms",
|
|
67
|
+
url: `${platformURL}/privacy`
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "Cookie policy",
|
|
71
|
+
url: `${platformURL}/cookie-policy`
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "Let’s connect",
|
|
77
|
+
social: true,
|
|
78
|
+
items: [
|
|
79
|
+
{
|
|
80
|
+
name: "linkedin",
|
|
81
|
+
url: "https://www.linkedin.com/company/stokr/"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "twitter",
|
|
85
|
+
url: "https://twitter.com/stokr_io"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "telegram",
|
|
89
|
+
url: "https://t.me/joinchat/G2o5yBCe7FiYvv1YiZhNZg"
|
|
90
|
+
},
|
|
91
|
+
// {
|
|
92
|
+
// name: 'medium',
|
|
93
|
+
// url: 'https://medium.com/sicos-publication',
|
|
94
|
+
// },
|
|
95
|
+
{
|
|
96
|
+
name: "youtube",
|
|
97
|
+
url: "https://www.youtube.com/channel/UCUuQtRhbcFcU4xeTrDl3iQQ"
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
];
|
|
102
|
+
}
|
|
100
103
|
function FooterLayout({
|
|
101
104
|
withNewsLetter = true,
|
|
102
105
|
withFooterMenu = true,
|
|
@@ -112,7 +115,7 @@ function FooterLayout({
|
|
|
112
115
|
withFooterMenu && /* @__PURE__ */ jsx(
|
|
113
116
|
stdin_default$1,
|
|
114
117
|
{
|
|
115
|
-
groups:
|
|
118
|
+
groups: getFooterGroups(),
|
|
116
119
|
jobOpeningsNumber,
|
|
117
120
|
dropdownCollapsed,
|
|
118
121
|
footnotes,
|
|
@@ -141,5 +144,5 @@ FooterLayout.propTypes = {
|
|
|
141
144
|
var stdin_default = FooterLayout;
|
|
142
145
|
export {
|
|
143
146
|
stdin_default as default,
|
|
144
|
-
|
|
147
|
+
getFooterGroups
|
|
145
148
|
};
|