All files / src/sections/PayBuilder/LaunchStep LaunchStep.tsx

100% Statements 7/7
100% Branches 2/2
100% Functions 3/3
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 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                        45x 12x   10x 10x   10x                             8x   2x                                                    
import { Stack } from "@mui/material";
 
import { QFORM_QUERY_KEY } from "@pages/AcquirerPortal/Enterprises/Modal/constants";
import GiveText from "@shared/Text/GiveText";
import { useAppTheme } from "@theme/v2/Provider";
import StyleWarningMessage from "features/Minibuilders/PaymentFormMinibuilder/StyleWarningMessage";
import { FC } from "react";
import { usePayBuilderForm } from "../provider/PayBuilderFormProvider";
import { useQueryObserver } from "./hooks/useQueryObserver";
import PublicUrlShare from "./PublicURLShare/PublicURLShare";
import { TQueryDataLaunchStepPaymentFormKey } from "./types";
 
const LaunchStep: FC<any> = () => {
  const { palette } = useAppTheme();
  const { queryData } =
    useQueryObserver<TQueryDataLaunchStepPaymentFormKey>(QFORM_QUERY_KEY);
  const { mutate } = usePayBuilderForm();
 
  return (
    <Stack gap={2}>
      {typeof queryData?.product?.id !== "number" && (
        <StyleWarningMessage
          title="Almost There! Launch Your Form."
          strokeIconColor={palette.primitive?.warning[50]}
          sx={{
            border: `1px solid  ${palette.primitive?.warning[50]}`,
            backgroundColor: palette.primitive?.warning[10],
            fontSize: "14px",
            alignItems: "flex-start",
            marginX: "0px",
          }}
          description="To generate your shareable link, you'll need to either publish your form now or save it as a draft to work on later."
          renderAction={() => (
            <GiveText
              onClick={() => {
                mutate({
                  shouldNavigate: false,
                });
              }}
              sx={{
                color: palette.primitive?.warning[100],
                fontSize: "14px",
                cursor: "pointer",
                width: "fit-content",
                "&:hover": {
                  textDecoration: "underline",
                },
              }}
            >
              Save as Draft
            </GiveText>
          )}
        />
      )}
 
      <PublicUrlShare variant="large" />
    </Stack>
  );
};
 
export default LaunchStep;