@stokr/components-library 3.0.77 → 3.1.0

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 (75) hide show
  1. package/dist/components/Input/InputPassword.js +3 -5
  2. package/dist/components/Input/OtpInput.js +1 -3
  3. package/dist/components/MenuNav/MenuNav.styles.js +1 -2
  4. package/dist/components/Modal/Modal.styles.js +2 -3
  5. package/dist/components/Newsletter/Newsletter.js +1 -3
  6. package/dist/components/NotificationCounter/NotificationCounter.styles.js +1 -2
  7. package/dist/components/SmartLink/SmartLink.js +0 -2
  8. package/dist/components/StepController/StepController.js +3 -5
  9. package/dist/components/StepController/StepController.styles.js +102 -1
  10. package/dist/components/StepController/StepControllerProgress.js +1 -1
  11. package/dist/components/Switch/Switch.js +1 -3
  12. package/dist/components/ToDoList/ToDoListTask.js +15 -3
  13. package/dist/components/taxId/register-taxid.js +7 -5
  14. package/dist/index.js +67 -141
  15. package/dist/runtime-config.js +4 -70
  16. package/dist/styles/global.js +1 -2
  17. package/dist/styles/ioniconsStyles.js +13 -10
  18. package/dist/utils/check-todo-status.js +1 -2
  19. package/package.json +8 -14
  20. package/dist/api/authenticationApi.js +0 -13
  21. package/dist/auth/index.js +0 -34
  22. package/dist/components/2FA/Connect2FA.js +0 -58
  23. package/dist/components/2FA/EnterCode.js +0 -74
  24. package/dist/components/2FA/InstallAuthApp.js +0 -68
  25. package/dist/components/2FA/ResetCode.js +0 -34
  26. package/dist/components/2FA/Sucess2FA.js +0 -63
  27. package/dist/components/2FA/disable-2fa-flow.js +0 -104
  28. package/dist/components/2FA/enable-2fa-flow.js +0 -167
  29. package/dist/components/2FA/login-with-otp-flow.js +0 -262
  30. package/dist/components/2FA/main-flow.js +0 -273
  31. package/dist/components/Footer/Footer.js +0 -69
  32. package/dist/components/Footer/Footer.styles.js +0 -277
  33. package/dist/components/Footer/FooterLayout.js +0 -150
  34. package/dist/components/Footer/FooterMenu.js +0 -107
  35. package/dist/components/Footer/FooterMenu.styles.js +0 -334
  36. package/dist/components/ForgotPasswordModal/ForgotPasswordModal.js +0 -121
  37. package/dist/components/Header/Header.js +0 -441
  38. package/dist/components/Header/Header.styles.js +0 -568
  39. package/dist/components/Layout/Layout.js +0 -76
  40. package/dist/components/LoginModal/LoginModal.js +0 -165
  41. package/dist/components/MainMenu/DynamicMainMenu.js +0 -38
  42. package/dist/components/MainMenu/MainMenu.js +0 -220
  43. package/dist/components/MainMenu/MainMenu.styles.js +0 -362
  44. package/dist/components/Modal/NewVentureModal/NewVentureModal.js +0 -273
  45. package/dist/components/RegisterConfirmModal/RegisterConfirmModal.js +0 -74
  46. package/dist/components/RegisterConfirmModal/RegisterConfirmModal.styles.js +0 -20
  47. package/dist/components/RegisterModal/RegisterModal.js +0 -278
  48. package/dist/components/ResetConfirmModal/ResetConfirmModal.js +0 -40
  49. package/dist/components/ResetConfirmModal/ResetConfirmModal.styles.js +0 -41
  50. package/dist/components/ResetPasswordModal/ResetPasswordModal.js +0 -145
  51. package/dist/components/StepsProgress/StepIndicator.js +0 -40
  52. package/dist/components/StepsProgress/StepIndicator.styles.js +0 -69
  53. package/dist/components/StepsProgress/StepsProgress.js +0 -67
  54. package/dist/components/StepsProgress/StepsProgress.styles.js +0 -105
  55. package/dist/components/TermsModal/TermsModal.js +0 -145
  56. package/dist/components/TermsModal/_styles.js +0 -313
  57. package/dist/components/VerifyEmailModal/VerifyEmailModal.js +0 -122
  58. package/dist/components/headerHo/HeaderHo.js +0 -707
  59. package/dist/config.js +0 -33
  60. package/dist/context/Auth.js +0 -423
  61. package/dist/context/AuthContext.js +0 -1016
  62. package/dist/firebase-config.js +0 -56
  63. package/dist/hooks/useNewVentureForm.js +0 -235
  64. package/dist/static/images/background3.png.js +0 -4
  65. package/dist/static/images/google_auth.png.js +0 -4
  66. package/dist/static/images/iso27001-black.svg.js +0 -4
  67. package/dist/static/images/mangopay.svg.js +0 -4
  68. package/dist/static/images/social/Facebook_Logo.png.js +0 -4
  69. package/dist/static/images/social/LI-In-Bug.png.js +0 -4
  70. package/dist/static/images/social/Telegram-Logo.png.js +0 -4
  71. package/dist/static/images/social/X-logo-black.png.js +0 -4
  72. package/dist/static/images/social/youtube_social_circle_red.png.js +0 -4
  73. package/dist/utils/show-account-locked-modal.js +0 -23
  74. package/dist/utils/user-identity.js +0 -10
  75. package/dist/utils/withRouter.js +0 -26
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stokr/components-library",
3
- "version": "3.0.77",
3
+ "version": "3.1.0",
4
4
  "description": "STOKR - Components Library",
