@stokr/components-library 3.0.35 → 3.0.37

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 (36) hide show
  1. package/dist/auth/index.js +9 -9
  2. package/dist/components/2FA/login-with-otp-flow.js +1 -1
  3. package/dist/components/BlogPost/BlogPost.js +1 -1
  4. package/dist/components/BlogPost/BlogPost.styles.js +1 -1
  5. package/dist/components/Button/GlareButton.js +1 -1
  6. package/dist/components/ConfirmModal/ConfirmModal.js +4 -4
  7. package/dist/components/Country/CountrySelect.js +117 -0
  8. package/dist/components/Header/Header.js +2 -3
  9. package/dist/components/InfoBox/InfoBox.js +22 -18
  10. package/dist/components/Input/InputPassword.js +0 -1
  11. package/dist/components/Input/Select.js +183 -81
  12. package/dist/components/Input/Select.styles.js +111 -1
  13. package/dist/components/LearnMoreSection/LearnMore.js +1 -1
  14. package/dist/components/MainMenu/MainMenu.js +1 -1
  15. package/dist/components/Modal/NewVentureModal/NewVentureModal.js +1 -1
  16. package/dist/components/Modal/PaymentModal.js +1 -2
  17. package/dist/components/Newsletter/Newsletter.styles.js +1 -1
  18. package/dist/components/RefreshButton/RefreshButton.js +0 -1
  19. package/dist/components/Snackbar/Snackbar.styles.js +1 -1
  20. package/dist/components/TabsNav/TabsNav.js +0 -2
  21. package/dist/components/TaxResidenceCard/TaxResidenceCard.js +209 -0
  22. package/dist/components/TaxResidenceCard/TaxResidenceCard.styles.js +169 -0
  23. package/dist/components/TeamOverview/TeamOverview.js +0 -1
  24. package/dist/components/ToDoList/ToDoListTask.js +0 -20
  25. package/dist/components/VerifyEmailModal/VerifyEmailModal.js +1 -15
  26. package/dist/components/headerHo/HeaderHo.js +5 -22
  27. package/dist/context/AuthContext.js +25 -12
  28. package/dist/index.js +137 -130
  29. package/dist/static/images/globe.svg +16 -0
  30. package/dist/static/images/globe.svg.js +5 -0
  31. package/dist/static/images/trash.svg +17 -0
  32. package/dist/static/images/trash.svg.js +5 -0
  33. package/dist/utils/customHooks.js +1 -1
  34. package/dist/utils/get-cookie-domain.js +0 -4
  35. package/dist/utils/set-redirect-cookie.js +0 -4
  36. package/package.json +153 -145
