diff --git a/src/form/fragmentUtil.ts b/src/form/fragmentUtil.ts index d95fd1ea..e4833743 100644 --- a/src/form/fragmentUtil.ts +++ b/src/form/fragmentUtil.ts @@ -47,15 +47,14 @@ export function createAdSetFromFragment( data: AdSetFragment, campaignId?: string, ): CreateAdSetInput { + const ads = (data.ads ?? []).filter((ad) => ad.state !== "deleted"); + return { campaignId, - ads: (data.ads ?? []) - .filter((ad) => ad.state !== "deleted") - .map((ad) => ({ - creativeId: ad.creative.id, - price: ad.price, - priceType: ad.priceType, - })), + ads: ads.map((ad) => ({ + creativeId: ad.creative.id, + })), + price: ads[0].price, bannedKeywords: data.bannedKeywords, billingType: data.billingType ?? "cpm", conversions: (data.conversions ?? []).map((c) => ({ diff --git a/src/graphql/types.ts b/src/graphql/types.ts index 0c03884f..4c5763b5 100644 --- a/src/graphql/types.ts +++ b/src/graphql/types.ts @@ -82,13 +82,15 @@ export enum CampaignSource { export type ChangeFilter = { /** exclude all changes whose time range is completely before this time */ - created?: InputMaybe; + createdAfter?: InputMaybe; /** include changes made by system user */ includeSystemUser?: InputMaybe; /** limit the amount of results returned */ limit?: InputMaybe; /** only include changes for this reference id */ referenceId?: InputMaybe; + /** only include changes for this set of reference ids */ + referenceIds?: InputMaybe>; }; export enum ConfirmationType { diff --git a/src/user/library/index.test.ts b/src/user/library/index.test.ts index 762b3dd9..368c1874 100644 --- a/src/user/library/index.test.ts +++ b/src/user/library/index.test.ts @@ -157,7 +157,7 @@ describe("pricing logic (read)", () => { c.adSets = []; }); const formObject = editCampaignValues(campaign, "abc"); - expect(formObject.price).toEqual("100"); + expect(formObject.price).toEqual("6"); expect(formObject.billingType).toEqual("cpm"); }); }); diff --git a/src/user/library/index.ts b/src/user/library/index.ts index 63d2f8ba..3e128a7e 100644 --- a/src/user/library/index.ts +++ b/src/user/library/index.ts @@ -94,7 +94,7 @@ export function editCampaignValues( const billingType = (_.head(campaign.adSets)?.billingType ?? "cpm") as Billing; - const rawPrice = BigNumber(_.head(campaign.adSets)?.price ?? "0.1"); + const rawPrice = BigNumber(_.head(campaign.adSets)?.price ?? ".006"); const price = billingType === "cpm" ? rawPrice.multipliedBy(1000) : rawPrice; return {