diff --git a/src/app/Scenes/Activity/components/AlertNotification.tsx b/src/app/Scenes/Activity/components/AlertNotification.tsx index 686ff9536e9..2f03284700c 100644 --- a/src/app/Scenes/Activity/components/AlertNotification.tsx +++ b/src/app/Scenes/Activity/components/AlertNotification.tsx @@ -84,10 +84,7 @@ export const AlertNotification: FC = ({ notification }) - + + ) @@ -150,6 +154,7 @@ export const CommercialButtons: React.FC<{ + setShowCreateArtworkAlertModal(false)} @@ -174,13 +179,14 @@ const artworkFragment = graphql` ...CreateArtworkAlertModal_artwork } ` + const tracks = { - tappedViewWork: (artworkID: string, alertID: string): TappedViewWork => ({ + tappedViewWork: (artworkID: string, partnerOfferId: string): TappedViewWork => ({ action: ActionType.tappedViewWork, context_module: ContextModule.notification, context_screen_owner_type: OwnerType.notification, - context_screen_owner_id: alertID, + context_screen_owner_id: partnerOfferId, artwork_id: artworkID, - notification_type: "", + notification_type: "offers", }), } diff --git a/src/app/Scenes/Artwork/Components/CommercialButtons/BuyNowButton.tsx b/src/app/Scenes/Artwork/Components/CommercialButtons/BuyNowButton.tsx index 8c784d45460..f09e062b7e1 100644 --- a/src/app/Scenes/Artwork/Components/CommercialButtons/BuyNowButton.tsx +++ b/src/app/Scenes/Artwork/Components/CommercialButtons/BuyNowButton.tsx @@ -6,7 +6,6 @@ import { TappedBuyNow, } from "@artsy/cohesion" import { ButtonProps, Button } from "@artsy/palette-mobile" - import { BuyNowButton_artwork$key } from "__generated__/BuyNowButton_artwork.graphql" import { Toast } from "app/Components/Toast/Toast" import { useCreateOrder } from "app/Scenes/Artwork/hooks/useCreateOrder" @@ -36,6 +35,8 @@ export interface BuyNowButtonProps { editionSetID: string | null renderSaleMessage?: boolean buttonText?: string + // Source is used to track where the button was tapped from, by default it's in the artwork screen + source?: "notification" | (string & {}) } export const BuyNowButton = ({ @@ -45,6 +46,7 @@ export const BuyNowButton = ({ editionSetID, renderSaleMessage, buttonText, + source, }: BuyNowButtonProps) => { const [isCommittingCreateOrderMutation, setIsCommittingCreateOrderMutation] = useState(false) const AREnablePartnerOfferOnArtworkScreen = useFeatureFlag("AREnablePartnerOfferOnArtworkScreen") @@ -159,10 +161,19 @@ export const BuyNowButton = ({ try { if (AREnablePartnerOfferOnArtworkScreen && partnerOffer && !partnerOfferTimer?.hasEnded) { - trackEvent(tracks.tappedBuyNow(slug, internalID, OwnerType.notification, "Partner offer")) + trackEvent( + tracks.tappedBuyNow( + slug, + internalID, + source === "notification" ? OwnerType.notification : OwnerType.artwork, + "Partner offer" + ) + ) + await createOrderFromPartnerOffer(partnerOffer) } else { trackEvent(tracks.tappedBuyNow(slug, internalID, OwnerType.artwork, "Buy now")) + await createOrder() } } catch (e) {