@adport/mcp 0.13.2 → 0.14.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/dist/bin.js +1 -1
- package/dist/{chunk-NWNTOUFX.js → chunk-U5SWUPMQ.js} +87 -36
- package/dist/chunk-U5SWUPMQ.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +18 -16
- package/dist/chunk-NWNTOUFX.js.map +0 -1
package/dist/bin.js
CHANGED
|
@@ -3,7 +3,7 @@ import { McpServer } from "@modelcontextprotocol/server";
|
|
|
3
3
|
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { registerAppResource, registerAppTool, RESOURCE_MIME_TYPE } from "@modelcontextprotocol/ext-apps/server";
|
|
6
|
-
import { AdportError, CredentialStore, createContext, selectRuntimeCatalog, nextPageArguments, writeOutput } from "@adport/core";
|
|
6
|
+
import { TOOL_PROVIDERS, AdportError, CredentialStore, createContext, selectRuntimeCatalog, nextPageArguments, writeOutput } from "@adport/core";
|
|
7
7
|
import { createGa4Module, createGscModule } from "@adport/provider-analytics";
|
|
8
8
|
import { createGtmModule } from "@adport/provider-gtm";
|
|
9
9
|
import { createGoogleModule } from "@adport/provider-google";
|
|
@@ -18,11 +18,13 @@ import { createPinterestModule } from "@adport/provider-pinterest";
|
|
|
18
18
|
import { createLinkedInModule } from "@adport/provider-linkedin";
|
|
19
19
|
import { createXModule } from "@adport/provider-x";
|
|
20
20
|
import { createOpenAIModule } from "@adport/provider-openai";
|
|
21
|
+
import { createGravityModule } from "@adport/provider-gravity";
|
|
22
|
+
import { createMatomoModule } from "@adport/provider-matomo";
|
|
21
23
|
|
|
22
24
|
// package.json
|
|
23
25
|
var package_default = {
|
|
24
26
|
name: "@adport/mcp",
|
|
25
|
-
version: "0.
|
|
27
|
+
version: "0.14.0",
|
|
26
28
|
description: "adport MCP server \u2014 the open control plane for paid media",
|
|
27
29
|
license: "Apache-2.0",
|
|
28
30
|
type: "module",
|
|
@@ -59,13 +61,15 @@ var package_default = {
|
|
|
59
61
|
"@adport/provider-snapchat": "workspace:*",
|
|
60
62
|
"@adport/provider-spotify": "workspace:*",
|
|
61
63
|
"@adport/provider-tiktok": "workspace:*",
|
|
64
|
+
"@adport/provider-gravity": "workspace:*",
|
|
62
65
|
"@adport/provider-openai": "workspace:*",
|
|
63
66
|
"@adport/provider-x": "workspace:*",
|
|
64
67
|
"@modelcontextprotocol/ext-apps": "^2.0.4",
|
|
65
68
|
zod: "^4.6.7",
|
|
66
69
|
"@modelcontextprotocol/server": "^2.4.0",
|
|
67
70
|
"@adport/provider-gtm": "workspace:*",
|
|
68
|
-
"@adport/provider-analytics": "workspace:*"
|
|
71
|
+
"@adport/provider-analytics": "workspace:*",
|
|
72
|
+
"@adport/provider-matomo": "workspace:*"
|
|
69
73
|
},
|
|
70
74
|
devDependencies: {
|
|
71
75
|
"@types/jsdom": "^21.1.7",
|
|
@@ -93,6 +97,34 @@ var package_default = {
|
|
|
93
97
|
}
|
|
94
98
|
};
|
|
95
99
|
|
|
100
|
+
// src/acquisition-ui.ts
|
|
101
|
+
var ACQUISITION_UI = String.raw`
|
|
102
|
+
function renderAcquisition(data,meta) {
|
|
103
|
+
const goals=meta.tool==='analytics_goals',rows=arr(goals?data.goals:data.rows),range=data.date_range;
|
|
104
|
+
const provider=data.provider||meta.provider;
|
|
105
|
+
const scope=[meta.providerNames?.[provider],data.account_id,
|
|
106
|
+
range&&[range.start,range.end].filter(Boolean).join(' – '),range?.timezone].filter(Boolean).join(' · ');
|
|
107
|
+
const pageArgs=goals?null:readPageArgs(meta,'data-report-next');
|
|
108
|
+
const landing=rows.some(row=>Object.hasOwn(row.dimensions||{},'landing_page'));
|
|
109
|
+
const labels=goals?['Goal','ID','Counting method']:['Source','Medium','Campaign',...(landing?['Landing page']:[]),'Sessions','Conversions','Revenue'+(data.currency?' · '+data.currency:'')];
|
|
110
|
+
const format=new Intl.NumberFormat(state.host.locale||'en',{maximumFractionDigits:4});
|
|
111
|
+
const amount=value=>typeof value==='number'&&Number.isFinite(value)?format.format(value):'—';
|
|
112
|
+
const values=rows.map(row=>{
|
|
113
|
+
if(goals)return [row.name,row.id,row.counting_method?human(row.counting_method.toLowerCase()):'—'];
|
|
114
|
+
const d=row.dimensions||{},m=row.metrics||{};
|
|
115
|
+
return [d.source,d.medium,d.campaign,...(landing?[d.landing_page]:[]),amount(m.sessions),amount(m.conversions),amount(m.revenue)];
|
|
116
|
+
});
|
|
117
|
+
const title=goals?'Conversion goals':'Conversions by acquisition';
|
|
118
|
+
const clean={...data};delete clean._adport;
|
|
119
|
+
const body=values.length?workflowTable(labels,values,title):workflowNote(goals?'No conversion goals configured for this site.':'No acquisition rows returned for these dates.');
|
|
120
|
+
app.innerHTML=chrome(operationHeader(title,scope,provider)+notices(data)+'<section data-native-report data-read-page-focus tabindex="-1">'+body+
|
|
121
|
+
readPageMarkup(pageArgs,'data-report-next','data-report-page-status')+
|
|
122
|
+
'<details class="report-data"><summary>Details · '+rows.length+' results</summary>'+workflowNote(data.attribution)+workflowNote(data.revenue_basis)+
|
|
123
|
+
'<pre>'+esc(JSON.stringify(clean,null,2))+'</pre></details></section>','');
|
|
124
|
+
bindReadPage(meta,pageArgs,'data-report-next','data-report-page-status',value=>Array.isArray(value?.rows));
|
|
125
|
+
}
|
|
126
|
+
`;
|
|
127
|
+
|
|
96
128
|
// src/media-library-ui.ts
|
|
97
129
|
var MEDIA_LIBRARY_STYLES = String.raw`
|
|
98
130
|
.media-library { position:relative }
|
|
@@ -736,7 +768,7 @@ ${RECORD_COLLECTION_UI}
|
|
|
736
768
|
}).join('')+'</dl>':'')+'</article>';
|
|
737
769
|
}
|
|
738
770
|
function entityRecordTable(tool) {
|
|
739
|
-
return /^(?:google|meta|apple|microsoft|tiktok|linkedin|pinterest|reddit|snapchat|spotify|openai|x)_(?:list_)?(?:campaigns|campaign_groups|adgroups|ad_groups|ad_sets|adsets|line_items|adsquads)$/.test(tool||'');
|
|
771
|
+
return /^(?:google|meta|apple|microsoft|tiktok|linkedin|pinterest|reddit|snapchat|spotify|openai|gravity|x)_(?:list_)?(?:campaigns|campaign_groups|adgroups|ad_groups|ad_sets|adsets|line_items|adsquads)$/.test(tool||'');
|
|
740
772
|
}
|
|
741
773
|
|
|
742
774
|
function entityFields(row,meta) {
|
|
@@ -816,7 +848,7 @@ ${RECORD_COLLECTION_UI}
|
|
|
816
848
|
if(meta.tool==='apple_report')return renderAppleReport(data,meta);
|
|
817
849
|
if(nativeReportTools.has(meta.tool)&&(meta.tool!=='google_gaql'||arr(recordPayload(data)?.rows).some(row=>object(row?.metrics)&&Object.keys(row.metrics).length)))return renderNativeReport(data,meta);
|
|
818
850
|
const payload=recordPayload(data),entries=recordEntries(payload),rows=entries ?? [payload];
|
|
819
|
-
const title=meta.tool==='google_gaql'?'Google Ads query results':human(String(meta.tool||'Results').replace(/^(?:google|meta|tiktok|apple|microsoft|reddit|snapchat|spotify|pinterest|linkedin|openai|x)_/,'').replace(/^(?:list|get)_/,'').replace(/_(?:list|get)$/,'').replaceAll('_',' '));
|
|
851
|
+
const title=meta.tool==='google_gaql'?'Google Ads query results':human(String(meta.tool||'Results').replace(/^(?:google|meta|tiktok|apple|microsoft|reddit|snapchat|spotify|pinterest|linkedin|openai|gravity|x)_/,'').replace(/^(?:list|get)_/,'').replace(/_(?:list|get)$/,'').replaceAll('_',' '));
|
|
820
852
|
const parent=object(data.parent)?Object.entries(data.parent).filter(([key])=>/_id$/.test(key)).map(([key,value])=>human(key.replace(/_id$/,''))+' '+value).join(' · '):'';
|
|
821
853
|
const scope=[parent,typeof data.parent_id==='string'&&!parent?data.parent_id:'',meta.accountId].filter(Boolean).join(' · ');
|
|
822
854
|
const clean=object(data)?Object.fromEntries(Object.entries(data).filter(([key])=>key!=='_adport'&&!(key==='creatives'&&meta.view==='records'))):data;
|
|
@@ -1202,6 +1234,7 @@ var PROVIDER_GALLERY_UI = String.raw`
|
|
|
1202
1234
|
var PROVIDER_LOGOS = {
|
|
1203
1235
|
"ga4": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" color="#e37400" style="color:#e37400" height="1em" width="1em"><path d="M22.84 2.9982v17.9987c.0086 1.6473-1.3197 2.9897-2.967 2.9984a2.9808 2.9808 0 01-.3677-.0208c-1.528-.226-2.6477-1.5558-2.6105-3.1V3.1204c-.0369-1.5458 1.0856-2.8762 2.6157-3.1 1.6361-.1915 3.1178.9796 3.3093 2.6158.014.1201.0208.241.0202.3619zM4.1326 18.0548c-1.6417 0-2.9726 1.331-2.9726 2.9726C1.16 22.6691 2.4909 24 4.1326 24s2.9726-1.3309 2.9726-2.9726-1.331-2.9726-2.9726-2.9726zm7.8728-9.0098c-.0171 0-.0342 0-.0513.0003-1.6495.0904-2.9293 1.474-2.891 3.1256v7.9846c0 2.167.9535 3.4825 2.3505 3.763 1.6118.3266 3.1832-.7152 3.5098-2.327.04-.1974.06-.3983.0593-.5998v-8.9585c.003-1.6474-1.33-2.9852-2.9773-2.9882z"></path></svg>',
|
|
1204
1236
|
"gsc": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" color="#4285f4" style="color:#4285f4" height="1em" width="1em"><path d="M8.548 1.156L6.832 2.872v1.682h1.716zm0 3.398v.035H6.832v-.035H3.386L0 7.844v3.577h2.826V8.94c0-.525.429-.954.954-.954h16.476c.525 0 .954.43.954.954v2.48h2.754V7.844l-3.386-3.29H17.3v.035h-1.717v-.035zm7.035 0H17.3V2.872l-1.717-1.716zM8.679 1.188V2.84h6.773V1.188zm11.471 7.07a.834.834 0 00-.132.01l-.543.002c-5.216.014-10.432-.008-15.648.01-.435-.063-.794.436-.716.883v2.264h17.812c-.016-.888.045-1.782-.034-2.666-.104-.342-.427-.502-.739-.502zm-15.422.634a.689.698 0 01.689.698.689.698 0 01-.689.697.689.698 0 01-.688-.697.689.698 0 01.688-.698zm2.134 0a.689.698 0 01.689.698.689.698 0 01-.689.697.689.698 0 01-.688-.697.689.698 0 01.688-.698zM.036 11.645v9.156c0 1.05.858 1.908 1.907 1.908h.883V11.645zm21.174 0v11.064h.882c1.05 0 1.908-.858 1.908-1.908v-9.156zM4.057 13.133v6.85h6.137v-6.85zm13.243.021v3.777l-1.708.977-1.708-.977v-3.758a4.006 4.006 0 000 7.23v2.441h3.457v-2.442a4.006 4.006 0 00-.041-7.248zm-13.243 8.26v1.43h7.925v-1.43z"></path></svg>',
|
|
1237
|
+
"matomo": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" color="#3152a0" style="color:#3152a0" height="1em" width="1em"><path d="M6.664 15.37a3.336 3.336 0 0 1-3.332 3.332C1.495 18.702 0 17.208 0 15.37s1.495-3.333 3.332-3.333a3.338 3.338 0 0 1 3.332 3.333zm11.565-3.644a3.658 3.658 0 0 1-1.987.591 3.642 3.642 0 0 1-1.872-.529l.008.012a3.728 3.728 0 0 1-1.235-1.19l-2.612-3.693a.17.17 0 0 1-.027-.033A3.312 3.312 0 0 0 7.67 5.298a3.318 3.318 0 0 0-2.848 1.586.146.146 0 0 1-.021.028l-3.428 5.343a3.663 3.663 0 0 1 5.094 1.18.13.13 0 0 1 .015.018l2.756 3.869a3.305 3.305 0 0 0 2.699 1.38 3.31 3.31 0 0 0 2.711-1.379l.009-.013c.073-.103.137-.202.195-.305l1.442-2.255 1.935-3.024zm5.275 1.902l-.014-.028-.044-.066a1.109 1.109 0 0 0-.029-.044l-3.525-5.37c.024.168.052.335.052.51 0 .741-.219 1.457-.634 2.068l-2.803 4.38 1.416 2.179-.002.002a.131.131 0 0 1 .024.028 3.338 3.338 0 0 0 2.723 1.415A3.335 3.335 0 0 0 24 15.37c0-.613-.171-1.216-.496-1.742zm-7.262-1.666a3.336 3.336 0 0 0 3.332-3.333 3.336 3.336 0 0 0-3.332-3.332 3.336 3.336 0 0 0-3.332 3.332 3.338 3.338 0 0 0 3.332 3.333z"></path></svg>',
|
|
1205
1238
|
"gtm": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" color="#4285f4" style="color:#4285f4" height="1em" width="1em"><path d="M12.003 0a3 3 0 0 0-2.121 5.121l6.865 6.865-4.446 4.541 1.745 1.836a3.432 3.432 0 0 1 .7.739l.012.011-.001.002a3.432 3.432 0 0 1 .609 1.953 3.432 3.432 0 0 1-.09.78l7.75-7.647c.031-.029.067-.05.098-.08.023-.023.038-.052.06-.076a2.994 2.994 0 0 0-.06-4.166l-9-9A2.99 2.99 0 0 0 12.003 0zM8.63 2.133L.88 9.809a2.998 2.998 0 0 0 0 4.238l7.7 7.75a3.432 3.432 0 0 1-.077-.729 3.432 3.432 0 0 1 3.431-3.431 3.432 3.432 0 0 1 .826.101l-5.523-5.81 4.371-4.373-2.08-2.08c-.903-.904-1.193-2.183-.898-3.342zm3.304 16.004a2.932 2.932 0 0 0-2.931 2.931A2.932 2.932 0 0 0 11.934 24a2.932 2.932 0 0 0 2.932-2.932 2.932 2.932 0 0 0-2.932-2.931z"></path></svg>',
|
|
1206
1239
|
"snapchat": '<svg viewBox="0 0 1024 1024" aria-hidden="true"> <path fill="#fff" d="M992.5,756.3c-4.2-13.9-24.3-23.7-24.3-23.7l0,0c-1.9-1-3.6-1.9-5-2.6c-33.5-16.2-63.2-35.7-88.2-57.8 c-20.1-17.8-37.3-37.4-51.1-58.2c-16.9-25.4-24.8-46.6-28.2-58.1c-1.9-7.5-1.6-10.5,0-14.4c1.3-3.3,5.2-6.4,7-7.9 c11.3-8,29.5-19.8,40.7-27c9.7-6.3,18-11.7,22.9-15.1c15.7-11,26.5-22.2,32.8-34.3c8.2-15.6,9.2-32.8,2.8-49.7 c-8.6-22.8-29.9-36.4-57-36.4c-6,0-12.2,0.7-18.4,2c-15.5,3.4-30.2,8.9-42.5,13.7c-0.9,0.4-1.9-0.3-1.8-1.3 c1.3-30.5,2.8-71.5-0.6-110.4c-3-35.2-10.3-64.9-22.1-90.8c-11.9-26-27.4-45.2-39.5-59.1C708.5,112,688.2,92.5,657.6,75 C614.6,50.4,565.6,37.9,512,37.9c-53.5,0-102.4,12.5-145.5,37.1c-32.4,18.5-53.1,39.4-62.5,50.2c-12.1,13.9-27.6,33.1-39.5,59.1 c-11.9,25.9-19.1,55.5-22.1,90.8c-3.4,39.1-2,76.8-0.6,110.4c0,1-0.9,1.7-1.9,1.3c-12.3-4.8-27-10.3-42.5-13.7 c-6.1-1.3-12.3-2-18.4-2c-27,0-48.3,13.6-57,36.4c-6.4,16.9-5.4,34.1,2.8,49.7c6.4,12.1,17.1,23.3,32.8,34.3 c4.8,3.4,13.2,8.8,22.9,15.1c10.9,7.1,28.6,18.6,40,26.5c1.4,1,6.2,4.6,7.7,8.4c1.6,4,1.9,7-0.2,15c-3.5,11.6-11.4,32.6-28,57.5 c-13.8,20.9-31,40.4-51.1,58.2c-25,22.1-54.7,41.6-88.2,57.8c-1.6,0.8-3.5,1.7-5.5,2.9l0,0c0,0-20,10.2-23.8,23.4 c-5.6,19.5,9.3,37.8,24.4,47.6c24.8,16,55,24.6,72.5,29.3c4.9,1.3,9.3,2.5,13.3,3.7c2.5,0.8,8.8,3.2,11.5,6.7 c3.4,4.4,3.8,9.8,5,15.9v0c1.9,10.3,6.2,23,18.9,31.8c14,9.6,31.7,10.3,54.2,11.2c23.5,0.9,52.7,2,86.2,13.1 c15.5,5.1,29.6,13.8,45.8,23.8c34,20.9,76.3,46.9,148.5,46.9c72.3,0,114.9-26.1,149.1-47.1c16.2-9.9,30.1-18.5,45.3-23.5 c33.5-11.1,62.7-12.2,86.2-13.1c22.5-0.9,40.2-1.5,54.2-11.2c13.6-9.4,17.5-23.4,19.3-33.9c1-5.2,1.6-9.9,4.6-13.7 c2.6-3.3,8.4-5.6,11.1-6.5c4.1-1.3,8.7-2.5,13.8-3.9c17.5-4.7,39.5-10.2,66.2-25.3C993.7,789.8,995.9,767.4,992.5,756.3z" /> <path fill="#000" d="M1020.3,745.5c-7.1-19.4-20.7-29.7-36.1-38.3c-2.9-1.7-5.6-3.1-7.8-4.1c-4.6-2.4-9.3-4.7-14-7.1 c-48.1-25.5-85.7-57.7-111.7-95.8c-8.8-12.9-14.9-24.5-19.2-34c-2.2-6.4-2.1-10-0.5-13.3c1.2-2.5,4.4-5.1,6.2-6.4 c8.3-5.5,16.8-11,22.6-14.7c10.3-6.7,18.5-12,23.7-15.6c19.8-13.8,33.6-28.5,42.2-44.9c12.2-23.1,13.7-49.5,4.3-74.3 c-13-34.4-45.6-55.8-85-55.8c-8.2,0-16.5,0.9-24.7,2.7c-2.2,0.5-4.3,1-6.4,1.5c0.4-23.4-0.2-48.4-2.3-72.8 c-7.4-86-37.5-131.1-68.9-167c-13.1-15-35.9-36.9-70.1-56.5C624.9,21.7,570.9,7.9,512,7.9c-58.7,0-112.7,13.8-160.4,41.1 c-34.4,19.6-57.2,41.6-70.2,56.5c-31.4,35.9-61.5,81-68.9,167c-2.1,24.4-2.6,49.4-2.3,72.8c-2.1-0.5-4.3-1-6.4-1.5 c-8.2-1.8-16.6-2.7-24.7-2.7c-39.4,0-72,21.4-85,55.8c-9.4,24.8-7.9,51.2,4.3,74.3c8.6,16.4,22.5,31.1,42.2,44.9 c5.3,3.7,13.4,9,23.7,15.6c5.6,3.6,13.7,8.9,21.7,14.2c1.2,0.8,5.5,4,7,7c1.7,3.4,1.7,7.1-0.8,13.9c-4.2,9.3-10.3,20.7-18.9,33.3 c-25.5,37.3-62,68.9-108.5,94.1c-24.7,13.1-50.3,21.8-61.1,51.2c-8.2,22.2-2.8,47.5,17.9,68.8l0,0c6.8,7.3,15.4,13.8,26.2,19.8 c25.4,14,47,20.9,64,25.6c3,0.9,9.9,3.1,12.9,5.8c7.6,6.6,6.5,16.6,16.6,31.2c6.1,9.1,13.1,15.3,18.9,19.3 c21.1,14.6,44.9,15.5,70.1,16.5c22.7,0.9,48.5,1.9,77.9,11.6c12.2,4,24.9,11.8,39.5,20.8c35.2,21.7,83.5,51.3,164.2,51.3 c80.8,0,129.3-29.8,164.8-51.5c14.6-8.9,27.2-16.7,39-20.6c29.4-9.7,55.2-10.7,77.9-11.6c25.2-1,48.9-1.9,70.1-16.5 c6.6-4.6,15-12.1,21.6-23.5c7.2-12.3,7.1-21,13.9-26.9c2.8-2.4,8.9-4.5,12.2-5.5c17.1-4.7,39-11.6,64.9-25.9 c11.5-6.3,20.4-13.2,27.5-21.1c0.1-0.1,0.2-0.2,0.3-0.3C1023.4,791.7,1028.3,767.2,1020.3,745.5z M948.6,784 c-43.8,24.2-72.9,21.6-95.5,36.1c-19.2,12.4-7.9,39.1-21.8,48.7c-17.2,11.9-67.9-0.8-133.4,20.8c-54,17.9-88.5,69.2-185.8,69.2 c-97.5,0-131-51.1-185.8-69.2c-65.5-21.6-116.3-8.9-133.4-20.8c-13.9-9.6-2.6-36.3-21.8-48.7c-22.6-14.6-51.7-12-95.5-36.1 c-27.9-15.4-12.1-24.9-2.8-29.4c158.6-76.7,183.8-195.3,185-204.2c1.4-10.6,2.9-19-8.8-29.9c-11.3-10.5-61.6-41.6-75.5-51.3 c-23.1-16.1-33.2-32.2-25.7-52c5.2-13.7,18-18.8,31.5-18.8c4.2,0,8.5,0.5,12.6,1.4c25.3,5.5,49.9,18.2,64.1,21.6 c2,0.5,3.7,0.7,5.2,0.7c7.6,0,10.2-3.8,9.7-12.5c-1.6-27.7-5.6-81.7-1.2-132.2c6-69.4,28.4-103.8,55-134.3 c12.8-14.6,72.8-78,187.5-78c115,0,174.7,63.4,187.5,78c26.6,30.4,49,64.8,55,134.3c4.4,50.5,0.6,104.5-1.2,132.2 c-0.6,9.1,2.2,12.5,9.7,12.5c1.5,0,3.3-0.2,5.2-0.7c14.2-3.4,38.8-16.1,64.1-21.6c4.1-0.9,8.4-1.4,12.6-1.4 c13.5,0,26.3,5.2,31.5,18.8c7.5,19.8-2.7,35.9-25.7,52c-13.9,9.7-64.2,40.8-75.5,51.3c-11.7,10.8-10.2,19.2-8.8,29.9 c1.1,8.9,26.4,127.5,185,204.2C960.6,759.1,976.5,768.6,948.6,784z" /> </svg>',
|
|
1207
1240
|
"google": '<svg viewBox="0 0 24 24"><path fill="#34a853" d="M4 22.93a4 4 0 1 1 0-8 4 4 0 0 1 0 8Z"/><path fill="#4285f4" d="M23.464 16.929 15.463 3.072A4 4 0 0 0 8.534 7.072l8.001 13.857a4 4 0 0 0 6.929-4Z"/><path fill="#fbbc04" d="M7.514 4.844 1.565 15.148A4.5 4.5 0 0 1 4 14.43a4.5 4.5 0 0 1 4.494 4.715l3.217-5.573-3.61-6.25a4 4 0 0 1-.587-2.478Z"/></svg>',
|
|
@@ -1214,7 +1247,8 @@ var PROVIDER_LOGOS = {
|
|
|
1214
1247
|
"pinterest": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" color="#fff" style="color:#fff" height="1em" width="1em"><path d="M12.017 0C5.396 0 .029 5.367.029 11.987c0 5.079 3.158 9.417 7.618 11.162-.105-.949-.199-2.403.041-3.439.219-.937 1.406-5.957 1.406-5.957s-.359-.72-.359-1.781c0-1.663.967-2.911 2.168-2.911 1.024 0 1.518.769 1.518 1.688 0 1.029-.653 2.567-.992 3.992-.285 1.193.6 2.165 1.775 2.165 2.128 0 3.768-2.245 3.768-5.487 0-2.861-2.063-4.869-5.008-4.869-3.41 0-5.409 2.562-5.409 5.199 0 1.033.394 2.143.889 2.741.099.12.112.225.085.345-.09.375-.293 1.199-.334 1.363-.053.225-.172.271-.401.165-1.495-.69-2.433-2.878-2.433-4.646 0-3.776 2.748-7.252 7.92-7.252 4.158 0 7.392 2.967 7.392 6.923 0 4.135-2.607 7.462-6.233 7.462-1.214 0-2.354-.629-2.758-1.379l-.749 2.848c-.269 1.045-1.004 2.352-1.498 3.146 1.123.345 2.306.535 3.55.535 6.607 0 11.985-5.365 11.985-11.987C23.97 5.39 18.592.026 11.985.026L12.017 0z"></path></svg>',
|
|
1215
1248
|
"spotify": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" color="#111" style="color:#111" height="1em" width="1em"><path d="M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z"></path></svg>',
|
|
1216
1249
|
"linkedin": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 448 512" color="#fff" style="color:#fff" height="1em" width="1em"><path d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"></path></svg>',
|
|
1217
|
-
"openai": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" color="#fff" style="color:#fff" height="1em" width="1em"><path d="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"></path></svg>'
|
|
1250
|
+
"openai": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" color="#fff" style="color:#fff" height="1em" width="1em"><path d="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"></path></svg>',
|
|
1251
|
+
"gravity": '<svg fill="currentColor" role="img" viewBox="0 0 375 375" color="#fff" style="color:#fff" height="1em" width="1em"><g transform="scale(2.388535)"><path fill-rule="evenodd" clip-rule="evenodd" d="M100.731 3.27415C80.8003 -2.71024 58.5524 -0.784462 39.1075 10.4421C19.6204 21.6929 6.81088 40.0638 2.07292 60.3466C4.29737 52.1778 22.1954 36.7108 46.2541 22.8204C70.2067 8.99138 92.4638 1.21865 100.731 3.27415Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M145.894 39.0384C138.466 26.1729 102.125 33.2483 64.7373 54.8342L64.749 54.8544C27.3392 76.4529 3.07499 104.4 10.4893 117.241C0.546464 100.02 -2.10672 80.6038 1.59446 62.5311C1.79184 62.8846 2.02276 63.2885 2.28846 63.7487C6.00144 70.1798 31.7103 62.2775 59.7036 46.1155C87.6969 29.9536 107.395 11.6402 103.682 5.20916C103.279 4.51127 102.6 3.97033 101.701 3.58828C119.684 9.22908 135.718 21.4124 145.894 39.0384Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M55.5301 152.937C75.4772 158.997 97.8108 157.076 117.278 145.837C136.701 134.623 149.514 116.306 154.285 96.0332C151.919 104.198 134.072 119.609 110.119 133.438C86.1668 147.267 63.6948 155.108 55.5301 152.937Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M145.894 39.0384C153.321 51.9022 129.044 79.8269 91.6362 101.424C54.2483 123.01 17.9062 130.084 10.4793 117.22C20.6673 134.866 36.6766 147.008 54.6725 152.67C53.7739 152.286 53.0962 151.746 52.6933 151.048C48.992 144.638 68.6783 126.304 96.6716 110.142C124.685 93.9685 150.385 86.0981 154.087 92.5089C154.49 93.2068 154.618 94.0634 154.502 95.034C158.606 76.5848 156.073 56.6608 145.898 39.0364L145.894 39.0384Z"/></g></svg>'
|
|
1218
1252
|
};
|
|
1219
1253
|
|
|
1220
1254
|
// src/operation-reconciliation-ui.ts
|
|
@@ -1752,10 +1786,9 @@ var META_INSIGHTS_UI = String.raw`
|
|
|
1752
1786
|
|
|
1753
1787
|
// src/native-report-ui.ts
|
|
1754
1788
|
var NATIVE_REPORT_TOOLS = [
|
|
1755
|
-
"ga4_report",
|
|
1756
|
-
"ga4_realtime_report",
|
|
1757
1789
|
"gsc_search_analytics",
|
|
1758
1790
|
"google_gaql",
|
|
1791
|
+
"gravity_conversion_stats",
|
|
1759
1792
|
"linkedin_demographic_report",
|
|
1760
1793
|
"meta_insights",
|
|
1761
1794
|
"tiktok_report",
|
|
@@ -1768,6 +1801,7 @@ var NATIVE_REPORT_TOOLS = [
|
|
|
1768
1801
|
"apple_impression_share",
|
|
1769
1802
|
"apple_search_term_popularity"
|
|
1770
1803
|
];
|
|
1804
|
+
var HISTORICAL_REPORT_TOOLS = ["ga4_report", "ga4_realtime_report", "matomo_report", "matomo_campaign_performance", "matomo_realtime_report"];
|
|
1771
1805
|
var NATIVE_REPORT_UI_STYLES = String.raw`
|
|
1772
1806
|
.native-report-metrics { grid-template-columns:repeat(auto-fit,minmax(min(110px,100%),1fr)) }
|
|
1773
1807
|
.meta-insights-table .workflow-table :is(th,td):not(:first-child) { text-align:right; white-space:nowrap }
|
|
@@ -1778,7 +1812,7 @@ var NATIVE_REPORT_UI_STYLES = String.raw`
|
|
|
1778
1812
|
.meta-insight-kpis .record-fields dd { margin:4px 0 0; font-size:20px; font-weight:600; font-variant-numeric:tabular-nums }
|
|
1779
1813
|
`;
|
|
1780
1814
|
var NATIVE_REPORT_UI_SCRIPT = String.raw`
|
|
1781
|
-
const nativeReportTools=new Set(${JSON.stringify(NATIVE_REPORT_TOOLS)});
|
|
1815
|
+
const nativeReportTools=new Set(${JSON.stringify([...NATIVE_REPORT_TOOLS, ...HISTORICAL_REPORT_TOOLS])});
|
|
1782
1816
|
${GAQL_REPORT_UI}
|
|
1783
1817
|
${META_INSIGHTS_UI}
|
|
1784
1818
|
function nativeReportDecimal(value,scale=0) {
|
|
@@ -1793,13 +1827,14 @@ var NATIVE_REPORT_UI_SCRIPT = String.raw`
|
|
|
1793
1827
|
const known={spend:'Spend',costMicros:'Spend',conversionsValue:'Conversion value',impressions:'Impressions',clicks:'Clicks',conversion:'Conversions',conversions:'Conversions',purchases:'Purchases',cpc:'CPC',cpm:'CPM',ctr:'CTR',roas:'ROAS',total_complete_payment_rate:'Purchase value',complete_payment_roas:'Purchase ROAS',lowImpressionShare:'Impression share · lower bound',highImpressionShare:'Impression share · upper bound',searchPopularity1to5:'Popularity · 1–5',searchPopularity1to100:'Popularity · 1–100',searchPopularityInGenre:'Genre popularity · 1–100',rankInGenre:'Genre rank',OverallSuccessRate:'Success rate · ratio',OverallSuccessCount:'Succeeded',SuccessCount:'Succeeded',FailureCount:'Failed',OverallUnattributedCount:'Unattributed'};
|
|
1794
1828
|
return known[key]||known[key.toLowerCase()]||human(human(key).toLowerCase());
|
|
1795
1829
|
}
|
|
1796
|
-
function nativeReportRatio(key,provider) {return (provider==='gsc'||provider==='google')&&key==='ctr'||provider==='ga4'&&!key.includes(':')&&/Rate$/.test(key);}
|
|
1797
|
-
function nativeReportMetric(key,value,provider,currency,moneyFields=[]) {
|
|
1830
|
+
function nativeReportRatio(key,provider,percentFields=[]) {return percentFields.includes(key)||(provider==='gsc'||provider==='google')&&key==='ctr'||provider==='ga4'&&!key.includes(':')&&/Rate$/.test(key);}
|
|
1831
|
+
function nativeReportMetric(key,value,provider,currency,moneyFields=[],percentFields=[],durationFields=[]) {
|
|
1798
1832
|
if(key==='costInUsd')currency='USD';
|
|
1799
1833
|
const lower=key.toLowerCase(),decimal=nativeReportDecimal(value);
|
|
1800
1834
|
if(value===null||value===undefined||value===''||value==='-'||value==='--')return '—';
|
|
1801
1835
|
if(provider==='spotify'&&decimal==='-5')return 'Suppressed';
|
|
1802
|
-
if(nativeReportRatio(key,provider)&&decimal!==null)return new Intl.NumberFormat(state.host.locale||'en',{style:'percent',maximumFractionDigits:2}).format(Number(decimal));
|
|
1836
|
+
if(nativeReportRatio(key,provider,percentFields)&&decimal!==null)return new Intl.NumberFormat(state.host.locale||'en',{style:'percent',maximumFractionDigits:2}).format(Number(decimal));
|
|
1837
|
+
if(durationFields.includes(key)&&decimal!==null)return nativeReportDuration(Number(decimal));
|
|
1803
1838
|
const moneyField=nativeReportMoneyField(key,provider,moneyFields);
|
|
1804
1839
|
if(moneyField) {
|
|
1805
1840
|
if(decimal===null)return '—';
|
|
@@ -1810,6 +1845,10 @@ var NATIVE_REPORT_UI_SCRIPT = String.raw`
|
|
|
1810
1845
|
}
|
|
1811
1846
|
return typeof value==='string'||typeof value==='number'||typeof value==='boolean'?String(value):'—';
|
|
1812
1847
|
}
|
|
1848
|
+
function nativeReportDuration(seconds) {
|
|
1849
|
+
const total=Math.round(Math.abs(seconds)),h=Math.floor(total/3600),m=Math.floor(total%3600/60),s=total%60;
|
|
1850
|
+
return (seconds<0?'-':'')+(h?h+'h '+m+'m '+s+'s':m?m+'m '+s+'s':s+'s');
|
|
1851
|
+
}
|
|
1813
1852
|
function nativeReportMoneyField(key,provider,moneyFields=[]) {
|
|
1814
1853
|
return moneyFields.includes(key)||/^(spend|revenue|cpc|cpm|cost_per_conversion|costInLocalCurrency|costInUsd|total_complete_payment_rate|conversion_.*_total_value)$|^(?:action_values|cost_per_action_type) · /i.test(key)||provider==='meta'&&/^(?:cpp$|cost_per_)/.test(key)||provider==='google'&&(/Micros$/.test(key)||/conversionsValue$/i.test(key));
|
|
1815
1854
|
}
|
|
@@ -1822,15 +1861,15 @@ var NATIVE_REPORT_UI_SCRIPT = String.raw`
|
|
|
1822
1861
|
}
|
|
1823
1862
|
function nativeReportRecord(row,index,meta,payload) {
|
|
1824
1863
|
if(!object(row))return null;
|
|
1825
|
-
const provider=meta.tool.split('_')[0],dimensions=object(row.dimensions)?row.dimensions:provider==='google'&&object(row.segments)?row.segments:{},metrics=['tiktok','google','linkedin','ga4','gsc'].includes(provider)&&object(row.metrics)?row.metrics:row;
|
|
1826
|
-
const names=provider==='microsoft'?['SearchQuery','Keyword','ConversionName','UploadDate']:provider==='apple'?['searchTerm','appName']:['ad_name','adgroup_name','adset_name','campaign_name','account_name','advertiser_name','name','entity_name'];
|
|
1864
|
+
const provider=meta.tool.split('_')[0],dimensions=object(row.dimensions)?row.dimensions:provider==='google'&&object(row.segments)?row.segments:{},metrics=['tiktok','google','linkedin','ga4','gsc','matomo'].includes(provider)&&object(row.metrics)?row.metrics:row;
|
|
1865
|
+
const names=provider==='gravity'?['date']:provider==='microsoft'?['SearchQuery','Keyword','ConversionName','UploadDate']:provider==='apple'?['searchTerm','appName']:['ad_name','adgroup_name','adset_name','campaign_name','account_name','advertiser_name','name','entity_name'];
|
|
1827
1866
|
const ids=['ad_id','adgroup_id','adset_id','campaign_id','advertiser_id','account_id','entity_id','id','GoalId','urn'];
|
|
1828
1867
|
const first=(keys,sources)=>keys.flatMap(key=>sources.map(source=>source[key])).find(value=>(typeof value==='string'&&value.trim())||typeof value==='number');
|
|
1829
1868
|
const googleDimensions=provider==='google'?gaqlDimensions(row):null;
|
|
1830
1869
|
const googleEntity=googleDimensions&&[...gaqlEntities.keys()].find(path=>googleDimensions.has(path));
|
|
1831
1870
|
const googleName=googleDimensions?.get(googleEntity);
|
|
1832
1871
|
const bucket=dimensions.conversionLagBucket??dimensions.conversionOrAdjustmentLagBucket;
|
|
1833
|
-
const analyticsName=['ga4','gsc'].includes(provider)?Object.
|
|
1872
|
+
const analyticsName=['ga4','gsc','matomo'].includes(provider)?Object.entries(dimensions).filter(([key])=>key!=='period_label').map(([,value])=>value).filter(value=>typeof value==='string'&&value).join(' · ')||first(['period_label'],[dimensions])||first(['name'],[payload.report||{}]):null;
|
|
1834
1873
|
const identity=bucket?reportBucket(bucket):googleName??analyticsName??first(names,[row,metrics,dimensions])??first(ids,[row,dimensions]);
|
|
1835
1874
|
const name=identity??(provider==='google'?'Report':provider==='meta'?'Reported metrics':'Result '+(index+1));
|
|
1836
1875
|
const status=first(['entity_status','status'],[row]);
|
|
@@ -1850,19 +1889,21 @@ var NATIVE_REPORT_UI_SCRIPT = String.raw`
|
|
|
1850
1889
|
if(provider==='linkedin'&&row.date_range?.start&&row.date_range?.end){const period=row.date_range.start+' – '+row.date_range.end;context.push(period);fields.push(['period',period]);}
|
|
1851
1890
|
const priority=key=>/^(spend|impressions|clicks)$/i.test(key)?['spend','impressions','clicks'].indexOf(key.toLowerCase()):/^(conversion|conversions|purchases)$|^actions · purchase$/i.test(key)?3:4;
|
|
1852
1891
|
fields.sort((a,b)=>priority(a[0])-priority(b[0]));
|
|
1853
|
-
const
|
|
1854
|
-
|
|
1892
|
+
const matomoTypes=provider==='matomo'&&object(payload.metric_types)?payload.metric_types:{},typed=type=>Object.keys(matomoTypes).filter(key=>matomoTypes[key]===type);
|
|
1893
|
+
const moneyFields=provider==='ga4'?arr(payload.metric_headers).filter(header=>header.type==='TYPE_CURRENCY').map(header=>header.name):typed('money');
|
|
1894
|
+
const percentFields=typed('percent'),durationFields=typed('duration_s');
|
|
1895
|
+
return {name,identity,status,context,currency,moneyFields,percentFields,durationFields,provider,fields,gaqlDimensions:googleDimensions,gaqlEntity:googleEntity,native:row,date:reportDate(dimensions.stat_time_day??(provider==='ga4'&&/^\d{8}$/.test(dimensions.date||'')?dimensions.date.replace(/^(\d{4})(\d{2})(\d{2})$/,'$1-$2-$3'):dimensions.date)??(row.date_start===row.date_stop?row.date_start:null)??(row.date_range?.start===row.date_range?.end?row.date_range?.start:null)),series:googleName||(['ga4','gsc','matomo'].includes(provider)?Object.entries(dimensions).filter(([key])=>key!=='date'&&key!=='period_label').map(([,value])=>value).join(' · ')||'Website':name)};
|
|
1855
1896
|
}
|
|
1856
1897
|
function nativeChartRecord(record) {
|
|
1857
1898
|
if(!record)return {name:'Unavailable row',context:[],fields:[]};
|
|
1858
1899
|
const fields=record.fields.map(([key,raw])=>{
|
|
1859
1900
|
const monetary=nativeReportMoneyField(key,record.provider,record.moneyFields),scaled=nativeReportDecimal(raw,nativeReportScale(key,record.provider));
|
|
1860
|
-
const ratio=nativeReportRatio(key,record.provider);
|
|
1901
|
+
const ratio=nativeReportRatio(key,record.provider,record.percentFields);
|
|
1861
1902
|
const value=record.provider==='spotify'&&String(raw)==='-5'?null:reportNumber(monetary?scaled:raw);
|
|
1862
|
-
const display=nativeReportMetric(key,raw,record.provider,record.currency,record.moneyFields);
|
|
1903
|
+
const display=nativeReportMetric(key,raw,record.provider,record.currency,record.moneyFields,record.percentFields,record.durationFields);
|
|
1863
1904
|
const shortMoney=monetary&&['google','meta'].includes(record.provider);
|
|
1864
1905
|
const shortDisplay=shortMoney&&scaled!==null?reportAmount(scaled,record.currency):undefined;
|
|
1865
|
-
return {key,label:key==='costInLocalCurrency'?'Spend':key==='costInUsd'?'Spend · USD':nativeReportLabel(key),value:ratio&&value!==null?value*100:value,display,shortDisplay,unit:ratio?'%':monetary?key==='costInUsd'?'USD':record.currency||(record.provider==='meta'?'':shortMoney?'Currency unavailable':'Account units'):''};
|
|
1906
|
+
return {key,label:key==='costInLocalCurrency'?'Spend':key==='costInUsd'?'Spend · USD':nativeReportLabel(key),value:ratio&&value!==null?value*100:value,display,shortDisplay,unit:ratio?'%':record.durationFields?.includes(key)?'s':monetary?key==='costInUsd'?'USD':record.currency||(record.provider==='meta'?'':shortMoney?'Currency unavailable':'Account units'):''};
|
|
1866
1907
|
});
|
|
1867
1908
|
const low=record.native.lowImpressionShare,high=record.native.highImpressionShare;
|
|
1868
1909
|
const range=record.provider==='apple'&&[low,high].every(value=>typeof value==='number'&&Number.isFinite(value)&&value>=0&&value<=1)&&low<=high?[low,high]:undefined;
|
|
@@ -1872,21 +1913,21 @@ var NATIVE_REPORT_UI_SCRIPT = String.raw`
|
|
|
1872
1913
|
function nativeReportRow(row,index,meta,payload) {
|
|
1873
1914
|
const record=nativeReportRecord(row,index,meta,payload);
|
|
1874
1915
|
if(!record)return '<article class="record-row"><p class="operation-note">Report row unavailable.</p></article>';
|
|
1875
|
-
const {name,status,context,currency,provider,fields,moneyFields}=record;
|
|
1916
|
+
const {name,status,context,currency,provider,fields,moneyFields,percentFields,durationFields}=record;
|
|
1876
1917
|
const shown=fields.slice(0,4),details=fields.length>4?'<p class="apple-report-dimensions">'+(fields.length-4)+' more metric'+(fields.length===5?'':'s')+' in Details</p>':'';
|
|
1877
|
-
return '<article class="record-row"><div class="record-heading"><div class="record-name"><strong>'+esc(name)+'</strong></div>'+(status?'<span>'+esc(status)+'</span>':'')+'</div>'+(context.length?'<p class="apple-report-dimensions">'+context.map(esc).join(' · ')+'</p>':'')+(shown.length?'<dl class="record-fields apple-report-metrics native-report-metrics">'+shown.map(([key,value])=>'<div><dt>'+esc(nativeReportLabel(key))+'</dt><dd>'+esc(nativeReportMetric(key,value,provider,currency,moneyFields))+'</dd></div>').join('')+'</dl>':'<p class="operation-note">No metrics returned for this row.</p>')+details+'</article>';
|
|
1918
|
+
return '<article class="record-row"><div class="record-heading"><div class="record-name"><strong>'+esc(name)+'</strong></div>'+(status?'<span>'+esc(status)+'</span>':'')+'</div>'+(context.length?'<p class="apple-report-dimensions">'+context.map(esc).join(' · ')+'</p>':'')+(shown.length?'<dl class="record-fields apple-report-metrics native-report-metrics">'+shown.map(([key,value])=>'<div><dt>'+esc(nativeReportLabel(key))+'</dt><dd>'+esc(nativeReportMetric(key,value,provider,currency,moneyFields,percentFields,durationFields))+'</dd></div>').join('')+'</dl>':'<p class="operation-note">No metrics returned for this row.</p>')+details+'</article>';
|
|
1878
1919
|
}
|
|
1879
1920
|
function renderNativeReport(data,meta) {
|
|
1880
|
-
const payload=meta.tool==='linkedin_demographic_report'?data:recordPayload(data),rows=meta.tool==='reddit_report'?payload?.metrics:payload?.rows;
|
|
1921
|
+
const payload=meta.tool==='linkedin_demographic_report'?data:recordPayload(data),rows=meta.tool==='reddit_report'?payload?.metrics:meta.tool==='gravity_conversion_stats'?payload?.time_series:payload?.rows;
|
|
1881
1922
|
const entries=Array.isArray(rows)?rows:[],provider=meta.tool.split('_')[0];
|
|
1882
|
-
const title=meta.tool.includes('offline_conversion')?'Upload diagnostics':meta.tool==='apple_impression_share'?'Impression share':meta.tool==='apple_search_term_popularity'?'Search popularity':provider==='ga4'?'Website analytics':provider==='gsc'?'Organic search':'Performance';
|
|
1923
|
+
const title=meta.tool==='gravity_conversion_stats'?'Conversions by day':meta.tool.includes('offline_conversion')?'Upload diagnostics':meta.tool==='apple_impression_share'?'Impression share':meta.tool==='apple_search_term_popularity'?'Search popularity':provider==='ga4'?'Website analytics':provider==='gsc'?'Organic search':provider==='matomo'?'Matomo analytics':'Performance';
|
|
1883
1924
|
const missing=Array.isArray(rows)?'No report rows returned.':'Report rows unavailable. The response is in Details.';
|
|
1884
1925
|
const clean={...data};delete clean._adport;
|
|
1885
1926
|
const errors=arr(data.errors).filter(error=>error?.error_code).map(error=>'<p class="notice">Goal '+esc(error.goal_id||'unavailable')+': '+esc(error.error_code)+'</p>').join('');
|
|
1886
1927
|
const missingGoals=arr(data.not_returned_goal_ids).filter(id=>!arr(data.errors).some(error=>error?.goal_id===id&&error?.error_code));
|
|
1887
1928
|
const absent=missingGoals.length?'<p class="notice">No summary returned for goal'+(missingGoals.length===1?'':'s')+' '+missingGoals.map(esc).join(', ')+'.</p>':'';
|
|
1888
1929
|
const records=(provider==='meta'?entries:entries.slice(0,1000)).map((row,index)=>nativeReportRecord(row,index,meta,payload)),delay=provider==='google'&&entries.some(row=>row?.segments?.conversionLagBucket||row?.segments?.conversionOrAdjustmentLagBucket);
|
|
1889
|
-
const pageArgs=['ga4_report','gsc_search_analytics'].includes(meta.tool)?readPageArgs(meta,'data-report-next'):null;
|
|
1930
|
+
const pageArgs=['ga4_report','gsc_search_analytics','matomo_report','matomo_campaign_performance'].includes(meta.tool)?readPageArgs(meta,'data-report-next'):null;
|
|
1890
1931
|
const points=records.map(nativeChartRecord);
|
|
1891
1932
|
let presentation;
|
|
1892
1933
|
if(entries.length && provider==='meta') presentation=metaInsightsReport(records,points,payload);
|
|
@@ -1898,7 +1939,7 @@ var NATIVE_REPORT_UI_SCRIPT = String.raw`
|
|
|
1898
1939
|
const entity=records[0]?.gaqlEntity;
|
|
1899
1940
|
const dimension=entity&&records.every(row=>row?.gaqlEntity===entity)?gaqlEntities.get(entity).toLowerCase():undefined;
|
|
1900
1941
|
const chart=entries.length&&!presentation?reportCharts(points,delay?{dimension:'delay',mode:'bars',metric:records.some(record=>record?.fields.some(([key])=>key==='conversions'))?'conversions':undefined}:meta.tool==='apple_impression_share'?{metric:'Impression share',dimension:'search term'}:{dimension}):null;
|
|
1901
|
-
const analytics=['ga4','gsc'].includes(provider),range=payload?.date_range;
|
|
1942
|
+
const analytics=['ga4','gsc','matomo'].includes(provider),range=payload?.date_range;
|
|
1902
1943
|
const period=analytics&&object(range)?[range.start_date??range.start,range.end_date??range.end].filter(workflowText).join(' – '):'';
|
|
1903
1944
|
const subject=presentation?.subject||(analytics?[meta.accountId,period].filter(Boolean).join(' · '):'');
|
|
1904
1945
|
const view=presentation||chart;
|
|
@@ -2541,8 +2582,9 @@ var REPORT_CHART_SCRIPT = String.raw`
|
|
|
2541
2582
|
`;
|
|
2542
2583
|
|
|
2543
2584
|
// src/ui.ts
|
|
2544
|
-
var
|
|
2545
|
-
var
|
|
2585
|
+
var ADPORT_UI_VERSION = 42;
|
|
2586
|
+
var ADPORT_UI_URI = `ui://adport/insight-card-v${ADPORT_UI_VERSION}.html`;
|
|
2587
|
+
var ADPORT_SUMMARY_UI_URI = `ui://adport/summary-card-v${ADPORT_UI_VERSION}.html`;
|
|
2546
2588
|
var ADPORT_UI_DOMAIN = "https://app.adport.dev";
|
|
2547
2589
|
var ADPORT_UI_RESOURCE_DOMAINS = [
|
|
2548
2590
|
ADPORT_UI_DOMAIN,
|
|
@@ -2567,6 +2609,7 @@ var ADPORT_UI_RESOURCE_DOMAINS = [
|
|
|
2567
2609
|
var providerNames = {
|
|
2568
2610
|
ga4: "Google Analytics 4",
|
|
2569
2611
|
gsc: "Google Search Console",
|
|
2612
|
+
matomo: "Matomo",
|
|
2570
2613
|
gtm: "Google Tag Manager",
|
|
2571
2614
|
google: "Google Ads",
|
|
2572
2615
|
meta: "Meta Ads",
|
|
@@ -2580,6 +2623,7 @@ var providerNames = {
|
|
|
2580
2623
|
linkedin: "LinkedIn Ads",
|
|
2581
2624
|
x: "X Ads",
|
|
2582
2625
|
openai: "OpenAI Ads",
|
|
2626
|
+
gravity: "Gravity",
|
|
2583
2627
|
mock: "Demo",
|
|
2584
2628
|
demo: "Synthetic demo"
|
|
2585
2629
|
};
|
|
@@ -2700,7 +2744,7 @@ var ADPORT_UI_HTML = String.raw`<!doctype html>
|
|
|
2700
2744
|
.identity { display:flex; align-items:center; gap:10px; min-width:0 }
|
|
2701
2745
|
.logo { display:grid; place-items:center; flex:0 0 auto; width:29px; height:29px; padding:6px; border:1px solid var(--line); border-radius:9px; color:var(--ink); background:var(--paper); font-weight:800; font-size:10px }
|
|
2702
2746
|
.logo svg { display:block; width:100%; height:100% }
|
|
2703
|
-
.logo.reddit { background:#ff4500 }.logo.linkedin { background:#0a66c2 }.logo.spotify { background:#1db954 }.logo.pinterest { background:#e60023 }.logo.x { background:#111 }.logo.openai { background:#000 }.logo.snapchat { background:#fffc00;color:#111 }
|
|
2747
|
+
.logo.reddit { background:#ff4500 }.logo.linkedin { background:#0a66c2 }.logo.spotify { background:#1db954 }.logo.pinterest { background:#e60023 }.logo.x { background:#111 }.logo.openai { background:#000 }.logo.gravity { background:#111 }.logo.snapchat { background:#fffc00;color:#111 }
|
|
2704
2748
|
.identity-copy { min-width:0 }
|
|
2705
2749
|
.identity-copy b, .identity-copy span { display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis }
|
|
2706
2750
|
.identity-copy b { font-size:12px }.identity-copy span { margin-top:3px; color:var(--muted); font-size:10px }
|
|
@@ -2816,7 +2860,7 @@ ${TREND_UI_STYLES}
|
|
|
2816
2860
|
const noticeText=(value,fallback)=>typeof value==='string'?value:typeof value?.message==='string'?value.message:typeof value?.reason==='string'?value.reason:fallback;
|
|
2817
2861
|
const notices = data => [...arr(data.errors).map(error=>(error?.provider || 'Provider')+': '+noticeText(error,'Read failed')), ...arr(data.warnings).map(warning=>noticeText(warning,'Some metadata is unavailable')), ...arr(data.notes).filter(note=>typeof note==='string'), ...(typeof data.note==='string'?[data.note]:[]), ...(data.truncated ? ['Partial result: row limit reached. Totals and charts cover returned rows only.'] : [])].map(text => '<p class="notice">'+esc(text)+'</p>').join('');
|
|
2818
2862
|
const providerName = (id, names) => names?.[id] || String(id || 'Provider');
|
|
2819
|
-
const initials = (id) => ({snapchat:'S',spotify:'S',pinterest:'P',linkedin:'in',x:'X',openai:'AI'}[id] || String(id || '?').slice(0,2).toUpperCase());
|
|
2863
|
+
const initials = (id) => ({snapchat:'S',spotify:'S',pinterest:'P',linkedin:'in',x:'X',openai:'AI',gravity:'G'}[id] || String(id || '?').slice(0,2).toUpperCase());
|
|
2820
2864
|
const providerSvg = ${JSON.stringify(PROVIDER_LOGOS)};
|
|
2821
2865
|
const logo = (id) => '<span class="logo '+esc(id)+'" aria-hidden="true">'+(providerSvg[id] || esc(initials(id)))+'</span>';
|
|
2822
2866
|
let syntheticResult = false;
|
|
@@ -2875,6 +2919,7 @@ ${RECORD_UI_SCRIPT}
|
|
|
2875
2919
|
${READ_PAGE_UI}
|
|
2876
2920
|
${APPLE_REPORT_UI_SCRIPT}
|
|
2877
2921
|
${NATIVE_REPORT_UI_SCRIPT}
|
|
2922
|
+
${ACQUISITION_UI}
|
|
2878
2923
|
${REPORT_CHART_SCRIPT}
|
|
2879
2924
|
${INSIGHT_UI_SCRIPT}
|
|
2880
2925
|
${TREND_UI_SCRIPT}
|
|
@@ -2969,6 +3014,7 @@ ${PLANNING_UI}
|
|
|
2969
3014
|
if (meta.view === 'accounts') return renderAccounts(data,meta);
|
|
2970
3015
|
if (meta.view === 'report') return renderReport(data,meta);
|
|
2971
3016
|
if (meta.view === 'operation') {renderOperation(data,meta);providerGalleryReviewControls(data,meta);return;}
|
|
3017
|
+
if (meta.tool === 'analytics_goals' || meta.tool === 'analytics_acquisition_report') return renderAcquisition(data,meta);
|
|
2972
3018
|
if (meta.tool === 'capabilities_list') return renderAvailability(data,meta);
|
|
2973
3019
|
if (meta.tool === 'apple_change_history') return renderHistory(data,meta);
|
|
2974
3020
|
if (meta.tool === 'apple_recommendations') return renderAppleRecommendations(data,meta);
|
|
@@ -3074,8 +3120,12 @@ ${PLANNING_UI}
|
|
|
3074
3120
|
</html>`;
|
|
3075
3121
|
|
|
3076
3122
|
// src/index.ts
|
|
3077
|
-
var PROVIDER_IDS =
|
|
3078
|
-
var
|
|
3123
|
+
var PROVIDER_IDS = TOOL_PROVIDERS;
|
|
3124
|
+
var uiVersions = Array.from({ length: ADPORT_UI_VERSION - 1 }, (_, i) => ADPORT_UI_VERSION - i);
|
|
3125
|
+
var ADPORT_UI_RESOURCE_URIS = [
|
|
3126
|
+
...uiVersions.map((v) => `ui://adport/insight-card-v${v}.html`),
|
|
3127
|
+
...uiVersions.filter((v) => v === 30 || v >= 32).map((v) => `ui://adport/summary-card-v${v}.html`)
|
|
3128
|
+
];
|
|
3079
3129
|
var DEFAULT_MCP_ICONS = [{
|
|
3080
3130
|
src: "https://app.adport.dev/icon.svg?brand=orange-dot-v2",
|
|
3081
3131
|
mimeType: "image/svg+xml",
|
|
@@ -3086,7 +3136,7 @@ async function assembleRuntime(options = {}) {
|
|
|
3086
3136
|
const modules = [];
|
|
3087
3137
|
const includeMock = options.includeMock ?? process.env.ADPORT_DEMO === "true";
|
|
3088
3138
|
if (!includeMock) {
|
|
3089
|
-
for (const factory of [createGa4Module, createGscModule, createGtmModule, createGoogleModule, createMetaModule, createTikTokModule, createAppleModule, createMicrosoftModule, createRedditModule, createSnapchatModule, createSpotifyModule, createPinterestModule, createLinkedInModule, createXModule, createOpenAIModule]) {
|
|
3139
|
+
for (const factory of [createGa4Module, createGscModule, createGtmModule, createGoogleModule, createMetaModule, createTikTokModule, createAppleModule, createMicrosoftModule, createRedditModule, createSnapchatModule, createSpotifyModule, createPinterestModule, createLinkedInModule, createXModule, createOpenAIModule, createMatomoModule, createGravityModule]) {
|
|
3090
3140
|
const module = await factory(store);
|
|
3091
3141
|
if (module) modules.push(module);
|
|
3092
3142
|
}
|
|
@@ -3126,7 +3176,7 @@ var hostedWriteOutput = z.looseObject({
|
|
|
3126
3176
|
applied: writeOutput.shape.applied,
|
|
3127
3177
|
preview: z.looseObject(writeOutput.shape.preview.pick({ summary: true, serverValidated: true }).shape),
|
|
3128
3178
|
pending_operation_id: z.string().optional(),
|
|
3129
|
-
expires_at:
|
|
3179
|
+
expires_at: z.string().optional(),
|
|
3130
3180
|
result: z.looseObject({}).optional()
|
|
3131
3181
|
});
|
|
3132
3182
|
var explicitHostedTitle = /* @__PURE__ */ new Set([
|
|
@@ -3194,8 +3244,9 @@ Unavailable on the current plan: ${scopeDenial.message}` : definition.descriptio
|
|
|
3194
3244
|
}
|
|
3195
3245
|
};
|
|
3196
3246
|
const callback = async (args) => {
|
|
3247
|
+
const platform = tool.namespace === "analytics" ? args.provider : tool.namespace;
|
|
3197
3248
|
const descriptor = {
|
|
3198
|
-
...PROVIDER_IDS.includes(
|
|
3249
|
+
...typeof platform === "string" && PROVIDER_IDS.includes(platform) ? { provider: platform } : {},
|
|
3199
3250
|
...typeof args.account_id === "string" ? { accountId: args.account_id } : {},
|
|
3200
3251
|
...tool.pagination ? { pagination: { cursorInput: tool.pagination.cursorInput } } : {}
|
|
3201
3252
|
};
|
|
@@ -3294,4 +3345,4 @@ export {
|
|
|
3294
3345
|
createMcpServer,
|
|
3295
3346
|
runStdioServer
|
|
3296
3347
|
};
|
|
3297
|
-
//# sourceMappingURL=chunk-
|
|
3348
|
+
//# sourceMappingURL=chunk-U5SWUPMQ.js.map
|