@@ -0,0 +1,209 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useState, useMemo, useCallback } from "react";
3
+ import PropTypes from "prop-types";
4
+ import { Input } from "../Input/Input.js";
5
+ import { Checkbox } from "../Checkbox/Checkbox.js";
6
+ import SvgTrash from "../../static/images/trash.svg.js";
7
+ import SvgGlobe from "../../static/images/globe.svg.js";
8
+ import { IoniconsStyles } from "../../styles/ioniconsStyles.js";
9
+ import { FlagFor, CountrySelect } from "../Country/CountrySelect.js";
10
+ import { CardWrapper, CardHeader, HeaderIcon, FlagWrapper, HeaderTitle, HeaderActions, DeleteButton, ChevronIcon, CardBodyCollapse, CardBody, CheckboxRow } from "./TaxResidenceCard.styles.js";
11
+ const TaxResidenceCard = (props) => {
12
+ const {
13
+ id,
14
+ name = id,
15
+ countries,
16
+ value,
17
+ onChange,
18
+ onDelete,
19
+ open: controlledOpen,
20
+ defaultOpen = true,
21
+ onToggle,
22
+ emptyTitle = "Tax residence",
23
+ countryLabel = "Country *",
24
+ tinLabel = "Tax identification number (TIN)",
25
+ noTinLabel = "Country of tax residence doesn't issue TINs.",
26
+ countryPlaceholder = "Search countries",
27
+ disabled = false,
28
+ hideNoTin = false,
29
+ error,
30
+ touched,
31
+ dataCy
32
+ } = props;
33
+ const isControlled = controlledOpen !== void 0;
34
+ const [internalOpen, setInternalOpen] = useState(defaultOpen);
35
+ const isOpen = isControlled ? controlledOpen : internalOpen;
36
+ const country = value?.country ?? "";
37
+ const tin = value?.tin ?? "";
38
+ const noTinIssued = value?.noTinIssued ?? false;
39
+ const selectedCountry = useMemo(
40
+ () => country ? countries?.find((c) => c.value === country) : null,
41
+ [countries, country]
42
+ );
43
+ const headerTitle = selectedCountry?.label || emptyTitle;
44
+ const toggle = useCallback(() => {
45
+ const next = !isOpen;
46
+ if (!isControlled) setInternalOpen(next);
47
+ onToggle?.(next);
48
+ }, [isOpen, isControlled, onToggle]);
49
+ const handleHeaderKeyDown = (e) => {
50
+ if (e.key === " " || e.key === "Enter") {
51
+ e.preventDefault();
52
+ toggle();
53
+ }
54
+ };
55
+ const emit = useCallback(
56
+ (patch) => {
57
+ onChange?.({ country, tin, noTinIssued, ...patch });
58
+ },
59
+ [onChange, country, tin, noTinIssued]
60
+ );
61
+ const handleCountryChange = ({ value: nextCountry }) => emit({ country: nextCountry });
62
+ const handleTinChange = (e) => emit({ tin: e.target.value });
63
+ const handleNoTinChange = (e) => {
64
+ const checked = e.target.checked;
65
+ emit({ noTinIssued: checked, ...checked ? { tin: "" } : {} });
66
+ };
67
+ const handleDelete = (e) => {
68
+ e.stopPropagation();
69
+ onDelete?.();
70
+ };
71
+ const cy = dataCy || `tax-residence-card-${id}`;
72
+ return /* @__PURE__ */ jsxs(CardWrapper, { isOpen, "data-cy": cy, children: [
73
+ /* @__PURE__ */ jsx(IoniconsStyles, {}),
74
+ /* @__PURE__ */ jsxs(
75
+ CardHeader,
76
+ {
77
+ isOpen,
78
+ onClick: toggle,
79
+ onKeyDown: handleHeaderKeyDown,
80
+ role: "button",
81
+ tabIndex: 0,
82
+ "aria-expanded": isOpen,
83
+ "aria-controls": `${id}-body`,
84
+ "data-cy": `${cy}-toggle`,
85
+ children: [
86
+ /* @__PURE__ */ jsx(HeaderIcon, { "aria-hidden": "true", children: selectedCountry ? /* @__PURE__ */ jsx(FlagWrapper, { children: /* @__PURE__ */ jsx(FlagFor, { code: selectedCountry.value }) }) : /* @__PURE__ */ jsx(SvgGlobe, {}) }),
87
+ /* @__PURE__ */ jsx(HeaderTitle, { children: headerTitle }),
88
+ /* @__PURE__ */ jsxs(HeaderActions, { children: [
89
+ onDelete && !disabled && /* @__PURE__ */ jsx(
90
+ DeleteButton,
91
+ {
92
+ type: "button",
93
+ onClick: handleDelete,
94
+ "aria-label": `Delete ${headerTitle}`,
95
+ disabled,
96
+ "data-cy": `${cy}-delete`,
97
+ children: /* @__PURE__ */ jsx(SvgTrash, {})
98
+ }
99
+ ),
100
+ /* @__PURE__ */ jsx(ChevronIcon, { isOpen, "aria-hidden": "true" })
101
+ ] })
102
+ ]
103
+ }
104
+ ),
105
+ /* @__PURE__ */ jsx(CardBodyCollapse, { isOpened: isOpen, children: /* @__PURE__ */ jsxs(CardBody, { id: `${id}-body`, children: [
106
+ /* @__PURE__ */ jsx(
107
+ CountrySelect,
108
+ {
109
+ id: `${id}-country`,
110
+ name: `${name}.country`,
111
+ label: countryLabel,
112
+ countries,
113
+ value: country,
114
+ onChange: handleCountryChange,
115
+ placeholder: countryPlaceholder,
116
+ disabled,
117
+ error: !!error?.country,
118
+ touched: !!touched?.country,
119
+ dataCy: `${cy}-country`
120
+ }
121
+ ),
122
+ /* @__PURE__ */ jsx(
123
+ Input,
124
+ {
125
+ id: `${id}-tin`,
126
+ name: `${name}.tin`,
127
+ label: tinLabel,
128
+ value: tin,
129
+ onChange: handleTinChange,
130
+ disabled: disabled || noTinIssued,
131
+ error: !!error?.tin,
132
+ touched: !!touched?.tin,
133
+ "data-cy": `${cy}-tin`
134
+ }
135
+ ),
136
+ (disabled && (tin === "" || !tin) || !disabled) && !hideNoTin && /* @__PURE__ */ jsx(CheckboxRow, { children: /* @__PURE__ */ jsx(
137
+ Checkbox,
138
+ {
139
+ id: `${id}-no-tin`,
140
+ name: `${name}.noTinIssued`,
141
+ text: noTinLabel,
142
+ checked: noTinIssued,
143
+ onChange: handleNoTinChange,
144
+ disabled,
145
+ "data-cy": `${cy}-no-tin`
146
+ }
147
+ ) })
148
+ ] }) })
149
+ ] });
150
+ };
151
+ TaxResidenceCard.propTypes = {
152
+ /** Unique id used to namespace inner field ids (country/tin/checkbox). */
153
+ id: PropTypes.string.isRequired,
154
+ /** Form field name prefix; defaults to `id`. Children get `${name}.country`, etc. */
155
+ name: PropTypes.string,
156
+ /** Same shape as `<CountrySelect>`: `{ key, value, label }[]`. `value` is ISO 3166-1 alpha-2. */
157
+ countries: PropTypes.arrayOf(
158
+ PropTypes.shape({
159
+ key: PropTypes.string,
160
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
161
+ label: PropTypes.string.isRequired
162
+ })
163
+ ).isRequired,
164
+ /** Current values: `{ country, tin, noTinIssued }`. */
165
+ value: PropTypes.shape({
166
+ country: PropTypes.string,
167
+ tin: PropTypes.string,
168
+ noTinIssued: PropTypes.bool
169
+ }),
170
+ /** Called with the full next value object on any field change. */
171
+ onChange: PropTypes.func,
172
+ /** Optional - when provided, renders a delete (trash) button next to the chevron in the header. */
173
+ onDelete: PropTypes.func,
174
+ /** Controlled collapse state. Omit to use uncontrolled mode with `defaultOpen`. */
175
+ open: PropTypes.bool,
176
+ /** Initial collapse state in uncontrolled mode. Defaults to true so users can fill it in immediately. */
177
+ defaultOpen: PropTypes.bool,
178
+ /** Called with the next open state whenever the user toggles the header. */
179
+ onToggle: PropTypes.func,
180
+ /** Title shown in the header when no country is selected yet. */
181
+ emptyTitle: PropTypes.string,
182
+ /** Floating label for the country select. */
183
+ countryLabel: PropTypes.string,
184
+ /** Floating label for the TIN input. */
185
+ tinLabel: PropTypes.string,
186
+ /** Text next to the "no TIN issued" checkbox. */
187
+ noTinLabel: PropTypes.node,
188
+ /** Placeholder for the country select. */
189
+ countryPlaceholder: PropTypes.string,
190
+ /** Disables every interactive control inside the card. */
191
+ disabled: PropTypes.bool,
192
+ /** Whether to hide the "no TIN issued" checkbox. */
193
+ hideNoTin: PropTypes.bool,
194
+ /** Per-field error flags: `{ country, tin }`. */
195
+ error: PropTypes.shape({
196
+ country: PropTypes.bool,
197
+ tin: PropTypes.bool
198
+ }),
199
+ /** Per-field touched flags: `{ country, tin }`. */
200
+ touched: PropTypes.shape({
201
+ country: PropTypes.bool,
202
+ tin: PropTypes.bool
203
+ }),
204
+ /** Playwright / autocapture root selector. Children are namespaced from this. */
205
+ dataCy: PropTypes.string
206
+ };
207
+ export {
208
+ TaxResidenceCard
209
+ };
@@ -0,0 +1,169 @@
1
+ import styled, { css } from "styled-components";
2
+ import { Collapse } from "react-collapse";
3
+ import theme from "../../styles/theme.js";
4
+ const CardWrapper = styled.div.withConfig({
5
+ shouldForwardProp: (prop) => !["isOpen"].includes(prop)
6
+ })`
7
+ background: ${theme.cWhite};
8
+ border: 1px solid ${theme.cLightGrey};
9
+ border-radius: 6px;
10
+ overflow: hidden;
11
+ transition:
12
+ border-color 0.2s,
13
+ box-shadow 0.2s;
14
+
15
+ ${(props) => props.isOpen && css`
16
+ border-color: ${theme.cLightGrey};
17
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
18
+ `}
19
+
20
+ & + & {
21
+ margin-top: 12px;
22
+ }
23
+ `;
24
+ const CardHeader = styled.div.withConfig({
25
+ shouldForwardProp: (prop) => !["isOpen"].includes(prop)
26
+ })`
27
+ display: flex;
28
+ align-items: center;
29
+ width: 100%;
30
+ padding: 18px 22px;
31
+ background: transparent;
32
+ border: 0;
33
+ outline: 0;
34
+ cursor: pointer;
35
+ text-align: left;
36
+ font-family: 'Open Sans';
37
+ color: ${theme.cBlack};
38
+ transition: background-color 0.15s;
39
+ user-select: none;
40
+
41
+ &:hover {
42
+ background-color: ${theme.cGrey3};
43
+ }
44
+
45
+ &:focus-visible {
46
+ box-shadow: inset 0 0 0 2px ${theme.cPrimary};
47
+ }
48
+ `;
49
+ const HeaderIcon = styled.span`
50
+ display: inline-flex;
51
+ align-items: center;
52
+ justify-content: center;
53
+ width: 24px;
54
+ margin-right: 16px;
55
+ flex-shrink: 0;
56
+ color: ${theme.cBlack};
57
+ `;
58
+ const FlagWrapper = styled.span`
59
+ display: inline-flex;
60
+ width: 24px;
61
+ height: 18px;
62
+ border-radius: 2px;
63
+ overflow: hidden;
64
+
65
+ & > svg,
66
+ & > img {
67
+ width: 100%;
68
+ height: 100%;
69
+ object-fit: cover;
70
+ display: block;
71
+ }
72
+ `;
73
+ const HeaderTitle = styled.span`
74
+ flex: 1;
75
+ min-width: 0;
76
+ font-family: 'Open Sans';
77
+ font-weight: 700;
78
+ font-size: 13px;
79
+ line-height: 18px;
80
+ letter-spacing: 1.5px;
81
+ text-transform: uppercase;
82
+ color: ${theme.cBlack};
83
+ white-space: nowrap;
84
+ overflow: hidden;
85
+ text-overflow: ellipsis;
86
+ `;
87
+ const HeaderActions = styled.div`
88
+ display: flex;
89
+ align-items: center;
90
+ gap: 14px;
91
+ margin-left: 12px;
92
+ flex-shrink: 0;
93
+ `;
94
+ const DeleteButton = styled.button`
95
+ display: inline-flex;
96
+ align-items: center;
97
+ justify-content: center;
98
+ width: 28px;
99
+ height: 28px;
100
+ padding: 0;
101
+ border: 0;
102
+ background: transparent;
103
+ color: ${theme.cBlack};
104
+ cursor: pointer;
105
+ border-radius: 50%;
106
+ transition:
107
+ color 0.15s,
108
+ background-color 0.15s;
109
+
110
+ &:hover {
111
+ color: ${theme.cWarning};
112
+ background-color: rgba(238, 34, 13, 0.08);
113
+ }
114
+
115
+ &:focus-visible {
116
+ outline: 2px solid ${theme.cPrimary};
117
+ outline-offset: 2px;
118
+ }
119
+
120
+ &:disabled {
121
+ cursor: not-allowed;
122
+ color: ${theme.cGrey2};
123
+
124
+ &:hover {
125
+ color: ${theme.cGrey2};
126
+ background-color: transparent;
127
+ }
128
+ }
129
+ `;
130
+ const ChevronIcon = styled.i.withConfig({
131
+ shouldForwardProp: (prop) => !["isOpen"].includes(prop)
132
+ }).attrs({
133
+ className: "ion ion-ios-arrow-down"
134
+ })`
135
+ font-size: 20px;
136
+ line-height: 1;
137
+ color: ${theme.cBlack};
138
+ transform: rotate(0);
139
+ transition: transform 0.25s ease;
140
+
141
+ ${(props) => props.isOpen && css`
142
+ transform: rotate(180deg);
143
+ `}
144
+ `;
145
+ const CardBodyCollapse = styled(Collapse)`
146
+ border-top: 1px solid ${theme.cLightGrey};
147
+ `;
148
+ const CardBody = styled.div`
149
+ display: flex;
150
+ flex-direction: column;
151
+ gap: 26px;
152
+ padding: 24px 22px 20px;
153
+ `;
154
+ const CheckboxRow = styled.div`
155
+ padding-top: 4px;
156
+ `;
157
+ export {
158
+ CardBody,
159
+ CardBodyCollapse,
160
+ CardHeader,
161
+ CardWrapper,
162
+ CheckboxRow,
163
+ ChevronIcon,
164
+ DeleteButton,
165
+ FlagWrapper,
166
+ HeaderActions,
167
+ HeaderIcon,
168
+ HeaderTitle
169
+ };
@@ -2,7 +2,6 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import stdin_default from "../SvgIcons/AdminBadgeSvg.js";
5
- import "../SvgIcons/SocialInstagram.js";
6
5
  import { Container, ImageWrapper, Avatar, ContentWrapper, ContentGroup, SmallHeader, Name, PersonPosition, PersonEmail, ProjectStats, ProjectStat, StatLabel, StatValue } from "./TeamOverview.styles.js";
