Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/react-422f831423
Browse files Browse the repository at this point in the history
  • Loading branch information
codemist authored Jan 16, 2025
2 parents b0bf0e8 + 80e7178 commit 6781d50
Show file tree
Hide file tree
Showing 19 changed files with 311 additions and 438 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default async function DashboardPage({ params, searchParams }: Props) {
totalNumberOfPerformedScans={profileStats?.total}
isNewUser={isNewUser}
elapsedTimeInDaysSinceInitialScan={elapsedTimeInDaysSinceInitialScan}
experimentData={experimentData["Features"]}
experimentData={experimentData}
activeTab={activeTab}
hasFirstMonitoringScan={hasFirstMonitoringScan}
signInCount={signInCount}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default async function SettingsPage({ params, searchParams }: Props) {
yearlySubscriptionUrl={`${yearlySubscriptionUrl}&${additionalSubplatParams.toString()}`}
subscriptionBillingAmount={getSubscriptionBillingAmount()}
enabledFeatureFlags={enabledFeatureFlags}
experimentData={experimentData["Features"]}
experimentData={experimentData}
lastScanDate={lastOneRepScan?.created_at}
isMonthlySubscriber={isMonthlySubscriber}
activeTab={activeTab}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default async function Onboarding({ params, searchParams }: Props) {
breachesTotalCount={allBreachesCount}
stepId={firstSlug === FreeScanSlug ? "enterInfo" : "getStarted"}
previousRoute={previousRoute}
experimentData={experimentData["Features"]}
experimentData={experimentData}
/>
);
}
20 changes: 9 additions & 11 deletions src/app/(proper_react)/(redesign)/(public)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,41 +59,39 @@ export default async function Page({ searchParams }: Props) {
oneRepActivations > monthlySubscribersQuota;
return (
<AccountsMetricsFlowProvider
enabled={experimentData["Features"]["landing-page-free-scan-cta"].enabled}
enabled={experimentData["landing-page-free-scan-cta"].enabled}
metricsFlowParams={{
entrypoint: CONST_URL_MONITOR_LANDING_PAGE_ID,
entrypoint_experiment: "landing-page-free-scan-cta",
entrypoint_variation:
experimentData["Features"]["landing-page-free-scan-cta"].variant,
experimentData["landing-page-free-scan-cta"].variant,
form_type:
experimentData["Features"]["landing-page-free-scan-cta"].variant ===
experimentData["landing-page-free-scan-cta"].variant ===
"ctaWithEmail"
? "email"
: "button",
service: process.env.OAUTH_CLIENT_ID as string,
}}
>
{enabledFeatureFlags.includes("LandingPageRedesign") &&
experimentData["Features"][
"landing-page-redesign-plus-eligible-experiment"
].enabled &&
experimentData["Features"][
"landing-page-redesign-plus-eligible-experiment"
].variant === "redesign" ? (
experimentData["landing-page-redesign-plus-eligible-experiment"]
.enabled &&
experimentData["landing-page-redesign-plus-eligible-experiment"]
.variant === "redesign" ? (
<LandingViewRedesign
eligibleForPremium={eligibleForPremium}
l10n={getL10n()}
countryCode={countryCode}
scanLimitReached={scanLimitReached}
experimentData={experimentData["Features"]}
experimentData={experimentData}
/>
) : (
<LandingView
eligibleForPremium={eligibleForPremium}
l10n={getL10n()}
countryCode={countryCode}
scanLimitReached={scanLimitReached}
experimentData={experimentData["Features"]}
experimentData={experimentData}
/>
)}
</AccountsMetricsFlowProvider>
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/v1/user/welcome-scan/create/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export async function POST(
previewMode: searchParams.get("nimbus_preview") === "true",
});
const optionalInfoExperimentData =
experimentData["Features"]["welcome-scan-optional-info"];
experimentData["welcome-scan-optional-info"];

const profileData: CreateProfileRequest = {
first_name: firstName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ export const DataBrokerRequestedRemoval: Story = {
args: {
exposureImg: FamilyTreeImage,
exposureData: ScanMockItemRequestedRemoval,
enabledFeatureFlags: ["AdditionalRemovalStatuses"],
enabledFeatureFlags: [
"AdditionalRemovalStatuses",
"DataBrokerRemovalAttempts",
],
},
};

Expand Down
18 changes: 17 additions & 1 deletion src/app/components/client/exposure_card/ExposureCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ describe("ScanResultCard", () => {
expect(innerDescription).toBeInTheDocument();
});

it("shows an additional note for “requested removal” status label", () => {
it("shows an additional note for “requested removal” status label if the feature flag `DataBrokerRemovalAttempts` is enabled", () => {
const ComposedProgressCard = composeStory(DataBrokerRequestedRemoval, Meta);
render(<ComposedProgressCard />);
const statusLabel = screen.getByText("Requested removal");
Expand All @@ -162,6 +162,22 @@ describe("ScanResultCard", () => {
expect(labelNote).toBeInTheDocument();
});

it("does not show an additional note for “requested removal” status label if the feature flag `DataBrokerRemovalAttempts` is not enabled", () => {
const ComposedProgressCard = composeStory(DataBrokerRequestedRemoval, Meta);
render(
<ComposedProgressCard
enabledFeatureFlags={["AdditionalRemovalStatuses"]}
/>,
);
const statusLabel = screen.getByText("Requested removal");
const statusLabelParent = statusLabel.parentElement as HTMLElement;
const labelNote = within(statusLabelParent).queryByText("Attempt", {
exact: false,
});

expect(labelNote).not.toBeInTheDocument();
});

it("hides the dt element if its dd counterpart has hideonmobile", () => {
const ComposedProgressCard = composeStory(DataBrokerInProgress, Meta);
render(<ComposedProgressCard />);
Expand Down
1 change: 1 addition & 0 deletions src/app/components/client/exposure_card/ScanResultCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export const ScanResultCard = (props: ScanResultCardProps) => {
const attemptCount = scanResult.optout_attempts ?? 0;
const statusPillNote =
props.enabledFeatureFlags?.includes("AdditionalRemovalStatuses") &&
props.enabledFeatureFlags?.includes("DataBrokerRemovalAttempts") &&
!scanResult.manually_resolved &&
scanResult.status === "waiting_for_verification" &&
attemptCount >= 1
Expand Down
128 changes: 128 additions & 0 deletions src/app/components/client/stories/ModalDialog.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import type { Meta, StoryObj } from "@storybook/react";

import { useOverlayTriggerState } from "react-stately";
import { useOverlayTrigger } from "react-aria";
import Image from "next/image";
import Illustration from "../assets/modal-default-img.svg";
import { ModalOverlay } from "../dialog/ModalOverlay";
import { Dialog } from "../dialog/Dialog";
import { Button } from "../Button";

export type ModalDialogProps = {
withDialog?: boolean;
withTitle?: boolean;
withIllustration?: boolean;
};

const ModalDialog = (props: ModalDialogProps) => {
const modalState = useOverlayTriggerState({ defaultOpen: true });
const modalTrigger = useOverlayTrigger({ type: "dialog" }, modalState);
return (
<>
<Button {...modalTrigger.triggerProps} variant="primary">
Open modal {props.withDialog && " dialog"}
</Button>
{modalState.isOpen && (
<ModalOverlay
state={modalState}
{...modalTrigger.overlayProps}
isDismissable={true}
>
{props.withDialog ? (
<Dialog
title={props.withTitle ? "Here's a dialog for you" : undefined}
illustration={
props.withIllustration ? (
<Image src={Illustration} alt="" />
) : undefined
}
onDismiss={() => modalState.close()}
>
<p>Some dialog content.</p>
</Dialog>
) : (
<>
<div
style={{
display: "flex",
flexDirection: "column",
alignItems: "flex-start",
gap: 16,
}}
>
<p>
This is modal content; note that it&apos;s not possible to
interact with the content behind the modal overlay.
Here&apos;s a button to close the modal: &nbsp;
</p>
<Button variant="primary" onPress={() => modalState.close()}>
Close modal
</Button>
<p>
Note that modal overlays aren&apos;t usually used on their
own. This is merely an example to help clarify the boundaries
between the Modal and Dialog components.
</p>
</div>
</>
)}
</ModalOverlay>
)}
</>
);
};

// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
const meta: Meta<typeof ModalDialog> = {
title: "Design Systems/Molecules/Modal dialog",
component: ModalDialog,
argTypes: {
withDialog: {
control: "boolean",
name: "With dialog",
},
withTitle: {
control: "boolean",
name: "With title",
},
withIllustration: {
control: "boolean",
name: "With illustration",
},
},
};
export default meta;
type Story = StoryObj<typeof ModalDialog>;

export const Modal: Story = {
name: "Modal without a dialog",
args: {},
};

export const ModalWithDialog: Story = {
name: "Modal dialog",
args: {
withDialog: true,
},
};

export const ModalDialogWithTitle: Story = {
name: "With title",
args: {
withDialog: true,
withTitle: true,
},
};

export const ModalDialogWithIllustration: Story = {
name: "With title and illustration",
args: {
withDialog: true,
withTitle: true,
withIllustration: true,
},
};
Loading

0 comments on commit 6781d50

Please sign in to comment.