5
5
  "author": "Bilal Hodzic <bilal@stokr.io>",
6
6
  "license": "MIT",
@@ -16,11 +16,6 @@
16
16
  "import": "./dist/index.js",
17
17
  "default": "./dist/index.js"
18
18
  },
19
- "./auth": {
20
- "import": "./dist/auth/index.js",
21
- "default": "./dist/auth/index.js"
22
- },
23
- "./auth/index.js": "./dist/auth/index.js",
24
19
  "./ionicons.css": "./dist/static/fonts/Ionicons/ionicons.min.css",
25
20
  "./dist/*": "./dist/static/*"
26
21
  },
@@ -61,7 +56,6 @@
61
56
  "date-fns": "^4.1.0",
62
57
  "date-fns-tz": "^3.2.0",
63
58
  "dompurify": "^3.2.4",
64
- "firebase": "^12.4.0",
65
59
  "formik": "^2.2.9",
66
60
  "html-react-parser": "^5.0.6",
67
61
  "js-cookie": "^3.0.5",
@@ -92,13 +86,13 @@
92
86
  "styled-components": "^6.0.0"
93
87
  },
94
88
  "devDependencies": {
95
- "@chromatic-com/storybook": "^5.1.2",
89
+ "@chromatic-com/storybook": "^5.3.1",
96
90
  "@eslint-react/eslint-plugin": "^1.53.1",
97
91
  "@eslint/js": "^9.39.2",
98
- "@storybook/addon-docs": "^10.3.6",
99
- "@storybook/addon-links": "^10.3.6",
100
- "@storybook/builder-vite": "^10.3.6",
101
- "@storybook/react-vite": "^10.3.6",
92
+ "@storybook/addon-docs": "^10.6.0",
93
+ "@storybook/addon-links": "^10.6.0",
94
+ "@storybook/builder-vite": "^10.6.0",
95
+ "@storybook/react-vite": "^10.6.0",
102
96
  "@types/node": "^25.0.10",
103
97
  "@types/react": "^19.2.9",
104
98
  "@types/react-dom": "^19.2.3",
@@ -113,13 +107,13 @@
113
107
  "eslint-plugin-react": "^7.37.2",
114
108
  "eslint-plugin-react-hooks": "^7.0.1",
115
109
  "eslint-plugin-react-refresh": "^0.4.26",
116
- "eslint-plugin-storybook": "10.3.6",
110
+ "eslint-plugin-storybook": "10.6.0",
117
111
  "http-server": "^14.1.1",
118
112
  "prettier": "^3.8.1",
119
113
  "react": "^19.2.3",
120
114
  "react-dom": "^19.2.3",
121
115
  "react-router-dom": "^6.30.3",
122
- "storybook": "^10.3.6",
116
+ "storybook": "^10.6.0",
123
117
  "styled-components": "^6.0.7",
124
118
  "typescript": "^5.9.3",
125
119
  "typescript-eslint": "^8.54.0",
@@ -1,13 +0,0 @@
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
- };
@@ -1,34 +0,0 @@
1
- import { configure } from "../config.js";
2
- import { Auth, DEFAULT_TOKEN_EXPIRY_MS } from "../context/Auth.js";
3
- import { AuthConsumer, AuthContext, AuthProvider } from "../context/AuthContext.js";
4
- import { LoadingDots, StokrLoader, StokrLoaderBox } from "../components/StokrLoader/StokrLoader.js";
5
- import { default as default2 } from "../components/2FA/Connect2FA.js";
6
- import { default as default3 } from "../components/2FA/enable-2fa-flow.js";
7
- import { default as default4 } from "../components/2FA/EnterCode.js";
8
- import { default as default5 } from "../components/2FA/InstallAuthApp.js";
9
- import { default as default6 } from "../components/2FA/login-with-otp-flow.js";
10
- import { default as default7 } from "../components/2FA/main-flow.js";
11
- import { default as default8 } from "../components/2FA/ResetCode.js";
12
- import { default as default9 } from "../components/2FA/Sucess2FA.js";
13
- import { getConfig, resetRuntimeConfig } from "../runtime-config.js";
14
- export {
15
- Auth,
16
- AuthConsumer,
17
- AuthContext,
18
- AuthProvider,
19
- default2 as Connect2FA,
20
- DEFAULT_TOKEN_EXPIRY_MS,
21
- default3 as Enable2FAFlow,
22
- default4 as EnterCode,
23
- default5 as InstallAuthApp,
24
- LoadingDots,
25
- default6 as LoginWithOTPFlow,
26
- default7 as Main2FAFlow,
27
- default8 as ResetCode,
28
- StokrLoader,
29
- StokrLoaderBox,
30
- default9 as Sucess2FA,
31
- configure,
32
- getConfig,
33
- resetRuntimeConfig
34
- };
@@ -1,58 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import "react";
3
- import { sizes } from "../../styles/rwd.js";
4
- import { Text } from "../Text/Text.styles.js";
5
- import stdin_default$2 from "../Button/Button.styles.js";
6
- import { ComponentWrapper } from "../ComponentWrapper/ComponentWrapper.styles.js";
7
- import { ModalWrapper, ModalInner } from "../Modal/Modal.styles.js";
8
- import { QRCodeSVG } from "qrcode.react";
9
- import { Row, Column } from "../Grid/Grid.styles.js";
10
- import stdin_default$1 from "../CryptoAddress/CryptoAddress.js";
11
- import { useMobileView } from "../../utils/customHooks.js";
12
- const Connect2FA = (props) => {
13
- const { changeStep, totpData } = props;
14
- const isMobile = useMobileView(sizes.Mobile);
15
- return /* @__PURE__ */ jsx(ModalWrapper, { children: /* @__PURE__ */ jsxs(Row, { children: [
16
- /* @__PURE__ */ jsxs(Column, { part: 8, children: [
17
- /* @__PURE__ */ jsx(ModalInner, { modalTop: true, children: /* @__PURE__ */ jsxs(Text, { children: [
18
- /* @__PURE__ */ jsx("h3", { children: "Activate log in 2FA" }),
19
- /* @__PURE__ */ jsx("p", { children: "1. Open your authenticator app" }),
20
- /* @__PURE__ */ jsx("p", { children: isMobile ? "2. Copy the set up key" : "2. Scan the QR code or copy the set up key" })
21
- ] }) }),
22
- /* @__PURE__ */ jsx(ModalInner, { modalBot: true })
23
- ] }),
24
- /* @__PURE__ */ jsx(Column, { part: 8, children: /* @__PURE__ */ jsxs(ModalInner, { children: [
25
- totpData && /* @__PURE__ */ jsxs(ComponentWrapper, { center: true, noPaddingHorizontal: true, children: [
26
- !isMobile && /* @__PURE__ */ jsx(QRCodeSVG, { size: 180, value: totpData?.totpUri }),
27
- /* @__PURE__ */ jsx(
28
- stdin_default$1,
29
- {
30
- data: {
31
- value: totpData.totpSecret?.secretKey,
32
- tooltip: true
33
- },
34
- fontSize: 11,
35
- wrapperStyle: { paddingRight: 0 },
36
- dataBoxStyle: { width: "100%", whiteSpace: "nowrap" }
37
- }
38
- )
39
- ] }),
40
- /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingTop: true, noPaddingBottom: true, center: true, noPaddingHorizontal: true, children: /* @__PURE__ */ jsx(
41
- stdin_default$2,
42
- {
43
- minWidth: "150px",
44
- id: "enable-2fa-connect-continue-btn",
45
- "data-cy": "enable-2fa-connect-continue",
46
- onClick: changeStep,
47
- fluid: true,
48
- children: "Continue"
49
- }
50
- ) })
51
- ] }) })
52
- ] }) });
53
- };
54
- var stdin_default = Connect2FA;
55
- export {
56
- Connect2FA,
57
- stdin_default as default
58
- };
@@ -1,74 +0,0 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import "react";
3
- import { Formik } from "formik";
4
- import { Modal } from "../Modal/Modal.js";
5
- import stdin_default$1 from "../Form/Form.js";
6
- import { Text } from "../Text/Text.styles.js";
7
- import stdin_default$3 from "../Button/Button.styles.js";
8
- import { Row, Column } from "../Grid/Grid.styles.js";
9
- import { ComponentWrapper } from "../ComponentWrapper/ComponentWrapper.styles.js";
10
- import stdin_default$2 from "../Input/OtpInput.js";
11
- import { ModalInner, ModalLinkWrap, ModalLink } from "../Modal/Modal.styles.js";
12
- import { FormField, FormError } from "../Form/Form.styles.js";
13
- const Wrapper = ({ isModal, children, isModalOpen, onModalClose, background }) => isModal ? /* @__PURE__ */ jsx(Modal, { isOpen: isModalOpen, onClose: onModalClose, background, children }) : /* @__PURE__ */ jsx(Fragment, { children });
14
- const EnterCode = (props) => {
15
- const { popupError = {}, onFormSend, onModalSwitch, isModal, isActionLoading } = props;
16
- return /* @__PURE__ */ jsx(Wrapper, { isModal, ...props, children: /* @__PURE__ */ jsxs(Row, { children: [
17
- /* @__PURE__ */ jsxs(Column, { part: 8, children: [
18
- /* @__PURE__ */ jsx(ModalInner, { modalTop: true, children: /* @__PURE__ */ jsxs(Text, { children: [
19
- /* @__PURE__ */ jsx("h3", { children: "TWO-FACTOR AUTHENTICATION" }),
20
- /* @__PURE__ */ jsx("p", { children: "Enter the verification code from your authenticator application." })
21
- ] }) }),
22
- /* @__PURE__ */ jsx(ModalInner, { modalBot: true, children: onModalSwitch && /* @__PURE__ */ jsx(ModalLinkWrap, { children: /* @__PURE__ */ jsx(ModalLink, { type: "button", as: "button", "data-cy": "2fa-enter-code-lost-device", onClick: onModalSwitch, children: "Lost access to your device?" }) }) })
23
- ] }),
24
- /* @__PURE__ */ jsx(Column, { part: 8, children: /* @__PURE__ */ jsx(ModalInner, { children: /* @__PURE__ */ jsx(
25
- Formik,
26
- {
27
- initialValues: { otpInput: "" },
28
- onSubmit: (values) => {
29
- onFormSend(values);
30
- },
31
- children: ({ values, errors, touched, setFieldValue, setFieldTouched }) => {
32
- const submitDisabled = !touched.otpInput || !values.otpInput || isActionLoading === "enter2fa";
33
- return /* @__PURE__ */ jsxs(stdin_default$1, { children: [
34
- /* @__PURE__ */ jsx(ComponentWrapper, { noPadding: true, children: /* @__PURE__ */ jsxs(FormField, { children: [
35
- /* @__PURE__ */ jsx(
36
- stdin_default$2,
37
- {
38
- id: "otp-input",
39
- name: "otpInput",
40
- numInputs: 6,
41
- dataCyPrefix: "2fa-enter-code-otp",
42
- value: values.otpInput,
43
- onChange: (e) => {
44
- setFieldValue("otpInput", e);
45
- setFieldTouched("otpInput");
46
- },
47
- label: "2FA code"
48
- }
49
- ),
50
- /* @__PURE__ */ jsx(FormError, { show: errors.otpInput && touched.otpInput, children: errors.otpInput })
51
- ] }) }),
52
- /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingBottom: true, noPaddingHorizontal: true, children: /* @__PURE__ */ jsx(
53
- stdin_default$3,
54
- {
55
- type: "submit",
56
- id: "2fa-enter-code-btn",
57
- "data-cy": "2fa-enter-code-submit",
58
- fluid: true,
59
- disabled: submitDisabled,
60
- children: "Continue"
61
- }
62
- ) }),
63
- /* @__PURE__ */ jsx(ComponentWrapper, { paddingVeticalHalf: true, noPaddingHorizontal: true, children: /* @__PURE__ */ jsx(FormError, { show: popupError?.popup === "enter2fa", children: popupError.message }) })
64
- ] });
65
- }
66
- }
67
- ) }) })
68
- ] }) });
69
- };
70
- var stdin_default = EnterCode;
71
- export {
72
- EnterCode,
73
- stdin_default as default
74
- };
@@ -1,68 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import "react";
3
- import { Text } from "../Text/Text.styles.js";
4
- import stdin_default$1 from "../Button/Button.styles.js";
5
- import { Row, Column } from "../Grid/Grid.styles.js";
6
- import { ModalWrapper, ModalInner } from "../Modal/Modal.styles.js";
7
- import GoogleAuthLogo from "../../static/images/google_auth.png.js";
8
- import { ComponentWrapper } from "../ComponentWrapper/ComponentWrapper.styles.js";
9
- const InstallAuthApp = (props) => {
10
- const { changeStep } = props;
11
- return /* @__PURE__ */ jsx(ModalWrapper, { children: /* @__PURE__ */ jsxs(Row, { children: [
12
- /* @__PURE__ */ jsxs(Column, { part: 8, children: [
13
- /* @__PURE__ */ jsx(ModalInner, { modalTop: true, children: /* @__PURE__ */ jsxs(Text, { children: [
14
- /* @__PURE__ */ jsx("h3", { children: "Install 2FA APP" }),
15
- /* @__PURE__ */ jsx("p", { children: "Download and install a 2FA app on your device. We recommend using Google Authenticator" })
16
- ] }) }),
17
- /* @__PURE__ */ jsx(ModalInner, { modalBot: true })
18
- ] }),
19
- /* @__PURE__ */ jsx(Column, { part: 8, children: /* @__PURE__ */ jsxs(ModalInner, { children: [
20
- /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingTop: true, noPaddingHorizontal: true, children: /* @__PURE__ */ jsx(Text, { small: true, children: /* @__PURE__ */ jsx("p", { children: "Click 'Continue' if you already have an app installed." }) }) }),
21
- /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingHorizontal: true, center: true, children: /* @__PURE__ */ jsxs(
22
- stdin_default$1,
23
- {
24
- minWidth: "150px",
25
- id: "enable-2fa-download-app-btn",
26
- "data-cy": "enable-2fa-download-auth-app",
27
- fluid: true,
28
- onClick: () => {
29
- window.open("https://onelink.to/ev63j9", "_blank");
30
- },
31
- secondary: true,
32
- children: [
33
- "DOWNLOAD THE APP",
34
- " ",
35
- /* @__PURE__ */ jsx(
36
- "img",
37
- {
38
- src: GoogleAuthLogo,
39
- width: 20,
40
- style: {
41
- verticalAlign: "middle",
42
- marginLeft: "6px",
43
- marginTop: "-3px"
44
- },
45
- alt: "google auth logo"
46
- }
47
- )
48
- ]
49
- }
50
- ) }),
51
- /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingHorizontal: true, noPaddingTop: true, center: true, children: /* @__PURE__ */ jsx(
52
- stdin_default$1,
53
- {
54
- minWidth: "150px",
55
- id: "enable-2fa-install-app-continue-btn",
56
- "data-cy": "enable-2fa-install-app-continue",
57
- onClick: changeStep,
58
- fluid: true,
59
- children: "Continue"
60
- }
61
- ) })
62
- ] }) })
63
- ] }) });
64
- };
65
- var stdin_default = InstallAuthApp;
66
- export {
67
- stdin_default as default
68
- };
@@ -1,34 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import "react";
3
- import { Text } from "../Text/Text.styles.js";
4
- import { Row, Column } from "../Grid/Grid.styles.js";
5
- import { Modal } from "../Modal/Modal.js";
6
- import { ModalInner, ModalLinkWrap, ModalLink } from "../Modal/Modal.styles.js";
7
- const ResetCode = (props) => {
8
- const { onModalSwitch, onModalClose, background, isModalOpen } = props;
9
- return /* @__PURE__ */ jsx(Modal, { isOpen: isModalOpen, onClose: onModalClose, background, children: /* @__PURE__ */ jsxs(Row, { children: [
10
- /* @__PURE__ */ jsxs(Column, { part: 8, children: [
11
- /* @__PURE__ */ jsx(ModalInner, { modalTop: true, children: /* @__PURE__ */ jsxs(Text, { children: [
12
- /* @__PURE__ */ jsx("h3", { children: "AUTHENTICATION DEVICE UNAVAILABLE" }),
13
- /* @__PURE__ */ jsx("p", { children: "Please contact our support team to reset your two-factor authentication." })
14
- ] }) }),
15
- /* @__PURE__ */ jsx(ModalInner, { modalBot: true, children: /* @__PURE__ */ jsx(ModalLinkWrap, { children: /* @__PURE__ */ jsx(ModalLink, { type: "button", as: "button", "data-cy": "2fa-reset-code-back-to-enter-code", onClick: onModalSwitch, children: "Return to log in" }) }) })
16
- ] }),
17
- /* @__PURE__ */ jsx(Column, { part: 8, children: /* @__PURE__ */ jsx(ModalInner, { children: /* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx(
18
- "a",
19
- {
20
- href: "https://stokr.zendesk.com/hc/en-us/requests/new",
21
- target: "_blank",
22
- rel: "noreferrer",
23
- "data-cy": "2fa-reset-code-contact-support",
24
- style: { textDecoration: "underline" },
25
- children: "Contact us to reset your two-factor authentication."
26
- }
27
- ) }) }) }) })
28
- ] }) });
29
- };
30
- var stdin_default = ResetCode;
31
- export {
32
- ResetCode,
33
- stdin_default as default
34
- };
@@ -1,63 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import "react";
3
- import PropTypes from "prop-types";
4
- import { Text } from "../Text/Text.styles.js";
5
- import stdin_default$1 from "../Button/Button.styles.js";
6
- import { ComponentWrapper } from "../ComponentWrapper/ComponentWrapper.styles.js";
7
- import { Row, Column } from "../Grid/Grid.styles.js";
8
- import { ModalWrapper, ModalInner } from "../Modal/Modal.styles.js";
9
- const Sucess2FA = ({
10
- onClick = () => {
11
- },
12
- titleText = "Success!",
13
- subTitleLeft = "",
14
- textRight = "",
15
- buttonText = "Continue",
16
- /** DOM id for the primary action button — override per screen (verify email, enable/disable 2FA, etc.) */
17
- continueButtonId = "success-flow-continue-btn",
18
- /** Playwright / analytics-friendly selector for the primary button */
19
- continueButtonDataCy = "success-flow-continue"
20
- }) => {
21
- return /* @__PURE__ */ jsx(ModalWrapper, { children: /* @__PURE__ */ jsxs(Row, { children: [
22
- /* @__PURE__ */ jsxs(Column, { part: 8, children: [
23
- /* @__PURE__ */ jsx(ModalInner, { modalTop: true, children: /* @__PURE__ */ jsxs(Text, { children: [
24
- /* @__PURE__ */ jsxs("h3", { children: [
25
- titleText,
26
- " "
27
- ] }),
28
- /* @__PURE__ */ jsx("p", { children: subTitleLeft })
29
- ] }) }),
30
- /* @__PURE__ */ jsx(ModalInner, { modalBot: true })
31
- ] }),
32
- /* @__PURE__ */ jsx(Column, { part: 8, children: /* @__PURE__ */ jsxs(ModalInner, { children: [
33
- /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingVertical: true, noPaddingHorizontal: true, children: /* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsx("p", { children: textRight }) }) }),
34
- /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingHorizontal: true, children: /* @__PURE__ */ jsx(
35
- stdin_default$1,
36
- {
37
- id: continueButtonId,
38
- minWidth: "240px",
39
- "data-cy": continueButtonDataCy,
40
- onClick: () => {
41
- onClick();
42
- },
43
- fluid: true,
44
- children: buttonText
45
- }
46
- ) })
47
- ] }) })
48
- ] }) });
49
- };
50
- Sucess2FA.propTypes = {
51
- onClick: PropTypes.func.isRequired,
52
- titleText: PropTypes.string,
53
- subTitleLeft: PropTypes.string,
54
- textRight: PropTypes.string,
55
- buttonText: PropTypes.string,
56
- continueButtonId: PropTypes.string,
57
- continueButtonDataCy: PropTypes.string
58
- };
59
- var stdin_default = Sucess2FA;
60
- export {
61
- Sucess2FA,
62
- stdin_default as default
63
- };
@@ -1,104 +0,0 @@
1
- import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
- import { useContext, useState, useEffect } from "react";
3
- import { AuthContext } from "../../context/AuthContext.js";
4
- import { ComponentWrapper } from "../ComponentWrapper/ComponentWrapper.styles.js";
5
- import { Modal } from "../Modal/Modal.js";
6
- import { ModalInner, ModalWrapper } from "../Modal/Modal.styles.js";
7
- import { Text } from "../Text/Text.styles.js";
8
- import stdin_default$2 from "../Button/Button.styles.js";
9
- import { Row, Column } from "../Grid/Grid.styles.js";
10
- import stdin_default$1 from "./Sucess2FA.js";
11
- import fetchData from "../../api/fetchData.js";
12
- const Disable2FA = ({ showFlow, setShowFlow, onSuccess, onRequiresRecentLoginError }) => {
13
- const { unenrollUser2FA, refreshIdToken } = useContext(AuthContext);
14
- const [isModalOpen, setIsModalOpen] = useState({
15
- confirmDisable: false,
16
- sucess: false
17
- });
18
- const refreshToken = async () => {
19
- try {
20
- refreshIdToken();
21
- } catch (error) {
22
- console.log("🚀 ~ error in refreshToken:", error);
23
- }
24
- };
25
- useEffect(() => {
26
- if (showFlow) {
27
- refreshToken();
28
- setIsModalOpen({
29
- ...isModalOpen,
30
- confirmDisable: true
31
- });
32
- }
33
- }, [showFlow]);
34
- const handleDisableClick = async () => {
35
- try {
36
- await unenrollUser2FA();
37
- setIsModalOpen({
38
- ...isModalOpen,
39
- sucess: true
40
- });
41
- try {
42
- await fetchData("auth/disable-2fa-email");
43
- } catch (error) {
44
- console.log("🚀 ~ error while sending email:", error);
45
- }
46
- } catch (error) {
47
- console.log("🚀 ~ file: disable-2fa-flow.js ~ error:", error);
48
- if (error.code === "auth/requires-recent-login") {
49
- onRequiresRecentLoginError?.();
50
- }
51
- }
52
- };
53
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
54
- Modal,
55
- {
56
- isOpen: isModalOpen.confirmDisable,
57
- onClose: () => {
58
- setShowFlow(false);
59
- },
60
- children: /* @__PURE__ */ jsx(ModalInner, { noPadding: true, children: isModalOpen.sucess ? /* @__PURE__ */ jsx(
61
- stdin_default$1,
62
- {
63
- continueButtonId: "disable-2fa-success-continue-btn",
64
- continueButtonDataCy: "disable-2fa-success-continue",
65
- onClick: () => {
66
- setShowFlow(false);
67
- onSuccess?.();
68
- },
69
- subTitleLeft: "Your log in 2FA authentication is removed",
70
- textRight: "You will not be asked for your 2FA code next time you log in."
71
- }
72
- ) : /* @__PURE__ */ jsx(ModalWrapper, { children: /* @__PURE__ */ jsxs(Row, { children: [
73
- /* @__PURE__ */ jsxs(Column, { part: 8, children: [
74
- /* @__PURE__ */ jsx(ModalInner, { modalTop: true, children: /* @__PURE__ */ jsxs(Text, { children: [
75
- /* @__PURE__ */ jsx("h3", { children: "Remove your log in 2FA authentication? " }),
76
- /* @__PURE__ */ jsx("p", { children: "We recommend you to keep 2FA authentication and protect your account with an additional layer of security" })
77
- ] }) }),
78
- /* @__PURE__ */ jsx(ModalInner, { modalBot: true })
79
- ] }),
80
- /* @__PURE__ */ jsx(Column, { part: 8, children: /* @__PURE__ */ jsxs(ModalInner, { children: [
81
- /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingVertical: true, noPaddingHorizontal: true, children: /* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsx("p", { children: "Do you want to remove your log in 2FA authentication?" }) }) }),
82
- /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingHorizontal: true, children: /* @__PURE__ */ jsx(
83
- stdin_default$2,
84
- {
85
- secondary: true,
86
- style: { marginRight: 20 },
87
- id: "disable-2fa-confirm-no-btn",
88
- "data-cy": "disable-2fa-confirm-no",
89
- onClick: () => setShowFlow(false),
90
- fluid: true,
91
- children: "NO"
92
- }
93
- ) }),
94
- /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingHorizontal: true, noPaddingTop: true, children: /* @__PURE__ */ jsx(stdin_default$2, { id: "disable-2fa-confirm-yes-btn", "data-cy": "disable-2fa-confirm-yes", onClick: handleDisableClick, fluid: true, children: "Yes" }) })
95
- ] }) })
96
- ] }) }) })
97
- }
98
- ) });
99
- };
100
- var stdin_default = Disable2FA;
101
- export {
102
- Disable2FA,
103
- stdin_default as default
104
- };