@vibiz/sdk 0.3.19 → 0.3.21
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/client.d.ts +63 -1
- package/dist/index.js +51 -1
- package/dist/one-key.d.ts +1 -1
- package/dist/types.d.ts +205 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionInfo, ActionResult, ActionRun, ActionRunList, ActionRunsQuery, ActionUsage, AdminMetrics, AiJob, AiKeyProvider, AiModelInfo, AiProviderKey, AiProviderKeyInput, AiProviderKeyList, AiSettings, AnalyticsPeriod, AnalyticsReport, ApiKey, AppKeyInfo, AppStoreAccount, AppStoreConnectLink, AppStoreSetup, AppStoreSetupInput, AppStoreState, AuthEnvironment, AuthProviderId, AuthProviderInput, AuthSettings, AuthSettingsPatch, Automation, AutomationEnrollment, AutomationInput, AutomationTrigger, Billing, BillingCharge, BillingCheckout, BillingEntry, BillingEntryKind, BillingList, BillingUpdate, Broadcast, BroadcastInput, BroadcastRecipient, BroadcastReview, BroadcastStatus, ChatChunk, ChatCompletion, ChatRequest, Checkout, CheckoutBrandPatch, CheckoutInput, Company, CompanyAddressFields, CompanyCatalog, CompanyDraft, CompanyEnvironment, CompanyLink, Connector, ConnectorApproval, ConnectorCall, ConnectorCallInput, ConnectorCheck, ConnectorEnvironment, ConnectorImport, ConnectorInput, ConnectorPatch, ConnectorResponse, ContactPropertyValue, ContactStatus, DashboardLink, DeployFile, Deployment, DeploymentFiles, DesignSectionRead, DesignSpec, DevEnvironment, DnsRecord, DnsRecordInput, DnsRecordList, Domain, DomainBuyInput, DomainList, DomainOwnerContact, DomainOwnerDetails, DomainQuote, DomainSearch, DomainUse, DomainUseInput, EmailContact, EmailContactInput, EmailContactList, EmailContactPatch, EmailForwarding, EmailForwardingLog, EmailForwardingRule, EmailImportInput, EmailImportReport, EmailList, EmailMarketing, EmailMarketingPatch, EmailPage, EmailPreview, EmailSegment, EmailTestResult, EnvTargetInfo, EnvVarInfo, ExportInput, FileEnvironment, FileList, FileListOptions, FileUploadOptions, HealthList, HealthRun, HealthStatus, HostKind, ImageRequest, ImageResult, InboxSettings, KeyAccess, KeyPermission, KeyPresetChoice, LedgerEntry, Mailbox, MailboxInput, MailDomain, MailFolder, MailReplyInput, MailSendInput, MailThreadDetail, MailThreadList, MailView, MediaModelInfo, MetricsReport, MissionControl, MissionControlLayout, Operation, OwnAccountLink, OwnedDomain, OwnedDomainList, OwnerStripe, OwnerStripeApply, OwnerStripeDisconnect, OwnerStripeLink, Payment, PaymentPrice, PaymentPriceInput, PaymentProduct, PaymentSubscription, PaymentsAccount, PaymentsEnvironment, PaymentsList, PaymentsSimulation, PhoneAnsweringInput, PhoneCall, PhoneCallInput, PhoneCallList, PhoneMessage, PhoneMessageList, PhoneNumber, PhoneNumberList, PhoneQuote, PhoneRegistrationInput, PhoneRegistrationRequirements, PhoneSearch, PhoneSendInput, PhoneThreadList, Profile, ProfileBusiness, ProfileBusinessesUpdate, ProfileBusinessUpdate, ProfileUpdate, Project, ProjectExport, ProjectHealth, ProjectSearch, ReplayDetail, ReplayFrames, ReplayFramesOptions, ReplayInsights, ReplayListOptions, ReplayPeriod, ReplayStatus, ReplaySummary, Resource, ResourceType, SearchConnectionList, SearchPageList, SecretLink, SegmentFilter, SendEmailInput, SendEmailOutput, SocialAccount, SocialAccountAnalytics, SocialAdCampaign, SocialAdChange, SocialAdChangeInput, SocialCampaignCreateInput, SocialConnectLink, SocialEnvironment, SocialMedia, SocialOverview, SocialPost, SocialPostAnalytics, SocialPostInput, SpeechRequest, Transcription, UsageOptions, UsagePeriod, UsageReport, UsernameCheck, VersionDiff, VersionList, VersionRestore, VibizFile, WebDesignInput, WebhookDelivery, WebhookEventType, Withdrawal } from './types.js';
|
|
1
|
+
import type { ActionInfo, ActionResult, ActionRun, ActionRunList, ActionRunsQuery, ActionUsage, AdminMetrics, AiJob, AiKeyProvider, AiModelInfo, AiProviderKey, AiProviderKeyInput, AiProviderKeyList, AiSettings, AnalyticsPeriod, AnalyticsReport, ApiKey, AppKeyInfo, AppStoreAccount, AppStoreConnectLink, AppStoreSetup, AppStoreSetupInput, AppStoreState, AuthEnvironment, AuthProviderId, AuthProviderInput, AuthSettings, AuthSettingsPatch, Automation, AutomationEnrollment, AutomationInput, AutomationTrigger, Billing, BillingCharge, BillingCheckout, BillingEntry, BillingEntryKind, BillingList, BillingUpdate, Broadcast, BroadcastInput, BroadcastRecipient, BroadcastReview, BroadcastStatus, ChatChunk, ChatCompletion, ChatRequest, Checkout, CheckoutBrandPatch, CheckoutInput, Company, CompanyAddressFields, CompanyCatalog, CompanyDraft, CompanyEnvironment, CompanyLink, Connector, ConnectorApproval, ConnectorCall, ConnectorCallInput, ConnectorCheck, ConnectorEnvironment, ConnectorImport, ConnectorInput, ConnectorPatch, ConnectorResponse, ContactPropertyValue, ContactStatus, Dashboard, DashboardCatalogue, DashboardData, DashboardDataQuery, DashboardLink, DashboardRange, DashboardWidget, DashboardWidgetInput, DashboardWidgetResult, DeployFile, Deployment, DeploymentFiles, DesignSectionRead, DesignSpec, DevEnvironment, DnsRecord, DnsRecordInput, DnsRecordList, Domain, DomainBuyInput, DomainList, DomainOwnerContact, DomainOwnerDetails, DomainQuote, DomainSearch, DomainUse, DomainUseInput, EmailContact, EmailContactInput, EmailContactList, EmailContactPatch, EmailForwarding, EmailForwardingLog, EmailForwardingRule, EmailImportInput, EmailImportReport, EmailList, EmailMarketing, EmailMarketingPatch, EmailPage, EmailPreview, EmailSegment, EmailTestResult, EnvTargetInfo, EnvVarInfo, ExportInput, FileEnvironment, FileList, FileListOptions, FileUploadOptions, HealthList, HealthRun, HealthStatus, HostKind, ImageRequest, ImageResult, InboxSettings, KeyAccess, KeyPermission, KeyPresetChoice, LedgerEntry, Mailbox, MailboxInput, MailDomain, MailFolder, MailReplyInput, MailSendInput, MailThreadDetail, MailThreadList, MailView, MediaModelInfo, MetricsReport, MissionControl, MissionControlLayout, Operation, OwnAccountLink, OwnedDomain, OwnedDomainList, OwnerStripe, OwnerStripeApply, OwnerStripeDisconnect, OwnerStripeLink, Payment, PaymentPrice, PaymentPriceInput, PaymentProduct, PaymentSubscription, PaymentsAccount, PaymentsEnvironment, PaymentsList, PaymentsSimulation, PhoneAnsweringInput, PhoneCall, PhoneCallInput, PhoneCallList, PhoneMessage, PhoneMessageList, PhoneNumber, PhoneNumberList, PhoneQuote, PhoneRegistrationInput, PhoneRegistrationRequirements, PhoneSearch, PhoneSendInput, PhoneThreadList, Profile, ProfileBusiness, ProfileBusinessesUpdate, ProfileBusinessUpdate, ProfileUpdate, Project, ProjectExport, ProjectHealth, ProjectSearch, ReplayDetail, ReplayFrames, ReplayFramesOptions, ReplayInsights, ReplayListOptions, ReplayPeriod, ReplayStatus, ReplaySummary, Resource, ResourceType, SearchConnectionList, SearchPageList, SecretLink, SegmentFilter, SendEmailInput, SendEmailOutput, SocialAccount, SocialAccountAnalytics, SocialAdCampaign, SocialAdChange, SocialAdChangeInput, SocialCampaignCreateInput, SocialConnectLink, SocialEnvironment, SocialMedia, SocialOverview, SocialPost, SocialPostAnalytics, SocialPostInput, SpeechRequest, Transcription, UsageOptions, UsagePeriod, UsageReport, UsernameCheck, VersionDiff, VersionList, VersionRestore, VibizFile, WebDesignInput, WebhookDelivery, WebhookEventType, Withdrawal } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* An error status with no Vibiz error body: a proxy, a load balancer or the
|
|
4
4
|
* network answered instead of the API. Say so, and what to do.
|
|
@@ -1506,6 +1506,68 @@ export declare class Vibiz {
|
|
|
1506
1506
|
permissions: () => Promise<KeyPermission[]>;
|
|
1507
1507
|
revoke: (id: string) => Promise<ApiKey>;
|
|
1508
1508
|
};
|
|
1509
|
+
/**
|
|
1510
|
+
* Dashboards (docs: dashboards): a project's or the account's grid of widgets
|
|
1511
|
+
* over the metric catalogue (payments, analytics, replay, sign-in, AI, email,
|
|
1512
|
+
* hosting…). Pick metrics from `metrics()`, never SQL; `create({ template })`
|
|
1513
|
+
* makes a whole dashboard in one call. Each answer has `console_url`.
|
|
1514
|
+
*/
|
|
1515
|
+
readonly dashboards: {
|
|
1516
|
+
/** The catalogue: metrics (with breakdowns, filters, unit, permission), widget types, templates. */
|
|
1517
|
+
metrics: () => Promise<DashboardCatalogue>;
|
|
1518
|
+
list: (opts?: {
|
|
1519
|
+
project_id?: string;
|
|
1520
|
+
level?: "project" | "account";
|
|
1521
|
+
}) => Promise<{
|
|
1522
|
+
object: "list";
|
|
1523
|
+
data: Dashboard[];
|
|
1524
|
+
console_url: string;
|
|
1525
|
+
}>;
|
|
1526
|
+
/** With `project_id` a project's; without, the account's (`project_ids`: some businesses). */
|
|
1527
|
+
create: (body: {
|
|
1528
|
+
name?: string;
|
|
1529
|
+
description?: string | null;
|
|
1530
|
+
project_id?: string | null;
|
|
1531
|
+
project_ids?: string[];
|
|
1532
|
+
template?: string;
|
|
1533
|
+
range?: DashboardRange;
|
|
1534
|
+
widgets?: DashboardWidgetInput[];
|
|
1535
|
+
}) => Promise<Dashboard>;
|
|
1536
|
+
get: (id: string) => Promise<Dashboard>;
|
|
1537
|
+
/** `widgets` replaces the whole list (move and resize by sending layouts). */
|
|
1538
|
+
update: (id: string, body: {
|
|
1539
|
+
name?: string;
|
|
1540
|
+
description?: string | null;
|
|
1541
|
+
range?: DashboardRange;
|
|
1542
|
+
project_ids?: string[];
|
|
1543
|
+
widgets?: DashboardWidgetInput[];
|
|
1544
|
+
}) => Promise<Dashboard>;
|
|
1545
|
+
delete: (id: string) => Promise<{
|
|
1546
|
+
object: "dashboard";
|
|
1547
|
+
id: string;
|
|
1548
|
+
deleted: true;
|
|
1549
|
+
}>;
|
|
1550
|
+
addWidget: (id: string, widget: DashboardWidgetInput) => Promise<Dashboard & {
|
|
1551
|
+
widget: DashboardWidget;
|
|
1552
|
+
}>;
|
|
1553
|
+
updateWidget: (id: string, widgetId: string, patch: Partial<DashboardWidgetInput>) => Promise<Dashboard & {
|
|
1554
|
+
widget: DashboardWidget;
|
|
1555
|
+
}>;
|
|
1556
|
+
removeWidget: (id: string, widgetId: string) => Promise<Dashboard>;
|
|
1557
|
+
/** Every widget's data (or one's): each has `data` or its own `error`. */
|
|
1558
|
+
data: (id: string, opts?: DashboardDataQuery) => Promise<DashboardData>;
|
|
1559
|
+
/** An unsaved widget's data: try a metric before adding it. */
|
|
1560
|
+
query: (body: {
|
|
1561
|
+
widget: DashboardWidgetInput;
|
|
1562
|
+
project_id?: string | null;
|
|
1563
|
+
project_ids?: string[];
|
|
1564
|
+
range?: DashboardRange;
|
|
1565
|
+
from?: string;
|
|
1566
|
+
to?: string;
|
|
1567
|
+
}) => Promise<DashboardWidgetResult & {
|
|
1568
|
+
object: "dashboard_widget_data";
|
|
1569
|
+
}>;
|
|
1570
|
+
};
|
|
1509
1571
|
/** A short-lived link to the hosted usage dashboard (admin scope needs an admin key). */
|
|
1510
1572
|
readonly dashboard: {
|
|
1511
1573
|
link: (opts?: {
|
package/dist/index.js
CHANGED
|
@@ -1620,6 +1620,56 @@ var Vibiz = class {
|
|
|
1620
1620
|
permissions: () => this.request("/api-keys/permissions").then((r) => r.data),
|
|
1621
1621
|
revoke: (id) => this.request(`/api-keys/${id}`, { method: "DELETE" })
|
|
1622
1622
|
};
|
|
1623
|
+
/**
|
|
1624
|
+
* Dashboards (docs: dashboards): a project's or the account's grid of widgets
|
|
1625
|
+
* over the metric catalogue (payments, analytics, replay, sign-in, AI, email,
|
|
1626
|
+
* hosting…). Pick metrics from `metrics()`, never SQL; `create({ template })`
|
|
1627
|
+
* makes a whole dashboard in one call. Each answer has `console_url`.
|
|
1628
|
+
*/
|
|
1629
|
+
dashboards = {
|
|
1630
|
+
/** The catalogue: metrics (with breakdowns, filters, unit, permission), widget types, templates. */
|
|
1631
|
+
metrics: () => this.request("/dashboards/metrics"),
|
|
1632
|
+
list: (opts = {}) => this.request(
|
|
1633
|
+
`/dashboards${qs(opts)}`
|
|
1634
|
+
),
|
|
1635
|
+
/** With `project_id` a project's; without, the account's (`project_ids`: some businesses). */
|
|
1636
|
+
create: (body) => this.request("/dashboards", { method: "POST", body }),
|
|
1637
|
+
get: (id) => this.request(`/dashboards/${encodeURIComponent(id)}`),
|
|
1638
|
+
/** `widgets` replaces the whole list (move and resize by sending layouts). */
|
|
1639
|
+
update: (id, body) => this.request(`/dashboards/${encodeURIComponent(id)}`, { method: "PATCH", body }),
|
|
1640
|
+
delete: (id) => this.request(
|
|
1641
|
+
`/dashboards/${encodeURIComponent(id)}`,
|
|
1642
|
+
{ method: "DELETE" }
|
|
1643
|
+
),
|
|
1644
|
+
addWidget: (id, widget) => this.request(
|
|
1645
|
+
`/dashboards/${encodeURIComponent(id)}/widgets`,
|
|
1646
|
+
{ method: "POST", body: widget }
|
|
1647
|
+
),
|
|
1648
|
+
updateWidget: (id, widgetId, patch) => this.request(
|
|
1649
|
+
`/dashboards/${encodeURIComponent(id)}/widgets/${encodeURIComponent(widgetId)}`,
|
|
1650
|
+
{ method: "PATCH", body: patch }
|
|
1651
|
+
),
|
|
1652
|
+
removeWidget: (id, widgetId) => this.request(
|
|
1653
|
+
`/dashboards/${encodeURIComponent(id)}/widgets/${encodeURIComponent(widgetId)}`,
|
|
1654
|
+
{ method: "DELETE" }
|
|
1655
|
+
),
|
|
1656
|
+
/** Every widget's data (or one's): each has `data` or its own `error`. */
|
|
1657
|
+
data: (id, opts = {}) => this.request(
|
|
1658
|
+
`/dashboards/${encodeURIComponent(id)}/data${qs({
|
|
1659
|
+
range: opts.range,
|
|
1660
|
+
from: opts.from,
|
|
1661
|
+
to: opts.to,
|
|
1662
|
+
project_ids: opts.project_ids?.join(","),
|
|
1663
|
+
widget: opts.widget,
|
|
1664
|
+
refresh: opts.refresh ? "1" : void 0
|
|
1665
|
+
})}`
|
|
1666
|
+
),
|
|
1667
|
+
/** An unsaved widget's data: try a metric before adding it. */
|
|
1668
|
+
query: (body) => this.request(
|
|
1669
|
+
"/dashboards/query",
|
|
1670
|
+
{ method: "POST", body }
|
|
1671
|
+
)
|
|
1672
|
+
};
|
|
1623
1673
|
/** A short-lived link to the hosted usage dashboard (admin scope needs an admin key). */
|
|
1624
1674
|
dashboard = {
|
|
1625
1675
|
link: (opts = {}) => this.request("/dashboard/link", { method: "POST", body: opts })
|
|
@@ -2028,7 +2078,7 @@ function formatMinor(minor, currency) {
|
|
|
2028
2078
|
}
|
|
2029
2079
|
|
|
2030
2080
|
// packages/sdk/src/one-key.ts
|
|
2031
|
-
var APP_SDK_VERSION = "0.3.
|
|
2081
|
+
var APP_SDK_VERSION = "0.3.21";
|
|
2032
2082
|
var ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social, phone and connectors";
|
|
2033
2083
|
function oneKeyMessage(url, host) {
|
|
2034
2084
|
const where = host ?? "your host";
|
package/dist/one-key.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* (`npm install --save-exact @vibiz/app@<this>`). A test keeps it, the skills
|
|
11
11
|
* and the docs equal to packages/app/package.json.
|
|
12
12
|
*/
|
|
13
|
-
export declare const APP_SDK_VERSION = "0.3.
|
|
13
|
+
export declare const APP_SDK_VERSION = "0.3.21";
|
|
14
14
|
/** Everything one app key reaches. */
|
|
15
15
|
export declare const ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social, phone and connectors";
|
|
16
16
|
/**
|
package/dist/types.d.ts
CHANGED
|
@@ -4629,4 +4629,209 @@ export interface UsernameCheck {
|
|
|
4629
4629
|
available: boolean;
|
|
4630
4630
|
reason: string | null;
|
|
4631
4631
|
}
|
|
4632
|
+
export type DashboardLevel = 'project' | 'account';
|
|
4633
|
+
export type DashboardRange = '24h' | '7d' | '30d' | '90d' | '12m';
|
|
4634
|
+
export type DashboardWidgetType = 'stat' | 'line' | 'area' | 'bar' | 'table' | 'list' | 'funnel' | 'cohort' | 'text';
|
|
4635
|
+
export type DashboardMetricUnit = 'count' | 'usd_cents' | 'usd_micro' | 'percent' | 'ms';
|
|
4636
|
+
export type DashboardShape = 'scalar' | 'timeseries' | 'table' | 'funnel' | 'cohort';
|
|
4637
|
+
export interface DashboardWidgetOptions {
|
|
4638
|
+
range?: DashboardRange;
|
|
4639
|
+
bucket?: 'hour' | 'day' | 'week' | 'month';
|
|
4640
|
+
/** `project` (account level), `source`, `country`, `model`… as the metric lists. */
|
|
4641
|
+
breakdown?: string;
|
|
4642
|
+
/** Equality filters the metric lists (`{ country: 'US' }`, `{ environment: 'development' }`). */
|
|
4643
|
+
filters?: Record<string, string>;
|
|
4644
|
+
limit?: number;
|
|
4645
|
+
format?: 'number' | 'compact' | 'money' | 'percent';
|
|
4646
|
+
compare?: boolean;
|
|
4647
|
+
/** Funnel steps in order: a page (`/pricing`) or an event name (`Signup`). */
|
|
4648
|
+
steps?: string[];
|
|
4649
|
+
}
|
|
4650
|
+
export interface DashboardWidgetInput {
|
|
4651
|
+
id?: string;
|
|
4652
|
+
type: DashboardWidgetType;
|
|
4653
|
+
title?: string | null;
|
|
4654
|
+
/** A metric id from `dashboards.metrics()`; none for a text widget. */
|
|
4655
|
+
metric?: string | null;
|
|
4656
|
+
/** Markdown, for a text widget. */
|
|
4657
|
+
text?: string | null;
|
|
4658
|
+
options?: DashboardWidgetOptions;
|
|
4659
|
+
/** On the 12-column grid; the first free spot when left out. */
|
|
4660
|
+
layout?: {
|
|
4661
|
+
x: number;
|
|
4662
|
+
y: number;
|
|
4663
|
+
w: number;
|
|
4664
|
+
h: number;
|
|
4665
|
+
};
|
|
4666
|
+
}
|
|
4667
|
+
export interface DashboardWidget {
|
|
4668
|
+
id: string;
|
|
4669
|
+
type: DashboardWidgetType;
|
|
4670
|
+
title: string | null;
|
|
4671
|
+
metric: string | null;
|
|
4672
|
+
text: string | null;
|
|
4673
|
+
options: DashboardWidgetOptions;
|
|
4674
|
+
layout: {
|
|
4675
|
+
x: number;
|
|
4676
|
+
y: number;
|
|
4677
|
+
w: number;
|
|
4678
|
+
h: number;
|
|
4679
|
+
};
|
|
4680
|
+
}
|
|
4681
|
+
export interface Dashboard {
|
|
4682
|
+
object: 'dashboard';
|
|
4683
|
+
id: string;
|
|
4684
|
+
name: string;
|
|
4685
|
+
description: string | null;
|
|
4686
|
+
level: DashboardLevel;
|
|
4687
|
+
/** The project it belongs to; null at the account level. */
|
|
4688
|
+
project_id: string | null;
|
|
4689
|
+
/** Account level: the businesses it reads (empty: every one). */
|
|
4690
|
+
project_ids: string[];
|
|
4691
|
+
template: string | null;
|
|
4692
|
+
range: DashboardRange;
|
|
4693
|
+
widgets: DashboardWidget[];
|
|
4694
|
+
created_at: string;
|
|
4695
|
+
updated_at: string;
|
|
4696
|
+
console_url: string;
|
|
4697
|
+
}
|
|
4698
|
+
export interface DashboardMetric {
|
|
4699
|
+
id: string;
|
|
4700
|
+
label: string;
|
|
4701
|
+
description: string;
|
|
4702
|
+
product: string;
|
|
4703
|
+
product_label: string;
|
|
4704
|
+
levels: DashboardLevel[];
|
|
4705
|
+
shapes: DashboardShape[];
|
|
4706
|
+
unit: DashboardMetricUnit;
|
|
4707
|
+
breakdowns: {
|
|
4708
|
+
id: string;
|
|
4709
|
+
label: string;
|
|
4710
|
+
}[];
|
|
4711
|
+
filters: string[];
|
|
4712
|
+
/** What a Limited key needs to read it (null: any key). */
|
|
4713
|
+
permission: string | null;
|
|
4714
|
+
permission_label: string | null;
|
|
4715
|
+
without_permission?: 'refused' | 'masked';
|
|
4716
|
+
lower_is_better?: boolean;
|
|
4717
|
+
default_breakdown?: string;
|
|
4718
|
+
widget_types: DashboardWidgetType[];
|
|
4719
|
+
}
|
|
4720
|
+
export interface DashboardCatalogue {
|
|
4721
|
+
object: 'dashboard_catalogue';
|
|
4722
|
+
metrics: DashboardMetric[];
|
|
4723
|
+
widget_types: {
|
|
4724
|
+
id: DashboardWidgetType;
|
|
4725
|
+
label: string;
|
|
4726
|
+
description: string;
|
|
4727
|
+
shapes: DashboardShape[];
|
|
4728
|
+
size: {
|
|
4729
|
+
w: number;
|
|
4730
|
+
h: number;
|
|
4731
|
+
};
|
|
4732
|
+
}[];
|
|
4733
|
+
ranges: DashboardRange[];
|
|
4734
|
+
buckets: string[];
|
|
4735
|
+
templates: {
|
|
4736
|
+
id: string;
|
|
4737
|
+
name: string;
|
|
4738
|
+
description: string;
|
|
4739
|
+
level: DashboardLevel;
|
|
4740
|
+
range: DashboardRange;
|
|
4741
|
+
widgets: number;
|
|
4742
|
+
}[];
|
|
4743
|
+
}
|
|
4744
|
+
export type DashboardWidgetData = {
|
|
4745
|
+
shape: 'scalar';
|
|
4746
|
+
unit: DashboardMetricUnit;
|
|
4747
|
+
value: number | null;
|
|
4748
|
+
previous: number | null;
|
|
4749
|
+
change_pct: number | null;
|
|
4750
|
+
} | {
|
|
4751
|
+
shape: 'timeseries';
|
|
4752
|
+
unit: DashboardMetricUnit;
|
|
4753
|
+
bucket: 'hour' | 'day' | 'week' | 'month';
|
|
4754
|
+
keys: string[];
|
|
4755
|
+
series: {
|
|
4756
|
+
key: string;
|
|
4757
|
+
label: string;
|
|
4758
|
+
values: number[];
|
|
4759
|
+
total: number;
|
|
4760
|
+
}[];
|
|
4761
|
+
} | {
|
|
4762
|
+
shape: 'table';
|
|
4763
|
+
unit: DashboardMetricUnit;
|
|
4764
|
+
columns: {
|
|
4765
|
+
key: string;
|
|
4766
|
+
label: string;
|
|
4767
|
+
unit?: string;
|
|
4768
|
+
}[];
|
|
4769
|
+
rows: Record<string, unknown>[];
|
|
4770
|
+
} | {
|
|
4771
|
+
shape: 'funnel';
|
|
4772
|
+
unit: 'count';
|
|
4773
|
+
steps: {
|
|
4774
|
+
step: string;
|
|
4775
|
+
label: string;
|
|
4776
|
+
visitors: number;
|
|
4777
|
+
rate_from_start: number | null;
|
|
4778
|
+
rate_from_previous: number | null;
|
|
4779
|
+
}[];
|
|
4780
|
+
} | {
|
|
4781
|
+
shape: 'cohort';
|
|
4782
|
+
unit: 'percent';
|
|
4783
|
+
periods: number;
|
|
4784
|
+
cohorts: {
|
|
4785
|
+
key: string;
|
|
4786
|
+
label: string;
|
|
4787
|
+
size: number;
|
|
4788
|
+
values: (number | null)[];
|
|
4789
|
+
}[];
|
|
4790
|
+
};
|
|
4791
|
+
export interface DashboardWidgetResult {
|
|
4792
|
+
widget_id: string;
|
|
4793
|
+
/** The widget's title, else its metric's label. */
|
|
4794
|
+
title: string;
|
|
4795
|
+
metric: string | null;
|
|
4796
|
+
shape: DashboardShape | null;
|
|
4797
|
+
range: {
|
|
4798
|
+
name: string;
|
|
4799
|
+
from: string;
|
|
4800
|
+
to: string;
|
|
4801
|
+
bucket: string;
|
|
4802
|
+
};
|
|
4803
|
+
data: DashboardWidgetData | null;
|
|
4804
|
+
/** This widget's own failure: what, why and how to fix it (`details.next_step`, `grant_url`). */
|
|
4805
|
+
error: {
|
|
4806
|
+
code: string;
|
|
4807
|
+
message: string;
|
|
4808
|
+
details?: Record<string, unknown>;
|
|
4809
|
+
} | null;
|
|
4810
|
+
}
|
|
4811
|
+
export interface DashboardData {
|
|
4812
|
+
object: 'dashboard_data';
|
|
4813
|
+
dashboard_id: string;
|
|
4814
|
+
level: DashboardLevel;
|
|
4815
|
+
range: string;
|
|
4816
|
+
from: string | null;
|
|
4817
|
+
to: string | null;
|
|
4818
|
+
projects: {
|
|
4819
|
+
id: string;
|
|
4820
|
+
name: string;
|
|
4821
|
+
slug: string;
|
|
4822
|
+
}[];
|
|
4823
|
+
widgets: DashboardWidgetResult[];
|
|
4824
|
+
computed_at: string;
|
|
4825
|
+
console_url: string;
|
|
4826
|
+
}
|
|
4827
|
+
export interface DashboardDataQuery {
|
|
4828
|
+
range?: DashboardRange;
|
|
4829
|
+
/** A custom range: UTC days, `YYYY-MM-DD`, both included. */
|
|
4830
|
+
from?: string;
|
|
4831
|
+
to?: string;
|
|
4832
|
+
/** Account level: these businesses instead of the dashboard's own. */
|
|
4833
|
+
project_ids?: string[];
|
|
4834
|
+
widget?: string;
|
|
4835
|
+
refresh?: boolean;
|
|
4836
|
+
}
|
|
4632
4837
|
export {};
|