@ainyc/canonry 4.77.0 → 4.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +18 -0
- package/assets/assets/{BacklinksPage-CwXveumn.js → BacklinksPage-dRc62jAY.js} +1 -1
- package/assets/assets/{ChartPrimitives-DntKGI5J.js → ChartPrimitives-D2_IvTkk.js} +1 -1
- package/assets/assets/{ProjectPage-CVudiU8X.js → ProjectPage-DSuvRUIf.js} +1 -1
- package/assets/assets/{RunRow-DMtYXaxG.js → RunRow-C0MA3yuQ.js} +1 -1
- package/assets/assets/{RunsPage-Cz-YlucO.js → RunsPage-4uxTYgGy.js} +1 -1
- package/assets/assets/{SettingsPage-BCuG3C-0.js → SettingsPage-3-SLhcJ7.js} +1 -1
- package/assets/assets/{TrafficPage-DV8X47wa.js → TrafficPage-DZ50qwme.js} +1 -1
- package/assets/assets/{TrafficSourceDetailPage-BmYhK9jm.js → TrafficSourceDetailPage-CzK5TMFp.js} +1 -1
- package/assets/assets/{arrow-left-CUmHyNnF.js → arrow-left-BaZIkAXX.js} +1 -1
- package/assets/assets/{extract-error-message-DFjy9_zi.js → extract-error-message-cpvfuFqW.js} +1 -1
- package/assets/assets/{index-D9smxU6R.js → index-EnY_OBRd.js} +70 -70
- package/assets/assets/{trash-2-B_UtEEm8.js → trash-2-JpcztiS5.js} +1 -1
- package/assets/index.html +1 -1
- package/dist/{chunk-XI6YSTGE.js → chunk-2QBSRHSN.js} +187 -1
- package/dist/{chunk-KPN22EWK.js → chunk-AVN6Q6LM.js} +138 -2
- package/dist/{chunk-BPZWX7YI.js → chunk-CXIGHPBE.js} +1006 -324
- package/dist/{chunk-FB43IMZT.js → chunk-LCABGFYN.js} +724 -286
- package/dist/cli.js +372 -148
- package/dist/index.d.ts +17 -0
- package/dist/index.js +4 -4
- package/dist/{intelligence-service-C76ZRMF5.js → intelligence-service-ZWW3I3NL.js} +2 -2
- package/dist/mcp.js +9 -3
- package/package.json +11 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c}from"./index-
|
|
1
|
+
import{c}from"./index-EnY_OBRd.js";const a=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],h=c("circle-check",a);const e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],n=c("circle-question-mark",e);const o=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],s=c("download",o);const t=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],r=c("trash-2",t);export{h as C,s as D,r as T,n as a};
|
package/assets/index.html
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<link rel="icon" type="image/png" sizes="32x32" href="./favicon-32.png" />
|
|
13
13
|
<link rel="apple-touch-icon" href="./apple-touch-icon.png" />
|
|
14
14
|
<title>Canonry</title>
|
|
15
|
-
<script type="module" crossorigin src="./assets/index-
|
|
15
|
+
<script type="module" crossorigin src="./assets/index-EnY_OBRd.js"></script>
|
|
16
16
|
<link rel="modulepreload" crossorigin href="./assets/vendor-tanstack-Dq7p98wZ.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="./assets/vendor-radix-B57xfQbP.js">
|
|
18
18
|
<link rel="modulepreload" crossorigin href="./assets/vendor-recharts-ClRVR6aX.js">
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
trafficConnectVercelRequestSchema,
|
|
23
23
|
trafficConnectWordpressRequestSchema,
|
|
24
24
|
trafficEventKindSchema
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-AVN6Q6LM.js";
|
|
26
26
|
|
|
27
27
|
// src/config.ts
|
|
28
28
|
import fs from "fs";
|
|
@@ -2193,6 +2193,94 @@ var getApiV1ProjectsByNameGbpSummary = (options) => {
|
|
|
2193
2193
|
...options
|
|
2194
2194
|
});
|
|
2195
2195
|
};
|
|
2196
|
+
var postApiV1ProjectsByNameAdsConnect = (options) => {
|
|
2197
|
+
return (options.client ?? client).post({
|
|
2198
|
+
security: [
|
|
2199
|
+
{
|
|
2200
|
+
scheme: "bearer",
|
|
2201
|
+
type: "http"
|
|
2202
|
+
}
|
|
2203
|
+
],
|
|
2204
|
+
url: "/api/v1/projects/{name}/ads/connect",
|
|
2205
|
+
...options,
|
|
2206
|
+
headers: {
|
|
2207
|
+
"Content-Type": "application/json",
|
|
2208
|
+
...options.headers
|
|
2209
|
+
}
|
|
2210
|
+
});
|
|
2211
|
+
};
|
|
2212
|
+
var deleteApiV1ProjectsByNameAdsConnection = (options) => {
|
|
2213
|
+
return (options.client ?? client).delete({
|
|
2214
|
+
security: [
|
|
2215
|
+
{
|
|
2216
|
+
scheme: "bearer",
|
|
2217
|
+
type: "http"
|
|
2218
|
+
}
|
|
2219
|
+
],
|
|
2220
|
+
url: "/api/v1/projects/{name}/ads/connection",
|
|
2221
|
+
...options
|
|
2222
|
+
});
|
|
2223
|
+
};
|
|
2224
|
+
var getApiV1ProjectsByNameAdsStatus = (options) => {
|
|
2225
|
+
return (options.client ?? client).get({
|
|
2226
|
+
security: [
|
|
2227
|
+
{
|
|
2228
|
+
scheme: "bearer",
|
|
2229
|
+
type: "http"
|
|
2230
|
+
}
|
|
2231
|
+
],
|
|
2232
|
+
url: "/api/v1/projects/{name}/ads/status",
|
|
2233
|
+
...options
|
|
2234
|
+
});
|
|
2235
|
+
};
|
|
2236
|
+
var postApiV1ProjectsByNameAdsSync = (options) => {
|
|
2237
|
+
return (options.client ?? client).post({
|
|
2238
|
+
security: [
|
|
2239
|
+
{
|
|
2240
|
+
scheme: "bearer",
|
|
2241
|
+
type: "http"
|
|
2242
|
+
}
|
|
2243
|
+
],
|
|
2244
|
+
url: "/api/v1/projects/{name}/ads/sync",
|
|
2245
|
+
...options
|
|
2246
|
+
});
|
|
2247
|
+
};
|
|
2248
|
+
var getApiV1ProjectsByNameAdsCampaigns = (options) => {
|
|
2249
|
+
return (options.client ?? client).get({
|
|
2250
|
+
security: [
|
|
2251
|
+
{
|
|
2252
|
+
scheme: "bearer",
|
|
2253
|
+
type: "http"
|
|
2254
|
+
}
|
|
2255
|
+
],
|
|
2256
|
+
url: "/api/v1/projects/{name}/ads/campaigns",
|
|
2257
|
+
...options
|
|
2258
|
+
});
|
|
2259
|
+
};
|
|
2260
|
+
var getApiV1ProjectsByNameAdsInsights = (options) => {
|
|
2261
|
+
return (options.client ?? client).get({
|
|
2262
|
+
security: [
|
|
2263
|
+
{
|
|
2264
|
+
scheme: "bearer",
|
|
2265
|
+
type: "http"
|
|
2266
|
+
}
|
|
2267
|
+
],
|
|
2268
|
+
url: "/api/v1/projects/{name}/ads/insights",
|
|
2269
|
+
...options
|
|
2270
|
+
});
|
|
2271
|
+
};
|
|
2272
|
+
var getApiV1ProjectsByNameAdsSummary = (options) => {
|
|
2273
|
+
return (options.client ?? client).get({
|
|
2274
|
+
security: [
|
|
2275
|
+
{
|
|
2276
|
+
scheme: "bearer",
|
|
2277
|
+
type: "http"
|
|
2278
|
+
}
|
|
2279
|
+
],
|
|
2280
|
+
url: "/api/v1/projects/{name}/ads/summary",
|
|
2281
|
+
...options
|
|
2282
|
+
});
|
|
2283
|
+
};
|
|
2196
2284
|
var postApiV1ProjectsByNameBingConnect = (options) => {
|
|
2197
2285
|
return (options.client ?? client).post({
|
|
2198
2286
|
security: [
|
|
@@ -4129,6 +4217,41 @@ var ApiClient = class {
|
|
|
4129
4217
|
})
|
|
4130
4218
|
);
|
|
4131
4219
|
}
|
|
4220
|
+
async adsConnect(project, body) {
|
|
4221
|
+
return this.invoke(
|
|
4222
|
+
() => postApiV1ProjectsByNameAdsConnect({ client: this.heyClient, path: { name: project }, body })
|
|
4223
|
+
);
|
|
4224
|
+
}
|
|
4225
|
+
async adsDisconnect(project) {
|
|
4226
|
+
return this.invoke(
|
|
4227
|
+
() => deleteApiV1ProjectsByNameAdsConnection({ client: this.heyClient, path: { name: project } })
|
|
4228
|
+
);
|
|
4229
|
+
}
|
|
4230
|
+
async getAdsStatus(project) {
|
|
4231
|
+
return this.invoke(
|
|
4232
|
+
() => getApiV1ProjectsByNameAdsStatus({ client: this.heyClient, path: { name: project } })
|
|
4233
|
+
);
|
|
4234
|
+
}
|
|
4235
|
+
async triggerAdsSync(project) {
|
|
4236
|
+
return this.invoke(
|
|
4237
|
+
() => postApiV1ProjectsByNameAdsSync({ client: this.heyClient, path: { name: project } })
|
|
4238
|
+
);
|
|
4239
|
+
}
|
|
4240
|
+
async getAdsCampaigns(project) {
|
|
4241
|
+
return this.invoke(
|
|
4242
|
+
() => getApiV1ProjectsByNameAdsCampaigns({ client: this.heyClient, path: { name: project } })
|
|
4243
|
+
);
|
|
4244
|
+
}
|
|
4245
|
+
async getAdsInsights(project, query) {
|
|
4246
|
+
return this.invoke(
|
|
4247
|
+
() => getApiV1ProjectsByNameAdsInsights({ client: this.heyClient, path: { name: project }, query })
|
|
4248
|
+
);
|
|
4249
|
+
}
|
|
4250
|
+
async getAdsSummary(project) {
|
|
4251
|
+
return this.invoke(
|
|
4252
|
+
() => getApiV1ProjectsByNameAdsSummary({ client: this.heyClient, path: { name: project } })
|
|
4253
|
+
);
|
|
4254
|
+
}
|
|
4132
4255
|
async listGbpMetrics(project, opts) {
|
|
4133
4256
|
return this.invoke(
|
|
4134
4257
|
() => getApiV1ProjectsByNameGbpMetrics({
|
|
@@ -5147,6 +5270,13 @@ var gbpLocationScopedInputSchema = z2.object({
|
|
|
5147
5270
|
var gbpAccountsInputSchema = z2.object({
|
|
5148
5271
|
project: projectNameSchema
|
|
5149
5272
|
});
|
|
5273
|
+
var adsInsightsInputSchema = z2.object({
|
|
5274
|
+
project: projectNameSchema,
|
|
5275
|
+
level: z2.enum(["campaign", "ad_group"]).optional(),
|
|
5276
|
+
entityId: z2.string().optional(),
|
|
5277
|
+
from: z2.string().optional(),
|
|
5278
|
+
to: z2.string().optional()
|
|
5279
|
+
});
|
|
5150
5280
|
var keywordsInputSchema = z2.object({
|
|
5151
5281
|
project: projectNameSchema,
|
|
5152
5282
|
request: keywordBatchRequestSchema
|
|
@@ -6564,6 +6694,62 @@ var canonryMcpTools = [
|
|
|
6564
6694
|
sitemapUrl: input.sitemapUrl,
|
|
6565
6695
|
limit: input.limit
|
|
6566
6696
|
})
|
|
6697
|
+
}),
|
|
6698
|
+
// ----- OpenAI ads (ChatGPT ads) -----
|
|
6699
|
+
defineTool({
|
|
6700
|
+
name: "canonry_ads_status",
|
|
6701
|
+
title: "OpenAI ads connection status",
|
|
6702
|
+
description: "Connection status and last sync time for the project's OpenAI ad account (ChatGPT ads).",
|
|
6703
|
+
access: "read",
|
|
6704
|
+
tier: "ads",
|
|
6705
|
+
inputSchema: projectInputSchema,
|
|
6706
|
+
annotations: readAnnotations(),
|
|
6707
|
+
openApiOperations: ["GET /api/v1/projects/{name}/ads/status"],
|
|
6708
|
+
handler: (client2, input) => client2.getAdsStatus(input.project)
|
|
6709
|
+
}),
|
|
6710
|
+
defineTool({
|
|
6711
|
+
name: "canonry_ads_campaigns",
|
|
6712
|
+
title: "List synced ad campaigns",
|
|
6713
|
+
description: "Synced campaign snapshots with nested ad groups (context hints \u2014 the targeting primitive) and ads. Paid-surface structure; never conflate with organic cited/mentioned signals.",
|
|
6714
|
+
access: "read",
|
|
6715
|
+
tier: "ads",
|
|
6716
|
+
inputSchema: projectInputSchema,
|
|
6717
|
+
annotations: readAnnotations(),
|
|
6718
|
+
openApiOperations: ["GET /api/v1/projects/{name}/ads/campaigns"],
|
|
6719
|
+
handler: (client2, input) => client2.getAdsCampaigns(input.project)
|
|
6720
|
+
}),
|
|
6721
|
+
defineTool({
|
|
6722
|
+
name: "canonry_ads_insights",
|
|
6723
|
+
title: "Daily paid-performance rollups",
|
|
6724
|
+
description: "Daily paid-performance rollups per level (campaign/ad_group). Spend is integer micros; ctr/cpcMicros are derived server-side (null on zero denominators).",
|
|
6725
|
+
access: "read",
|
|
6726
|
+
tier: "ads",
|
|
6727
|
+
inputSchema: adsInsightsInputSchema,
|
|
6728
|
+
annotations: readAnnotations(),
|
|
6729
|
+
openApiOperations: ["GET /api/v1/projects/{name}/ads/insights"],
|
|
6730
|
+
handler: (client2, input) => client2.getAdsInsights(input.project, compactStringParams(input, ["level", "entityId", "from", "to"]))
|
|
6731
|
+
}),
|
|
6732
|
+
defineTool({
|
|
6733
|
+
name: "canonry_ads_summary",
|
|
6734
|
+
title: "Paid-performance summary",
|
|
6735
|
+
description: "Composite paid summary: campaign/ad-group/ad counts, campaign-level totals (impressions, clicks, spend micros, derived ctr/cpc) and the covered date window.",
|
|
6736
|
+
access: "read",
|
|
6737
|
+
tier: "ads",
|
|
6738
|
+
inputSchema: projectInputSchema,
|
|
6739
|
+
annotations: readAnnotations(),
|
|
6740
|
+
openApiOperations: ["GET /api/v1/projects/{name}/ads/summary"],
|
|
6741
|
+
handler: (client2, input) => client2.getAdsSummary(input.project)
|
|
6742
|
+
}),
|
|
6743
|
+
defineTool({
|
|
6744
|
+
name: "canonry_ads_sync",
|
|
6745
|
+
title: "Trigger ads sync",
|
|
6746
|
+
description: "Trigger an ads-sync run (entity snapshots + daily paid-performance rollups) for the connected OpenAI ad account. Returns the run id; poll canonry_run_get for status.",
|
|
6747
|
+
access: "write",
|
|
6748
|
+
tier: "ads",
|
|
6749
|
+
inputSchema: projectInputSchema,
|
|
6750
|
+
annotations: writeAnnotations({ idempotentHint: true }),
|
|
6751
|
+
openApiOperations: ["POST /api/v1/projects/{name}/ads/sync"],
|
|
6752
|
+
handler: (client2, input) => client2.triggerAdsSync(input.project)
|
|
6567
6753
|
})
|
|
6568
6754
|
];
|
|
6569
6755
|
var CANONRY_MCP_TOOL_COUNT = canonryMcpTools.length;
|
|
@@ -383,7 +383,8 @@ var runKindSchema = z3.enum([
|
|
|
383
383
|
"traffic-sync",
|
|
384
384
|
"aeo-discover-seed",
|
|
385
385
|
"aeo-discover-probe",
|
|
386
|
-
"gbp-sync"
|
|
386
|
+
"gbp-sync",
|
|
387
|
+
"ads-sync"
|
|
387
388
|
]);
|
|
388
389
|
var RunKinds = runKindSchema.enum;
|
|
389
390
|
var runTriggerSchema = z3.enum(["manual", "scheduled", "config-apply", "backfill", "probe"]);
|
|
@@ -1618,7 +1619,7 @@ var siteAuditRunResponseSchema = z14.object({
|
|
|
1618
1619
|
|
|
1619
1620
|
// ../contracts/src/schedule.ts
|
|
1620
1621
|
import { z as z15 } from "zod";
|
|
1621
|
-
var schedulableRunKindSchema = z15.enum(["answer-visibility", "traffic-sync", "gbp-sync", "data-refresh", "backlinks-sync", "site-audit"]);
|
|
1622
|
+
var schedulableRunKindSchema = z15.enum(["answer-visibility", "traffic-sync", "gbp-sync", "data-refresh", "backlinks-sync", "site-audit", "ads-sync"]);
|
|
1622
1623
|
var SchedulableRunKinds = schedulableRunKindSchema.enum;
|
|
1623
1624
|
var scheduleDtoSchema = z15.object({
|
|
1624
1625
|
id: z15.string(),
|
|
@@ -4257,6 +4258,129 @@ function formatDeltaCopy(d, suffix, windowLabel = "vs prior 7 days") {
|
|
|
4257
4258
|
return `Flat ${windowLabel} (${formatNumber(d.prior)} ${suffix})`;
|
|
4258
4259
|
}
|
|
4259
4260
|
|
|
4261
|
+
// ../contracts/src/ads.ts
|
|
4262
|
+
import { z as z30 } from "zod";
|
|
4263
|
+
var adsConnectRequestSchema = z30.object({
|
|
4264
|
+
/** Ads Manager "SDK key" scoped to one ad account. Stored in config.yaml, never the DB. */
|
|
4265
|
+
apiKey: z30.string().min(1)
|
|
4266
|
+
});
|
|
4267
|
+
var adsConnectionStatusDtoSchema = z30.object({
|
|
4268
|
+
connected: z30.boolean(),
|
|
4269
|
+
adAccountId: z30.string().nullable().optional(),
|
|
4270
|
+
displayName: z30.string().nullable().optional(),
|
|
4271
|
+
currencyCode: z30.string().nullable().optional(),
|
|
4272
|
+
timezone: z30.string().nullable().optional(),
|
|
4273
|
+
status: z30.string().nullable().optional(),
|
|
4274
|
+
lastSyncedAt: z30.string().nullable().optional()
|
|
4275
|
+
});
|
|
4276
|
+
var adsDisconnectResponseSchema = z30.object({
|
|
4277
|
+
disconnected: z30.boolean()
|
|
4278
|
+
});
|
|
4279
|
+
var adsSyncResponseSchema = z30.object({
|
|
4280
|
+
runId: z30.string(),
|
|
4281
|
+
status: z30.string()
|
|
4282
|
+
});
|
|
4283
|
+
var adsCreativeDtoSchema = z30.object({
|
|
4284
|
+
type: z30.string().nullable().optional(),
|
|
4285
|
+
title: z30.string().nullable().optional(),
|
|
4286
|
+
body: z30.string().nullable().optional(),
|
|
4287
|
+
targetUrl: z30.string().nullable().optional()
|
|
4288
|
+
});
|
|
4289
|
+
var adsAdDtoSchema = z30.object({
|
|
4290
|
+
id: z30.string(),
|
|
4291
|
+
adGroupId: z30.string(),
|
|
4292
|
+
name: z30.string(),
|
|
4293
|
+
status: z30.string(),
|
|
4294
|
+
reviewStatus: z30.string().nullable().optional(),
|
|
4295
|
+
creative: adsCreativeDtoSchema.nullable().optional()
|
|
4296
|
+
});
|
|
4297
|
+
var adsAdGroupDtoSchema = z30.object({
|
|
4298
|
+
id: z30.string(),
|
|
4299
|
+
campaignId: z30.string(),
|
|
4300
|
+
name: z30.string(),
|
|
4301
|
+
status: z30.string(),
|
|
4302
|
+
billingEventType: z30.string().nullable().optional(),
|
|
4303
|
+
maxBidMicros: z30.number().int().nullable().optional(),
|
|
4304
|
+
/**
|
|
4305
|
+
* The targeting primitive: entries are multi-line strings of
|
|
4306
|
+
* newline-separated example queries (the live Ads Manager format).
|
|
4307
|
+
*/
|
|
4308
|
+
contextHints: z30.array(z30.string()).default([]),
|
|
4309
|
+
ads: z30.array(adsAdDtoSchema).default([])
|
|
4310
|
+
});
|
|
4311
|
+
var adsCampaignDtoSchema = z30.object({
|
|
4312
|
+
id: z30.string(),
|
|
4313
|
+
name: z30.string(),
|
|
4314
|
+
status: z30.string(),
|
|
4315
|
+
biddingType: z30.string().nullable().optional(),
|
|
4316
|
+
dailySpendLimitMicros: z30.number().int().nullable().optional(),
|
|
4317
|
+
lifetimeSpendLimitMicros: z30.number().int().nullable().optional(),
|
|
4318
|
+
adGroups: z30.array(adsAdGroupDtoSchema).default([])
|
|
4319
|
+
});
|
|
4320
|
+
var adsCampaignListResponseSchema = z30.object({
|
|
4321
|
+
campaigns: z30.array(adsCampaignDtoSchema)
|
|
4322
|
+
});
|
|
4323
|
+
var adsInsightLevelSchema = z30.enum(["campaign", "ad_group"]);
|
|
4324
|
+
var AdsInsightLevels = adsInsightLevelSchema.enum;
|
|
4325
|
+
var adsInsightRowDtoSchema = z30.object({
|
|
4326
|
+
level: adsInsightLevelSchema,
|
|
4327
|
+
entityId: z30.string(),
|
|
4328
|
+
date: z30.string(),
|
|
4329
|
+
impressions: z30.number().int(),
|
|
4330
|
+
clicks: z30.number().int(),
|
|
4331
|
+
spendMicros: z30.number().int(),
|
|
4332
|
+
/** clicks / impressions; null when impressions is 0. */
|
|
4333
|
+
ctr: z30.number().nullable(),
|
|
4334
|
+
/** spendMicros / clicks, rounded to integer micros; null when clicks is 0. */
|
|
4335
|
+
cpcMicros: z30.number().int().nullable()
|
|
4336
|
+
});
|
|
4337
|
+
var adsInsightsResponseSchema = z30.object({
|
|
4338
|
+
rows: z30.array(adsInsightRowDtoSchema),
|
|
4339
|
+
/** Account currency for rendering spend/cpc; null before the first sync. */
|
|
4340
|
+
currencyCode: z30.string().nullable().optional()
|
|
4341
|
+
});
|
|
4342
|
+
var adsTotalsDtoSchema = z30.object({
|
|
4343
|
+
impressions: z30.number().int(),
|
|
4344
|
+
clicks: z30.number().int(),
|
|
4345
|
+
spendMicros: z30.number().int(),
|
|
4346
|
+
ctr: z30.number().nullable(),
|
|
4347
|
+
cpcMicros: z30.number().int().nullable()
|
|
4348
|
+
});
|
|
4349
|
+
var adsSummaryDtoSchema = z30.object({
|
|
4350
|
+
connected: z30.boolean(),
|
|
4351
|
+
displayName: z30.string().nullable().optional(),
|
|
4352
|
+
currencyCode: z30.string().nullable().optional(),
|
|
4353
|
+
lastSyncedAt: z30.string().nullable().optional(),
|
|
4354
|
+
campaignCount: z30.number().int(),
|
|
4355
|
+
adGroupCount: z30.number().int(),
|
|
4356
|
+
adCount: z30.number().int(),
|
|
4357
|
+
/** Date range the totals cover (oldest/newest rollup date), null when empty. */
|
|
4358
|
+
window: z30.object({
|
|
4359
|
+
from: z30.string().nullable(),
|
|
4360
|
+
to: z30.string().nullable()
|
|
4361
|
+
}),
|
|
4362
|
+
/** Campaign-level rollup totals over the window (levels are not summed across). */
|
|
4363
|
+
totals: adsTotalsDtoSchema
|
|
4364
|
+
});
|
|
4365
|
+
function adsCtr(clicks, impressions) {
|
|
4366
|
+
return impressions > 0 ? clicks / impressions : null;
|
|
4367
|
+
}
|
|
4368
|
+
function adsCpcMicros(spendMicros, clicks) {
|
|
4369
|
+
return clicks > 0 ? Math.round(spendMicros / clicks) : null;
|
|
4370
|
+
}
|
|
4371
|
+
|
|
4372
|
+
// ../contracts/src/money.ts
|
|
4373
|
+
var MICROS_PER_UNIT = 1e6;
|
|
4374
|
+
function dollarsToMicros(dollars) {
|
|
4375
|
+
return Math.round(dollars * MICROS_PER_UNIT);
|
|
4376
|
+
}
|
|
4377
|
+
function formatMicros(micros, currencyCode = "USD") {
|
|
4378
|
+
return new Intl.NumberFormat("en-US", {
|
|
4379
|
+
style: "currency",
|
|
4380
|
+
currency: currencyCode
|
|
4381
|
+
}).format(micros / MICROS_PER_UNIT);
|
|
4382
|
+
}
|
|
4383
|
+
|
|
4260
4384
|
// ../contracts/src/ai-engines.ts
|
|
4261
4385
|
var AI_ENGINE_DOMAINS = {
|
|
4262
4386
|
/** OpenAI marketing/blog/API surface. */
|
|
@@ -4566,6 +4690,18 @@ export {
|
|
|
4566
4690
|
deltaPercent,
|
|
4567
4691
|
deltaTone,
|
|
4568
4692
|
formatDeltaCopy,
|
|
4693
|
+
adsConnectRequestSchema,
|
|
4694
|
+
adsConnectionStatusDtoSchema,
|
|
4695
|
+
adsDisconnectResponseSchema,
|
|
4696
|
+
adsSyncResponseSchema,
|
|
4697
|
+
adsCampaignListResponseSchema,
|
|
4698
|
+
adsInsightLevelSchema,
|
|
4699
|
+
adsInsightsResponseSchema,
|
|
4700
|
+
adsSummaryDtoSchema,
|
|
4701
|
+
adsCtr,
|
|
4702
|
+
adsCpcMicros,
|
|
4703
|
+
dollarsToMicros,
|
|
4704
|
+
formatMicros,
|
|
4569
4705
|
AI_ENGINE_DOMAINS,
|
|
4570
4706
|
AI_ENGINE_SELF_DOMAINS,
|
|
4571
4707
|
VERTEX_AI_SEARCH_PROXY_DOMAIN,
|