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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | 10x 93x 93x 93x 1102x 1102x 368x 1102x 1102x 798x 1102x 2189x 93x 10x 406x 406x 1x 406x 406x 406x 1x 1x 1x 406x 10x 4x 10x 3x 10x 4x 3x 3x 3x | import NiceModal from "@ebay/nice-modal-react";
import { LOGOUT_MODAL } from "modals/modal_names";
import { findPhoneNumbersInText } from "libphonenumber-js";
import { GroupedSteps, BaseSteps, IStep } from "./types";
import { WizardFormData } from "@features/GiveOnboarding/types/form";
export const groupStepsByParent = (
steps: BaseSteps,
currentSubstep: IStep,
): GroupedSteps => {
const grouped: GroupedSteps = {};
const st = Object.entries(steps);
st.forEach(([key, value]) => {
const { parent, label, completed, isNextInLine, forceOnClick } = value;
if (!grouped[parent]) {
grouped[parent] = {
steps: [],
completed: true,
isActive: false,
};
}
grouped[parent].steps.push({
key,
label,
completed,
isActive: currentSubstep === key,
isNextInLine,
forceOnClick,
});
if (!completed) {
grouped[parent].completed = false;
}
grouped[parent].isActive = grouped[parent].steps.some(
(step) => step.isActive,
);
});
return grouped;
};
export const parsePhoneNumber = (phoneNumber?: string) => {
let parsedPhoneNumber = phoneNumber;
if (parsedPhoneNumber && !parsedPhoneNumber.startsWith("+")) {
parsedPhoneNumber = `+${parsedPhoneNumber}`;
}
const numbersInText = findPhoneNumbersInText(parsedPhoneNumber || "");
let e164Number = phoneNumber;
if (numbersInText.length > 0) {
const firstMatch = numbersInText[0];
Eif (firstMatch.number) {
e164Number = firstMatch.number.number;
}
}
return e164Number;
};
export const openLogoutModal = ({ isStarted }: { isStarted: boolean }) => {
//similar with onChooseaccount -> we need to block first the show of the logout confirmatino modal
NiceModal.show(LOGOUT_MODAL, {
description: isStarted
? "Changes you made may not be saved. Confirm?"
: "Your onboarding progress will be saved. You can return and continue the process at any time by logging back in.",
});
};
export const toNumber = (val = "") =>
Number(val?.toString()?.replace(/,/g, "")) * 100;
export const getTaxIdentifier = (
businessProfile?: WizardFormData["business_profile"],
) => {
if (!businessProfile) return {};
const key = businessProfile.tinType === "ssn" ? "ssn" : "taxIDNumber";
const value = businessProfile?.[key];
return value ? { [key]: value } : {};
};
|