IO-3020 Resolve smart scheduling upsell displays when they shouldn't.

This commit is contained in:
Patrick Fic
2024-12-16 10:26:03 -08:00
parent 54b8f564e4
commit 98f7147378
4 changed files with 44 additions and 29 deletions

View File

@@ -8,6 +8,7 @@ import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors"; import { selectBodyshop } from "../../redux/user/user.selectors";
import BlurWrapperComponent from "../feature-wrapper/blur-wrapper.component"; import BlurWrapperComponent from "../feature-wrapper/blur-wrapper.component";
import { UpsellMaskWrapper, upsellEnum } from "../upsell/upsell.component"; import { UpsellMaskWrapper, upsellEnum } from "../upsell/upsell.component";
import { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop bodyshop: selectBodyshop
@@ -35,21 +36,10 @@ export function ScheduleCalendarHeaderGraph({ bodyshop, loadData }) {
[] []
); );
}, [loadData, ssbuckets]); }, [loadData, ssbuckets]);
const hasSmartSchedulingAccess = HasFeatureAccess({ featureName: "smartscheduling", bodyshop });
const popContent = ( const chartContents = (
<div> <>
<Space>
{t("appointments.labels.expectedprodhrs")}
<BlurWrapperComponent featureName="smartscheduling">
<strong>{loadData?.expectedHours?.toFixed(1)}</strong>
</BlurWrapperComponent>
{t("appointments.labels.expectedjobs")}
<BlurWrapperComponent featureName="smartscheduling">
<strong>{loadData?.expectedJobCount}</strong>
</BlurWrapperComponent>
</Space>
<UpsellMaskWrapper upsell={upsellEnum().smartscheduling.general}>
<BlurWrapperComponent featureName="smartscheduling">
<RadarChart <RadarChart
// cx={300} // cx={300}
// cy={250} // cy={250}
@@ -66,8 +56,28 @@ export function ScheduleCalendarHeaderGraph({ bodyshop, loadData }) {
<Tooltip /> <Tooltip />
<Legend /> <Legend />
</RadarChart> </RadarChart>
</>
);
const popContent = (
<div>
<Space>
{t("appointments.labels.expectedprodhrs")}
<BlurWrapperComponent featureName="smartscheduling">
<strong>{loadData?.expectedHours?.toFixed(1)}</strong>
</BlurWrapperComponent>
{t("appointments.labels.expectedjobs")}
<BlurWrapperComponent featureName="smartscheduling">
<strong>{loadData?.expectedJobCount}</strong>
</BlurWrapperComponent>
</Space>
<BlurWrapperComponent featureName="smartscheduling">
{hasSmartSchedulingAccess ? (
chartContents
) : (
<UpsellMaskWrapper upsell={upsellEnum().smartscheduling.general}>{chartContents}</UpsellMaskWrapper>
)}
</BlurWrapperComponent> </BlurWrapperComponent>
</UpsellMaskWrapper>
</div> </div>
); );

View File

@@ -18,6 +18,7 @@ import OwnerNameDisplay from "../owner-name-display/owner-name-display.component
import ScheduleBlockDay from "../schedule-block-day/schedule-block-day.component"; import ScheduleBlockDay from "../schedule-block-day/schedule-block-day.component";
import ScheduleCalendarHeaderGraph from "./schedule-calendar-header-graph.component"; import ScheduleCalendarHeaderGraph from "./schedule-calendar-header-graph.component";
import UpsellComponent, { upsellEnum, UpsellMaskWrapper } from "../upsell/upsell.component"; import UpsellComponent, { upsellEnum, UpsellMaskWrapper } from "../upsell/upsell.component";
import { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop, bodyshop: selectBodyshop,
@@ -52,6 +53,7 @@ export function ScheduleCalendarHeaderComponent({
const { t } = useTranslation(); const { t } = useTranslation();
const loadData = load[date.toISOString().substr(0, 10)]; const loadData = load[date.toISOString().substr(0, 10)];
const hasSmartSchedulingAccess = HasFeatureAccess({ featureName: "smartscheduling", bodyshop });
const jobsOutPopup = () => ( const jobsOutPopup = () => (
<div onClick={(e) => e.stopPropagation()}> <div onClick={(e) => e.stopPropagation()}>
@@ -89,9 +91,11 @@ export function ScheduleCalendarHeaderComponent({
)} )}
</tbody> </tbody>
</table> </table>
{!hasSmartSchedulingAccess && (
<Card style={{ maxWidth: "30rem" }}> <Card style={{ maxWidth: "30rem" }}>
<UpsellComponent size="small" upsell={upsellEnum().smartscheduling.hrsdelta} /> <UpsellComponent size="small" upsell={upsellEnum().smartscheduling.hrsdelta} />
</Card> </Card>
)}
</div> </div>
); );
@@ -129,9 +133,11 @@ export function ScheduleCalendarHeaderComponent({
</BlurWrapperComponent> </BlurWrapperComponent>
</tr> </tr>
)} )}
{!hasSmartSchedulingAccess && (
<Card style={{ maxWidth: "30rem" }}> <Card style={{ maxWidth: "30rem" }}>
<UpsellComponent size="small" upsell={upsellEnum().smartscheduling.hrsdelta} /> <UpsellComponent size="small" upsell={upsellEnum().smartscheduling.hrsdelta} />
</Card> </Card>
)}
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@@ -16,7 +16,7 @@ import ScheduleDayViewContainer from "../schedule-day-view/schedule-day-view.con
import ScheduleExistingAppointmentsList from "../schedule-existing-appointments-list/schedule-existing-appointments-list.component"; import ScheduleExistingAppointmentsList from "../schedule-existing-appointments-list/schedule-existing-appointments-list.component";
import "./schedule-job-modal.scss"; import "./schedule-job-modal.scss";
import LockWrapperComponent from "../lock-wrapper/lock-wrapper.component"; import LockWrapperComponent from "../lock-wrapper/lock-wrapper.component";
import { BlurWrapper } from "../feature-wrapper/blur-wrapper.component"; import BlurWrapper from "../feature-wrapper/blur-wrapper.component";
import UpsellComponent, { upsellEnum } from "../upsell/upsell.component"; import UpsellComponent, { upsellEnum } from "../upsell/upsell.component";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
@@ -138,7 +138,7 @@ export function ScheduleJobModalComponent({
</BlurWrapper> </BlurWrapper>
</Button> </Button>
))} ))}
{smartOptions.length > 1 && hasSmartSchedulingAccess && ( {!smartOptions.length > 1 && hasSmartSchedulingAccess && (
<UpsellComponent upsell={upsellEnum().smartscheduling.general} /> <UpsellComponent upsell={upsellEnum().smartscheduling.general} />
)} )}
</Space> </Space>

View File

@@ -19,7 +19,6 @@ export default function UpsellComponent({ featureName, subFeatureName, upsell, d
const { t } = useTranslation(); const { t } = useTranslation();
const resultProps = upsell || upsellEnum[featureName][subFeatureName]; const resultProps = upsell || upsellEnum[featureName][subFeatureName];
console.trace("***LOG ~ file: upsell.component.jsx:22 ~ UpsellComponent ~ resultProps:", resultProps);
const componentRef = useRef(null); const componentRef = useRef(null);
useEffect(() => { useEffect(() => {