Skip to content

Commit

Permalink
chore: Remove the AREnablePartnerOfferOnArtworkScreenfeature flag fro…
Browse files Browse the repository at this point in the history
…m Eigen (#11329)

* chore: remove AREnablePartnerOfferOnArtworkScreen feature flag

* chore: remove AREnablePartnerOfferOnArtworkScreen feature flag
  • Loading branch information
oxaudo authored Dec 31, 2024
1 parent 9decf46 commit 9ebd373
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 168 deletions.
3 changes: 1 addition & 2 deletions src/app/Components/ArtworkGrids/ArtworkGridItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ export const Artwork: React.FC<ArtworkProps> = ({
const tracking = useTracking()
const [showCreateArtworkAlertModal, setShowCreateArtworkAlertModal] = useState(false)
const showBlurhash = useFeatureFlag("ARShowBlurhashImagePlaceholder")
const enablePartnerOfferOnArtworkScreen = useFeatureFlag("AREnablePartnerOfferOnArtworkScreen")
const enableNewSaveAndFollowOnArtworkCard = useFeatureFlag(
"AREnableNewSaveAndFollowOnArtworkCard"
)
Expand Down Expand Up @@ -228,7 +227,7 @@ export const Artwork: React.FC<ArtworkProps> = ({
trackArtworkTap()

if (artwork.href) {
if (partnerOffer && !!hasEnded && !!enablePartnerOfferOnArtworkScreen) {
if (partnerOffer && !!hasEnded) {
navigate?.(artwork.href, { passProps: { artworkOfferExpired: true } })
} else {
navigate?.(artwork.href)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ import { useSendInquiry_me$key } from "__generated__/useSendInquiry_me.graphql"
import { CreateArtworkAlertModal } from "app/Components/Artist/ArtistArtworks/CreateArtworkAlertModal"
import { PartnerOffer } from "app/Scenes/Activity/components/PartnerOfferCreatedNotification"
import { BuyNowButton } from "app/Scenes/Artwork/Components/CommercialButtons/BuyNowButton"
import { ContactGalleryButton } from "app/Scenes/Artwork/Components/CommercialButtons/ContactGalleryButton"
import { MakeOfferButtonFragmentContainer } from "app/Scenes/Artwork/Components/CommercialButtons/MakeOfferButton"
import { navigate } from "app/system/navigation/navigate"
import { getRelayEnvironment } from "app/system/relay/defaultEnvironment"
import { getTimer } from "app/utils/getTimer"
import { useFeatureFlag } from "app/utils/hooks/useFeatureFlag"
import { renderWithPlaceholder } from "app/utils/renderWithPlaceholder"
import { Children, useState } from "react"
import { QueryRenderer, graphql, useFragment } from "react-relay"
Expand Down Expand Up @@ -62,80 +59,58 @@ export const CommercialButtons: React.FC<{
me: MyProfileEditModal_me$key & useSendInquiry_me$key
partnerOffer?: PartnerOffer
artworkID: string
}> = ({ artwork, me, partnerOffer, artworkID }) => {
}> = ({ artwork, partnerOffer, artworkID }) => {
const artworkData = useFragment(artworkFragment, artwork)

const [showCreateArtworkAlertModal, setShowCreateArtworkAlertModal] = useState(false)

const { hasEnded } = getTimer(partnerOffer?.endAt || "")
const noLongerAvailable = !partnerOffer?.isAvailable
const enablePartnerOfferOnArtworkScreen = useFeatureFlag("AREnablePartnerOfferOnArtworkScreen")
const tracking = useTracking()

let renderComponent = null

if (!!hasEnded) {
if (!enablePartnerOfferOnArtworkScreen) {
renderComponent = (
<>
<MakeOfferButtonFragmentContainer artwork={artworkData} editionSetID={null} />
<ContactGalleryButton artwork={artworkData} me={me} block variant="outline" />
</>
)
} else {
renderComponent = (
renderComponent = (
<Button
onPress={() => {
tracking.trackEvent(tracks.tappedViewWork(artworkID, partnerOffer?.internalID || ""))

navigate(`/artwork/${artworkID}`, { passProps: { artworkOfferExpired: true } })
}}
block
accessibilityLabel="View Work"
>
View Work
</Button>
)
} else if (!noLongerAvailable) {
renderComponent = (
<RowContainer>
<Button
onPress={() => {
tracking.trackEvent(tracks.tappedViewWork(artworkID, partnerOffer?.internalID || ""))
tracking.trackEvent(tracks.tappedViewWork(artworkID, partnerOffer.internalID))

navigate(`/artwork/${artworkID}`, { passProps: { artworkOfferExpired: true } })
navigate(`/artwork/${artworkID}`, {
passProps: { partnerOfferId: partnerOffer?.internalID },
})
}}
block
variant="outline"
accessibilityLabel="View Work"
block
>
View Work
</Button>
)
}
} else if (!noLongerAvailable) {
if (!enablePartnerOfferOnArtworkScreen) {
renderComponent = (

<BuyNowButton
artwork={artworkData}
artwork={artworkData as BuyNowButton_artwork$key}
partnerOffer={partnerOffer}
editionSetID={null}
buttonText="Continue to Purchase"
buttonText="Purchase"
source="notification"
/>
)
} else {
renderComponent = (
<RowContainer>
<Button
onPress={() => {
tracking.trackEvent(tracks.tappedViewWork(artworkID, partnerOffer.internalID))

navigate(`/artwork/${artworkID}`, {
passProps: { partnerOfferId: partnerOffer?.internalID },
})
}}
variant="outline"
accessibilityLabel="View Work"
block
>
View Work
</Button>

<BuyNowButton
artwork={artworkData as BuyNowButton_artwork$key}
partnerOffer={partnerOffer}
editionSetID={null}
buttonText="Purchase"
source="notification"
/>
</RowContainer>
)
}
</RowContainer>
)
} else if (!!noLongerAvailable) {
renderComponent = (
<>
Expand Down
5 changes: 2 additions & 3 deletions src/app/Scenes/Artwork/Artwork.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,8 @@ export const Artwork: React.FC<ArtworkProps> = (props) => {

const allowExpiredPartnerOffers = useFeatureFlag("AREnableExpiredPartnerOffers")
const enableAuctionHeaderAlertCTA = useFeatureFlag("AREnableAuctionHeaderAlertCTA")
const enablePartnerOfferOnArtworkScreen = useFeatureFlag("AREnablePartnerOfferOnArtworkScreen")

const expectedPartnerOfferId = !!props.partner_offer_id && enablePartnerOfferOnArtworkScreen
const expectedPartnerOfferId = !!props.partner_offer_id

const partnerOfferUnavailable = expectedPartnerOfferId && !artworkAboveTheFold?.isPurchasable

Expand Down Expand Up @@ -347,7 +346,7 @@ export const Artwork: React.FC<ArtworkProps> = (props) => {
})
}

if (!!enablePartnerOfferOnArtworkScreen && !!partnerOffer?.isActive && !!partnerOffer?.note) {
if (!!partnerOffer?.isActive && !!partnerOffer?.note) {
sections.push({
key: "partnerOfferNote",
element: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ArtworkCommercialButtons_Test_Query } from "__generated__/ArtworkCommer
import { AuctionTimerState } from "app/Components/Bidding/Components/Timer"
import { ArtworkStoreProvider } from "app/Scenes/Artwork/ArtworkStore"
import { ArtworkFixture } from "app/__fixtures__/ArtworkFixture"
import { __globalStoreTestUtils__ } from "app/store/GlobalStore"
import { navigate } from "app/system/navigation/navigate"
import { ArtworkInquiryStateProvider } from "app/utils/ArtworkInquiry/ArtworkInquiryStore"
import { extractNodes } from "app/utils/extractNodes"
Expand All @@ -14,10 +13,6 @@ import { Suspense } from "react"
import { graphql } from "react-relay"
import { ArtworkCommercialButtons } from "./ArtworkCommercialButtons"

beforeEach(() => {
__globalStoreTestUtils__?.injectFeatureFlags({ AREnablePartnerOfferOnArtworkScreen: true })
})

describe("ArtworkCommercialButtons", () => {
const { renderWithRelay } = setupTestWrapper<ArtworkCommercialButtons_Test_Query>({
Component: (props) => {
Expand Down Expand Up @@ -650,84 +645,6 @@ describe("ArtworkCommercialButtons", () => {
})
})
})

describe("With AREnablePartnerOfferOnArtworkScreen turned off", () => {
beforeEach(() => {
__globalStoreTestUtils__?.injectFeatureFlags({ AREnablePartnerOfferOnArtworkScreen: false })
})

describe("with an active partner offer", () => {
it("renders Purchase button if is acquireable", () => {
const artwork = {
...ArtworkFixture,
isAcquireable: true,
isOfferable: false,
isInquireable: false,
}

renderWithRelay({
Artwork: () => artwork,
Me: () => meWithPartnerOfferFixture,
})

expect(screen.getByText("Purchase")).toBeOnTheScreen()
expect(screen.queryByText("Make an Offer")).not.toBeOnTheScreen()
expect(screen.queryByText("Contact Gallery")).not.toBeOnTheScreen()
})

it("renders Make an Offer button ifOfferable", () => {
const artwork = {
...ArtworkFixture,
isAcquireable: false,
isOfferable: true,
isInquireable: false,
}
renderWithRelay({
Artwork: () => artwork,
Me: () => meWithPartnerOfferFixture,
})

expect(screen.queryByText("Purchase")).not.toBeOnTheScreen()
expect(screen.getByText("Make an Offer")).toBeOnTheScreen()
expect(screen.queryByText("Contact Gallery")).not.toBeOnTheScreen()
})

it("renders both Purchase and Make an Offer buttons if artwork isOfferable and isAcquireable", () => {
const artwork = {
...ArtworkFixture,
isAcquireable: true,
isOfferable: true,
isInquireable: false,
}
renderWithRelay({
Artwork: () => artwork,
Me: () => meWithPartnerOfferFixture,
})

expect(screen.getByText("Purchase")).toBeOnTheScreen()
expect(screen.getByText("Make an Offer")).toBeOnTheScreen()
expect(screen.queryByText("Contact Gallery")).not.toBeOnTheScreen()
})

it("renders both Make an Offer and Contact Gallery buttons if artwork isOfferable and isInquireable ", () => {
const artwork = {
...ArtworkFixture,
isAcquireable: false,
isOfferable: true,
isInquireable: true,
}

renderWithRelay({
Artwork: () => artwork,
Me: () => meWithPartnerOfferFixture,
})

expect(screen.queryByText("Purchase")).not.toBeOnTheScreen()
expect(screen.getByText("Make an Offer")).toBeOnTheScreen()
expect(screen.getByText("Contact Gallery")).toBeOnTheScreen()
})
})
})
})

const meFixture = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { BuyNowButton } from "app/Scenes/Artwork/Components/CommercialButtons/Bu
import { ContactGalleryButton } from "app/Scenes/Artwork/Components/CommercialButtons/ContactGalleryButton"
import { MakeOfferButtonFragmentContainer } from "app/Scenes/Artwork/Components/CommercialButtons/MakeOfferButton"
import { getTimer } from "app/utils/getTimer"
import { useFeatureFlag } from "app/utils/hooks/useFeatureFlag"
import { Children } from "react"
import { useFragment, graphql } from "react-relay"
import { BidButtonFragmentContainer } from "./CommercialButtons/BidButton"
Expand Down Expand Up @@ -44,7 +43,6 @@ export const ArtworkCommercialButtons: React.FC<ArtworkCommercialButtonsProps> =
const selectedEditionId = ArtworkStore.useStoreState((state) => state.selectedEditionId)
const auctionState = ArtworkStore.useStoreState((state) => state.auctionState)

const AREnablePartnerOfferOnArtworkScreen = useFeatureFlag("AREnablePartnerOfferOnArtworkScreen")
const { hasEnded: partnerOfferEnded } = getTimer(partnerOfferData?.endAt || "")

const isBiddableInAuction = artworkData.isInAuction && artworkData.sale
Expand All @@ -55,8 +53,7 @@ export const ArtworkCommercialButtons: React.FC<ArtworkCommercialButtonsProps> =
isBiddableInAuction
const noEditions = !artworkData.editionSets || artworkData.editionSets.length === 0

const hasActivePartnerOffer =
AREnablePartnerOfferOnArtworkScreen && partnerOfferData?.isAvailable && !partnerOfferEnded
const hasActivePartnerOffer = partnerOfferData?.isAvailable && !partnerOfferEnded

if (!canTakeCommercialAction) {
return null
Expand Down
5 changes: 0 additions & 5 deletions src/app/Scenes/Artwork/Components/ArtworkPrice.tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
ArtworkStoreProvider,
artworkModel,
} from "app/Scenes/Artwork/ArtworkStore"
import { __globalStoreTestUtils__ } from "app/store/GlobalStore"
import { extractNodes } from "app/utils/extractNodes"
import { setupTestWrapper } from "app/utils/tests/setupTestWrapper"
import { DateTime } from "luxon"
Expand Down Expand Up @@ -92,10 +91,6 @@ describe("ArtworkPrice", () => {
})

describe("Partner Offer", () => {
beforeEach(() => {
__globalStoreTestUtils__?.injectFeatureFlags({ AREnablePartnerOfferOnArtworkScreen: true })
})

it("should NOT render if there is not partner offers", () => {
renderWithRelay({
Artwork: () => ({ isInAuction: false }),
Expand Down
10 changes: 1 addition & 9 deletions src/app/Scenes/Artwork/Components/ArtworkPrice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { ArtworkPrice_partnerOffer$key } from "__generated__/ArtworkPrice_partne
import { AuctionTimerState } from "app/Components/Bidding/Components/Timer"
import { ArtworkStore } from "app/Scenes/Artwork/ArtworkStore"
import { ExpiresInTimer } from "app/Scenes/Artwork/Components/ExpiresInTimer"
import { useFeatureFlag } from "app/utils/hooks/useFeatureFlag"
import { graphql, useFragment } from "react-relay"
import { ArtworkAuctionBidInfo } from "./ArtworkAuctionBidInfo"

Expand All @@ -25,8 +24,6 @@ export const ArtworkPrice: React.FC<ArtworkPriceProps> = ({
const editionSets = artworkData.editionSets ?? []
let message = null

const AREnablePartnerOfferOnArtworkScreen = useFeatureFlag("AREnablePartnerOfferOnArtworkScreen")

const getEditionSetMessage = () => {
const selectedEdition = editionSets.find((editionSet) => {
return editionSet?.internalID === selectedEditionId
Expand All @@ -49,12 +46,7 @@ export const ArtworkPrice: React.FC<ArtworkPriceProps> = ({
message = artworkData.saleMessage
}

if (
!!AREnablePartnerOfferOnArtworkScreen &&
!!partnerOfferData &&
partnerOfferData.isAvailable &&
partnerOfferData.isActive
) {
if (!!partnerOfferData && partnerOfferData.isAvailable && partnerOfferData.isActive) {
const listPrice = artworkData.isPriceHidden ? "Not publicly listed" : message

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { useCreateOrder } from "app/Scenes/Artwork/hooks/useCreateOrder"
import { usePartnerOfferMutation } from "app/Scenes/PartnerOffer/mutations/usePartnerOfferCheckoutMutation"
import { navigate } from "app/system/navigation/navigate"
import { getTimer } from "app/utils/getTimer"
import { useFeatureFlag } from "app/utils/hooks/useFeatureFlag"
import { promptForReview } from "app/utils/promptForReview"
import { useSetWebViewCallback } from "app/utils/useWebViewEvent"
import { useEffect, useRef, useState } from "react"
Expand Down Expand Up @@ -49,7 +48,6 @@ export const BuyNowButton = ({
source,
}: BuyNowButtonProps) => {
const [isCommittingCreateOrderMutation, setIsCommittingCreateOrderMutation] = useState(false)
const AREnablePartnerOfferOnArtworkScreen = useFeatureFlag("AREnablePartnerOfferOnArtworkScreen")

const { saleMessage, internalID, slug } = useFragment(artworkFragment, artwork)
const { trackEvent } = useTracking()
Expand Down Expand Up @@ -160,7 +158,7 @@ export const BuyNowButton = ({
setIsCommittingCreateOrderMutation(true)

try {
if (AREnablePartnerOfferOnArtworkScreen && partnerOffer && !partnerOfferTimer?.hasEnded) {
if (partnerOffer && !partnerOfferTimer?.hasEnded) {
trackEvent(
tracks.tappedBuyNow(
slug,
Expand Down
6 changes: 0 additions & 6 deletions src/app/store/config/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,6 @@ export const features = {
showInDevMenu: true,
echoFlagKey: "AREnableLongPressOnNewForYouRail",
},
AREnablePartnerOfferOnArtworkScreen: {
description: "Enable partner offer on artwork screen",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnablePartnerOfferOnArtworkScreen",
},
AREnableMyCollectionInterestedInSellingTooltip: {
description: "Enable My Collection 'Interested in Selling?' tooltip",
readyForRelease: true,
Expand Down

0 comments on commit 9ebd373

Please sign in to comment.