diff --git a/src/user/library/index.test.ts b/src/user/library/index.test.ts index 941cf973..9f18427a 100644 --- a/src/user/library/index.test.ts +++ b/src/user/library/index.test.ts @@ -277,7 +277,7 @@ describe("new form tests", () => { "budget": 1000, "currency": "USD", "dailyBudget": 10, - "dailyCap": 1, + "dailyCap": 4, "externalId": "", "format": "PUSH_NOTIFICATION", "geoTargets": [ diff --git a/src/user/library/index.ts b/src/user/library/index.ts index 37230ad5..3bb90bc7 100644 --- a/src/user/library/index.ts +++ b/src/user/library/index.ts @@ -35,7 +35,7 @@ export function transformNewForm( return { currency: form.currency, externalId: "", - dailyCap: form.format === CampaignFormat.NewsDisplayAd ? 4 : 1, + dailyCap: dailyLimit(form.format), dailyBudget: form.dailyBudget, endAt: form.endAt, pacingStrategy: CampaignPacingStrategies.ModelV1, @@ -242,13 +242,17 @@ function transformAdSet( name: adSet.name, price: transformPrice(campaign), billingType: campaign.billingType, - perDay: campaign.format === CampaignFormat.PushNotification ? 4 : 6, + perDay: dailyLimit(campaign.format), segments: adSet.segments.map((s) => ({ code: s.code, name: s.name })), oses: adSet.oses.map((s) => ({ code: s.code, name: s.name })), totalMax: campaign.format === CampaignFormat.PushNotification ? 28 : 60, }; } +function dailyLimit(format: CampaignFormat) { + return format === CampaignFormat.NewsDisplayAd ? 6 : 4; +} + export function uiTextForCreativeType(creativeType: string): string { return TYPE_CODE_LOOKUP[creativeType] ?? creativeType; }