7
6
  import avatarPlaceholder from "../../static/images/avatar-placeholder.png.js";
8
7
  const TeamOverview = ({
@@ -7,26 +7,6 @@ import { TooltipIcon } from "../Icon/Icon.style.js";
7
7
  import setRedirectCookie from "../../utils/set-redirect-cookie.js";
8
8
  import { AuthProvider } from "../../context/AuthContext.js";
9
9
  import { ToDoModal } from "./ToDoList.js";
10
- import "react-router-dom";
11
- import "mixpanel-browser";
12
- import "../Text/Text.styles.js";
13
- import "yup";
14
- import "formik";
15
- import "../Input/Input.js";
16
- import "../Form/Form.js";
17
- import "../ComponentWrapper/ComponentWrapper.styles.js";
18
- import "../TextLink/TextLink.styles.js";
19
- import "../Button/Button.styles.js";
20
- import "../CryptoAddressWrapper/CryptoAddressWrapper.js";
21
- import "../RefreshButton/RefreshButton.js";
22
- import "../SectionTitle/SectionTitle.styles.js";
23
- import "../FAQ/FAQ.js";
24
- import "js-cookie";
25
- import "firebase/app";
26
- import "firebase/auth";
27
- import "../../model/axios.js";
28
- import "../../model/axiosPublic.js";
29
- import "../../utils/redirect-url.js";
30
10
  import stdin_default$1 from "../taxId/flow.js";
31
11
  const ToDoTask = ({
32
12
  title,
@@ -12,23 +12,9 @@ import * as Yup from "yup";
12
12
  import stdin_default$2 from "../Form/Form.js";
13
13
  import { Input } from "../Input/Input.js";
14
14
  import { useCooldown } from "../../utils/customHooks.js";
15
- import "../../styles/rwd.js";
16
- import { ModalInner } from "../Modal/Modal.styles.js";
17
- import "react-qr-code";
18
- import "../CryptoAddress/CryptoAddress.js";
19
- import "../StepController/StepController.js";
20
- import "../StepController/StepControllerContext.js";
21
- import "../Input/OtpInput.js";
22
- import "../../context/AuthContext.js";
23
15
  import stdin_default$1 from "../2FA/Sucess2FA.js";
24
- import "js-cookie";
25
- import "../../model/axios.js";
26
- import "../Layout/Layout.js";
27
- import "../LoginModal/LoginModal.js";
28
- import "../ForgotPasswordModal/ForgotPasswordModal.js";
29
- import "react-router-dom";
30
- import "../2FA/main-flow.js";
31
16
  import { emailRegex } from "../../constants/globalVariables.js";
17
+ import { ModalInner } from "../Modal/Modal.styles.js";
32
18
  const renderSuccessModal = (continueUrl) => /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
33
19
  stdin_default$1,
34
20
  {
@@ -11,36 +11,19 @@ import stdin_default$9 from "../ResetConfirmModal/ResetConfirmModal.js";
11
11
  import stdin_default$1 from "../LoginModal/LoginModal.js";
12
12
  import stdin_default$a from "../VerifyEmailModal/VerifyEmailModal.js";
13
13
  import stdin_default from "../Header/Header.js";
14
- import "../../styles/rwd.js";
15
- import "../Text/Text.styles.js";
16
- import "../Button/Button.styles.js";
17
- import "../ComponentWrapper/ComponentWrapper.styles.js";
18
- import "../Modal/Modal.styles.js";
19
- import "react-qr-code";
20
- import "../Grid/Grid.styles.js";
21
- import "../CryptoAddress/CryptoAddress.js";
22
- import { cooldownHOC } from "../../utils/customHooks.js";
23
- import "../Modal/Modal.js";
24
- import "../StepController/StepController.js";
25
- import "../StepController/StepControllerContext.js";
26
14
  import stdin_default$2 from "../2FA/EnterCode.js";
27
- import { AuthContext } from "../../context/AuthContext.js";
28
- import "../2FA/Sucess2FA.js";
29
- import "js-cookie";
30
- import "../../model/axios.js";
31
- import "../Layout/Layout.js";
32
15
  import stdin_default$3 from "../2FA/ResetCode.js";
33
16
  import { authenticationApi } from "../../api/authenticationApi.js";
34
- import { getConfig } from "../../runtime-config.js";
35
- import { navigateToHref } from "../../routing/navigate-app.js";
36
- import { getBackofficeAppUrl } from "../../utils/app-urls-analytics-backoffice.js";
37
- import "react-router-dom";
38
- import "../2FA/main-flow.js";
39
17
  import fetchDataPublic from "../../api/fetchDataPublic.js";
18
+ import { AuthContext } from "../../context/AuthContext.js";
40
19
  import { withRouter } from "../../utils/withRouter.js";
20
+ import { cooldownHOC } from "../../utils/customHooks.js";
41
21
  import { checkActionCode } from "firebase/auth";
42
22
  import { auth } from "../../firebase-config.js";
23
+ import { getConfig } from "../../runtime-config.js";
24
+ import { getBackofficeAppUrl } from "../../utils/app-urls-analytics-backoffice.js";
43
25
  import { track } from "../../analytics/index.js";
26
+ import { navigateToHref } from "../../routing/navigate-app.js";
44
27
  const Outer = styled.div.withConfig({
45
28
  shouldForwardProp: (props) => !["fixed"].includes(props)
46
29
  })`
@@ -4,18 +4,19 @@ import axiosInstance from "../model/axios.js";
4
4
  import { configure } from "../config.js";
5
5
  import React__default, { Component } from "react";
6
6
  import fetchData from "../api/fetchData.js";
7
- import { identify, reset } from "../analytics/index.js";
7
+ import { reset, identify } from "../analytics/index.js";
8
8
  import { withRouter } from "../utils/withRouter.js";
9
9
  import { Text } from "../components/Text/Text.styles.js";
10
10
  import { Auth, DEFAULT_TOKEN_EXPIRY_MS } from "./Auth.js";
11
+ import { Button } from "../components/Button/Button.styles.js";
11
12
  import { hasLoggedInSession } from "../utils/user-identity.js";
12
13
  import { getConfig, getPlatformURL } from "../runtime-config.js";
13
- import { ConfirmModal as ConfirmModalComponent } from "../components/ConfirmModal/ConfirmModal.js";
14
- import { getFirebaseAuth, isValidFirebaseConfig } from "../firebase-config.js";
15
14
  import avatarPlaceholder from "../static/images/avatar-placeholder.png.js";
15
+ import { getFirebaseAuth, isValidFirebaseConfig } from "../firebase-config.js";
16
16
  import { isAlreadyOnOnboardingFlow } from "../utils/app-urls.js";
17
- import { multiFactor, TotpMultiFactorGenerator, signOut, getMultiFactorResolver, PhoneMultiFactorGenerator } from "firebase/auth";
17
+ import { signOut, getMultiFactorResolver, PhoneMultiFactorGenerator, TotpMultiFactorGenerator, multiFactor } from "firebase/auth";
18
18
  import { navigateToHref } from "../routing/navigate-app.js";
19
+ import { SuccessModal as SuccessModalComponent } from "../components/Modal/SuccessModal/SuccessModal.js";
19
20
  const AuthContext = React__default.createContext();
20
21
  const FALLBACK_AUTH_CONTEXT_VALUE = { user: null, isFetchingUser: false };
21
22
  const INACTIVITY_TIME_MS = 5 * 60 * 1e3;
@@ -835,16 +836,26 @@ class AuthProviderClass extends Component {
835
836
  children: [
836
837
  children,
837
838
  (this.state.loggedOutDueToInactivity || this.state.loggedOutDueToCookieExpiry || this.state.sessionExpiryPendingReason) && !this.props.hideInactivityModal && /* @__PURE__ */ jsx(
838
- ConfirmModalComponent,
839
+ SuccessModalComponent,
839
840
  {
840
841
  isOpen: true,
841
- maxWidth: "600px",
842
- confirmText: "OK",
843
- onCancel: this.dismissSessionExpiryModal,
844
- onConfirm: this.dismissSessionExpiryModal,
845
- showRedBar: true,
842
+ onClose: this.dismissSessionExpiryModal,
843
+ variant: "progress",
846
844
  title: "Session expired",
847
- 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." }) })
845
+ content: /* @__PURE__ */ jsxs(Text, { children: [
846
+ /* @__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." }),
847
+ /* @__PURE__ */ jsx(
848
+ Button,
849
+ {
850
+ onClick: () => {
851
+ this.dismissSessionExpiryModal();
852
+ this.props.onSessionExpiredLoginClick?.();
853
+ },
854
+ children: "Log in"
855
+ }
856
+ )
857
+ ] }),
858
+ maxWidth: "600px"
848
859
  }
849
860
  )
850
861
  ]
@@ -886,7 +897,9 @@ AuthProviderClass.propTypes = {
886
897
  /** When true, the inactivity modal is not shown after auto-logout. Default false. */
887
898
  hideInactivityModal: PropTypes.bool,
888
899
  /** Override access token cookie lifetime in ms (e.g. for Storybook). Production uses 1 hour. */
889
- accessTokenExpiryMs: PropTypes.number
900
+ accessTokenExpiryMs: PropTypes.number,
901
+ /** A function to be called when the session expires. Default undefined. */
902
+ onSessionExpiredLoginClick: PropTypes.func
890
903
  };
891
904
  function resolveFirebaseConfigForGuard(props) {
892
905
  if (props.config?.firebase != null) return props.config.firebase;