Skip to content

Commit

Permalink
Merge pull request #1247 from brave/master
Browse files Browse the repository at this point in the history
Production Release 2024-07-08
  • Loading branch information
IanKrieger committed Jul 8, 2024
2 parents 4f8c3a1 + 5f951ca commit 6a8d419
Show file tree
Hide file tree
Showing 21 changed files with 1,212 additions and 1,007 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10
uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -53,7 +53,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10
uses: github/codeql-action/autobuild@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -67,4 +67,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10
uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"type": "module",
"dependencies": {
"@apollo/client": "3.10.6",
"@apollo/client": "3.10.8",
"@emotion/react": "11.11.4",
"@emotion/styled": "11.11.5",
"@fontsource/inter": "5.0.18",
Expand All @@ -17,11 +17,11 @@
"@lingui/detect-locale": "4.11.1",
"@lingui/macro": "4.11.1",
"@lingui/react": "4.11.1",
"@mui/icons-material": "5.15.20",
"@mui/icons-material": "5.15.21",
"@mui/lab": "5.0.0-alpha.170",
"@mui/material": "5.15.20",
"@mui/x-data-grid": "7.7.1",
"@mui/x-date-pickers": "7.7.1",
"@mui/material": "5.15.21",
"@mui/x-data-grid": "7.8.0",
"@mui/x-date-pickers": "7.8.0",
"bignumber.js": "9.1.2",
"dayjs": "1.11.11",
"formik": "2.4.6",
Expand Down Expand Up @@ -60,13 +60,13 @@
"devDependencies": {
"@eslint/js": "8.57.0",
"@graphql-codegen/cli": "5.0.2",
"@graphql-codegen/client-preset": "4.3.0",
"@graphql-codegen/client-preset": "4.3.1",
"@graphql-codegen/introspection": "4.0.3",
"@graphql-eslint/eslint-plugin": "3.20.1",
"@lingui/cli": "4.11.1",
"@lingui/vite-plugin": "4.11.1",
"@parcel/watcher": "2.4.1",
"@types/lodash": "4.17.5",
"@types/lodash": "4.17.6",
"@types/papaparse": "5.3.14",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
Expand All @@ -81,13 +81,13 @@
"eslint-plugin-react": "7.34.3",
"eslint-plugin-react-hooks": "4.6.2",
"husky": "9.0.11",
"knip": "5.22.2",
"knip": "5.23.2",
"lint-staged": "15.2.7",
"npm-run-all2": "6.2.0",
"prettier": "3.3.2",
"typescript": "5.5.2",
"typescript-eslint": "7.13.1",
"vite": "5.3.1",
"typescript-eslint": "7.14.1",
"vite": "5.3.2",
"vite-plugin-checker": "0.6.4",
"vite-tsconfig-paths": "4.3.2",
"vitest": "1.6.0"
Expand Down
346 changes: 195 additions & 151 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

13 changes: 4 additions & 9 deletions src/components/Conversion/ConversionDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,15 @@ export function ConversionDisplay({ conversions, convErrors }: Props) {
{conversions.map((c, idx) => (
<div key={idx}>
<ReviewField
caption={msg`Conversion Type`}
value={c.type}
error={extractConversionError(idx, "type")}
caption={msg`Conversion URL Pattern`}
value={c.urlPattern}
error={extractConversionError(idx, "urlPattern")}
/>
<ReviewField
caption={msg`Observation Window`}
caption={msg`Conversion Observation Window`}
value={`${c.observationWindow} days`}
error={extractConversionError(idx, "observationWindow")}
/>
<ReviewField
caption={msg`Conversion URL Pattern`}
value={c.urlPattern}
error={extractConversionError(idx, "urlPattern")}
/>
</div>
))}
</>
Expand Down
33 changes: 11 additions & 22 deletions src/components/Conversion/ConversionFields.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Box } from "@mui/material";
import { Box, Typography } from "@mui/material";
import { FormikRadioControl, FormikTextField } from "@/form/FormikHelpers";
import { msg, Trans } from "@lingui/macro";
import { useLingui } from "@lingui/react";
import { LearnMoreButton } from "@/components/Button/LearnMoreButton";

interface Props {
name: string;
Expand All @@ -12,26 +13,6 @@ export const ConversionFields = ({ name }: Props) => {

return (
<>
<FormikRadioControl
name={`${name}.type`}
label={_(msg`Type`)}
options={[
{ value: "postview", label: _(msg`Post-View`) },
{ value: "postclick", label: _(msg`Post-Click`) },
]}
helperText={
<>
<Trans>
Post-View: Viewed ad and converted by visiting site on their own.
</Trans>
<br />
<Trans>
Post-Click: Viewed ad and converted by clicking its link
</Trans>
</>
}
/>

<Box>
<FormikTextField
name={`${name}.urlPattern`}
Expand All @@ -51,7 +32,15 @@ export const ConversionFields = ({ name }: Props) => {
{ value: 7, label: _(msg`7 Days`) },
{ value: 30, label: _(msg`30 Days`) },
]}
helperText={_(msg`Count conversions within X days of an impression`)}
helperText={
<Typography variant="body2" sx={{ mb: 2 }}>
<Trans>
Define the number of days Brave will observe conversions and
attribute them to the campaign.
</Trans>{" "}
<LearnMoreButton helpSection="campaign-performance/reporting/#advanced-controls-for-attribution" />
</Typography>
}
/>
</Box>
</>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Creatives/CreativeType.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Box, ListItemButton, List, Typography, Stack } from "@mui/material";
import { useFormikContext } from "formik";
import { CreativeInput } from "@/graphql-client/graphql";
import { FormatHelp } from "@/components/Button/FormatHelp";
import { msg } from "@lingui/macro";
import { Trans } from "@lingui/react";
import { CreativeInputWithType } from "@/user/views/adsManager/types";

export function CreativeType(props: { allowTypeChange?: boolean }) {
const formik = useFormikContext<CreativeInput>();
const formik = useFormikContext<CreativeInputWithType>();

const supportedTypes = [
{
Expand Down
5 changes: 3 additions & 2 deletions src/components/Creatives/hooks/useGetCreativeDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { CreativeInput, LoadCreativeDocument } from "@/graphql-client/graphql";
import { LoadCreativeDocument } from "@/graphql-client/graphql";
import { useAdvertiser } from "@/auth/hooks/queries/useAdvertiser";
import { useLingui } from "@lingui/react";
import { msg } from "@lingui/macro";
import { useQuery } from "@apollo/client";
import { CreativeInputWithType } from "@/user/views/adsManager/types";

export function useGetCreativeDetails(props: { id: string }) {
const { advertiser } = useAdvertiser();
Expand All @@ -13,7 +14,7 @@ export function useGetCreativeDetails(props: { id: string }) {
});
const { _ } = useLingui();

const defaultValue: CreativeInput & { targetUrlValid?: string } = {
const defaultValue: CreativeInputWithType & { targetUrlValid?: string } = {
advertiserId: advertiser.id,
state: "under_review",
name: "",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Creatives/hooks/useSubmitCreative.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useCallback } from "react";
import {
AdvertiserCreativesDocument,
CreateCreativeDocument,
CreativeInput,
UpdateCreativeDocument,
} from "@/graphql-client/graphql";
import { useAdvertiser } from "@/auth/hooks/queries/useAdvertiser";
Expand All @@ -11,6 +10,7 @@ import { validCreativeFields } from "@/user/library";
import _ from "lodash";
import { useTrackMatomoEvent } from "@/hooks/useTrackWithMatomo";
import { useMutation } from "@apollo/client";
import { CreativeInputWithType } from "@/user/views/adsManager/types";

export function useSubmitCreative(props: { id: string }) {
const { trackMatomoEvent } = useTrackMatomoEvent();
Expand Down Expand Up @@ -46,7 +46,7 @@ export function useSubmitCreative(props: { id: string }) {
});

const submit = useCallback(
async (values: CreativeInput, submitting: (s: boolean) => void) => {
async (values: CreativeInputWithType, submitting: (s: boolean) => void) => {
submitting(true);
const valid = validCreativeFields(
{ id: props.id, ...values },
Expand Down
3 changes: 2 additions & 1 deletion src/components/Datagrid/renderers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { OnOff } from "@/components/Switch/OnOff";
import { displayFromCampaignState } from "@/util/displayState";
import { FilterContext } from "@/state/context";
import {
AdSetState,
AdvertiserCampaignsDocument,
CampaignSource,
CampaignSummaryFragment,
Expand Down Expand Up @@ -146,7 +147,7 @@ export function adSetOnOffState(
updateAdSet({
variables: {
updateAdSetInput: {
state: s,
state: s as AdSetState,
id: c.id,
campaignId: c.campaignId,
},
Expand Down
Loading

0 comments on commit 6a8d419

Please sign in to comment.