@stokr/components-library 3.0.60 → 3.0.62

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.
@@ -83,7 +83,7 @@ const Enable2FAFlow = ({ showFlow, setShowFlow, onSuccess, totpData, onRequiresR
83
83
  subTitleLeft: "Your log in 2FA authentication is now set",
84
84
  textRight: "You will now be asked for your 2FA code next time you log in."
85
85
  }
86
- ) : /* @__PURE__ */ jsx(StepControllerProvider, { children: /* @__PURE__ */ jsx(StepControllerConsumer, { children: (stepController) => {
86
+ ) : /* @__PURE__ */ jsx(StepControllerProvider, { initialStep: "app", children: /* @__PURE__ */ jsx(StepControllerConsumer, { children: (stepController) => {
87
87
  const prevStepIndex = stepController.activeStepIndex - 1;
88
88
  return /* @__PURE__ */ jsxs(Fragment, { children: [
89
89
  /* @__PURE__ */ jsx(
@@ -25,7 +25,10 @@ const Main2FAFlow = ({
25
25
  subtitle = "Protect your account with an additional layer of security to log in",
26
26
  showSwitch = true,
27
27
  customComponent,
28
- onFlowClose
28
+ onFlowClose,
29
+ recentLoginTitle = "LOG IN AGAIN",
30
+ recentLoginSubtitle = "To continue please log in again and set up your two factor authentication",
31
+ recentLoginCTA = "Log in again"
29
32
  }) => {
30
33
  const { user, checkMfaEnrollment, userMfaEnrollment, generateTotpSecret } = useContext(AuthContext);
31
34
  const [isFlowopen, setIsFlowOpen] = useState({
@@ -224,9 +227,9 @@ const Main2FAFlow = ({
224
227
  onClick: () => {
225
228
  onLoginAgainClick?.();
226
229
  },
227
- titleText: "LOG IN AGAIN",
228
- subTitleLeft: "To enable your log in two factor authentication please log in again",
229
- buttonText: "Log in again"
230
+ titleText: recentLoginTitle,
231
+ subTitleLeft: recentLoginSubtitle,
232
+ buttonText: recentLoginCTA
230
233
  }
231
234
  ) }) }),
232
235
  !user && /* @__PURE__ */ jsx(stdin_default$5, {})
@@ -2,6 +2,10 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import styled from "styled-components";
3
3
  import { useRef, useState, useCallback, useEffect } from "react";
4
4
  import { useInView } from "react-intersection-observer";
5
+ const ViewportWrapper = styled.div`
6
+ width: 100%;
7
+ height: 100%;
8
+ `;
5
9
  const VideoContainer = styled.div`
6
10
  position: relative;
7
11
  width: 100%;
@@ -21,7 +25,7 @@ const CLOUDINARY_VERSION = "v1745923531";
21
25
  const CLOUDINARY_PUBLIC_ID = "Static/Hero_section_video_kuatj1";
22
26
  const VIDEO_SRC_DESKTOP = `${CLOUDINARY_BASE}/f_auto,q_auto:good,vc_auto,w_1920,c_limit/${CLOUDINARY_VERSION}/${CLOUDINARY_PUBLIC_ID}.mp4`;
23
27
  const VIDEO_SRC_MOBILE = `${CLOUDINARY_BASE}/f_auto,q_auto:good,vc_auto,w_1280,c_limit/${CLOUDINARY_VERSION}/${CLOUDINARY_PUBLIC_ID}.mp4`;
24
- const VIDEO_POSTER = `${CLOUDINARY_BASE}/so_0,f_auto,q_auto:good,w_1920,c_limit/${CLOUDINARY_VERSION}/${CLOUDINARY_PUBLIC_ID}.jpg`;
28
+ const VIDEO_POSTER = `${CLOUDINARY_BASE}/so_auto,f_jpg,q_auto:good,w_1920,c_limit/${CLOUDINARY_VERSION}/${CLOUDINARY_PUBLIC_ID}.jpg`;
25
29
  const shouldLoadVideo = () => {
26
30
  if (typeof navigator === "undefined") return true;
27
31
  const conn = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
@@ -105,7 +109,7 @@ const HeroVideoBlock = () => {
105
109
  document.removeEventListener("visibilitychange", handleDocVisibilityChange);
106
110
  };
107
111
  }, [playVideo]);
108
- return /* @__PURE__ */ jsx("div", { ref: windowViewportRef, children: /* @__PURE__ */ jsx(VideoContainer, { children: /* @__PURE__ */ jsx(
112
+ return /* @__PURE__ */ jsx(ViewportWrapper, { ref: windowViewportRef, children: /* @__PURE__ */ jsx(VideoContainer, { children: /* @__PURE__ */ jsx(
109
113
  VideoBackground,
110
114
  {
111
115
  ref: videoRef,
@@ -1,32 +1,14 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import React__default, { PureComponent, Fragment } from "react";
3
3
  import PropTypes from "prop-types";
4
- import { Transition } from "../../utils/transition.js";
5
4
  import { StepsProgressContainer, StepContainer } from "./StepController.styles.js";
6
5
  import stdin_default$1 from "./StepControllerProgress.js";
7
- const timeout = 300;
8
- const getTransitionStyles = {
9
- entering: {
10
- position: "absolute",
11
- opacity: 0
12
- },
13
- entered: {
14
- transition: `opacity ${timeout}ms ease-in-out`,
15
- opacity: 1
16
- },
17
- exiting: {
18
- transition: `opacity ${timeout}ms ease-in-out`,
19
- opacity: 0
20
- }
21
- };
22
6
  class StepController extends PureComponent {
23
- constructor(props) {
24
- super(props);
25
- this.stepRef = React__default.createRef();
26
- }
27
7
  componentDidMount() {
28
- const { changeStep, stepsProgressList } = this.props;
29
- changeStep(stepsProgressList[0].id);
8
+ const { changeStep, stepsProgressList, currentStep } = this.props;
9
+ if (!currentStep && stepsProgressList[0]?.id) {
10
+ changeStep(stepsProgressList[0].id);
11
+ }
30
12
  }
31
13
  render() {
32
14
  const { children, stepsProgressList, currentStep, activeStepIndex, doneStepsIndexes, touchedStepsIndexes } = this.props;
@@ -40,33 +22,12 @@ class StepController extends PureComponent {
40
22
  stepsProgressList
41
23
  }
42
24
  ) }),
43
- /* @__PURE__ */ jsx(StepContainer, { children: /* @__PURE__ */ jsx(
44
- Transition,
45
- {
46
- timeout: {
47
- enter: timeout,
48
- exit: timeout
49
- },
50
- nodeRef: this.stepRef,
51
- children: (status) => /* @__PURE__ */ jsx(
52
- "div",
53
- {
54
- ref: this.stepRef,
55
- style: {
56
- height: "100%",
57
- ...getTransitionStyles[status]
58
- },
59
- children: React__default.Children.map(children, (child) => {
60
- if (child.props.id === currentStep && React__default.isValidElement(child)) {
61
- return /* @__PURE__ */ jsx(Fragment, { children: child }, child.props.id);
62
- }
63
- return null;
64
- })
65
- }
66
- )
67
- },
68
- currentStep
69
- ) })
25
+ /* @__PURE__ */ jsx(StepContainer, { children: /* @__PURE__ */ jsx("div", { style: { height: "100%" }, children: React__default.Children.map(children, (child) => {
26
+ if (child.props.id === currentStep && React__default.isValidElement(child)) {
27
+ return /* @__PURE__ */ jsx(Fragment, { children: child }, child.props.id);
28
+ }
29
+ return null;
30
+ }) }) })
70
31
  ] });
71
32
  }
72
33
  }
@@ -3,14 +3,18 @@ import React__default, { Component } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  const StepControllerContext = React__default.createContext();
5
5
  class StepControllerProvider extends Component {
6
- state = {
7
- currentStep: "",
8
- prevStep: "",
9
- prevStepIndex: null,
10
- activeStepIndex: 0,
11
- doneStepsIndexes: [],
12
- touchedStepsIndexes: []
13
- };
6
+ constructor(props) {
7
+ super(props);
8
+ const { initialStep = "" } = props;
9
+ this.state = {
10
+ currentStep: initialStep,
11
+ prevStep: "",
12
+ prevStepIndex: null,
13
+ activeStepIndex: 0,
14
+ doneStepsIndexes: [],
15
+ touchedStepsIndexes: initialStep ? [0] : []
16
+ };
17
+ }
14
18
  changeStep = (stepName, activeStep = null, doneStep = null) => {
15
19
  const { activeStepIndex, doneStepsIndexes, touchedStepsIndexes } = this.state;
16
20
  const nextActiveStep = activeStep === null ? activeStepIndex : activeStep;
@@ -55,7 +59,8 @@ class StepControllerProvider extends Component {
55
59
  }
56
60
  }
57
61
  StepControllerProvider.propTypes = {
58
- children: PropTypes.node.isRequired
62
+ children: PropTypes.node.isRequired,
63
+ initialStep: PropTypes.string
59
64
  };
60
65
  const StepControllerConsumer = StepControllerContext.Consumer;
61
66
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stokr/components-library",
3
- "version": "3.0.60",
3
+ "version": "3.0.62",
4
4
  "description": "STOKR - Components Library",
5
5
  "author": "Bilal Hodzic <bilal@stokr.io>",
6
6
  "license": "MIT",