@vibiz/sdk 0.3.23 → 0.3.25
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 +107 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +86 -4
- package/dist/one-key.d.ts +1 -1
- package/dist/types.d.ts +234 -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, 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, MarketplaceList, MarketplaceOffer, MarketplaceQuery, 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, ProjectSale, 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, SocialMessage, SocialOverview, SocialPost, SocialPostAnalytics, SocialPostInput, SocialReplyInput, SocialThread, SocialThreadDetail, SocialThreadKind, SpeechRequest, Transcription, UsageOptions, UsagePeriod, UsageReport, UsernameCheck, VerifyEmailOutput, 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, LibraryDeleted, LibraryEntry, LibraryExport, LibraryImport, LibraryList, Mailbox, MailboxInput, MailDomain, MailFolder, MailReplyInput, MailSendInput, MailThreadDetail, MailThreadList, MailView, MarketplaceList, MarketplaceOffer, MarketplaceQuery, 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, ProjectSale, 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, SocialMessage, SocialOverview, SocialPost, SocialPostAnalytics, SocialPostInput, SocialReplyInput, SocialThread, SocialThreadDetail, SocialThreadKind, SpeechRequest, Transcription, UsageOptions, UsagePeriod, UsageReport, UsernameCheck, VerifyEmailOutput, VersionDiff, VersionList, VersionRestore, VibizFile, VisitorJourneyDetail, VisitorJourneyList, VisitorJourneyQuery, 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.
|
|
@@ -31,6 +31,13 @@ export interface VibizOptions {
|
|
|
31
31
|
user?: string;
|
|
32
32
|
/** Who is calling, sent as `X-Vibiz-Client` (the CLI: `vibiz-cli/<version>`), so the API can ask an old one to update. */
|
|
33
33
|
client?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Extra headers on every call, or a function read on each call. The CLI and
|
|
36
|
+
* the MCP server send `X-Vibiz-Session` (one id per run) and `X-Vibiz-Tool`
|
|
37
|
+
* (the command or tool), so a failing step can be found without any content.
|
|
38
|
+
* They never replace the key or the body's headers.
|
|
39
|
+
*/
|
|
40
|
+
headers?: Record<string, string> | (() => Record<string, string> | undefined);
|
|
34
41
|
}
|
|
35
42
|
/**
|
|
36
43
|
* The typed client for the Vibiz Stack API. Used by the CLI, by Principia's
|
|
@@ -726,6 +733,16 @@ export declare class Vibiz {
|
|
|
726
733
|
get: (projectId: string, opts?: {
|
|
727
734
|
period?: AnalyticsPeriod;
|
|
728
735
|
}) => Promise<AnalyticsReport>;
|
|
736
|
+
/**
|
|
737
|
+
* Visitor journeys, newest first: each visitor-day's source, landing page,
|
|
738
|
+
* pages in order, events, and whether it converted (a sale or a goal event).
|
|
739
|
+
*/
|
|
740
|
+
visitors: (projectId: string, opts?: VisitorJourneyQuery) => Promise<VisitorJourneyList>;
|
|
741
|
+
/** One visitor's path on one UTC day: the timeline, its replays and the sales it led to. */
|
|
742
|
+
visitor: (projectId: string, visitorId: string, opts?: {
|
|
743
|
+
day?: string;
|
|
744
|
+
goals?: string[];
|
|
745
|
+
}) => Promise<VisitorJourneyDetail>;
|
|
729
746
|
};
|
|
730
747
|
/**
|
|
731
748
|
* Mission Control (docs: Mission Control and health checks): every business
|
|
@@ -1670,6 +1687,67 @@ export declare class Vibiz {
|
|
|
1670
1687
|
object: "dashboard_widget_data";
|
|
1671
1688
|
}>;
|
|
1672
1689
|
};
|
|
1690
|
+
/**
|
|
1691
|
+
* The Library (docs: library): the account's (no `project_id`) or a
|
|
1692
|
+
* project's folders and text files (scripts, agent skills, notes). Stored
|
|
1693
|
+
* only: nothing in it runs or is public. Writing a file makes its folders.
|
|
1694
|
+
*/
|
|
1695
|
+
readonly library: {
|
|
1696
|
+
/** One folder's entries (`recursive`: everything below it), with sizes, no text. */
|
|
1697
|
+
list: (opts?: {
|
|
1698
|
+
project_id?: string | null;
|
|
1699
|
+
path?: string;
|
|
1700
|
+
recursive?: boolean;
|
|
1701
|
+
}) => Promise<LibraryList>;
|
|
1702
|
+
/** One file, with its `content`. */
|
|
1703
|
+
read: (path: string, opts?: {
|
|
1704
|
+
project_id?: string | null;
|
|
1705
|
+
}) => Promise<LibraryEntry>;
|
|
1706
|
+
/** Creates or overwrites a file (`create_only`: refuse an existing one). */
|
|
1707
|
+
write: (body: {
|
|
1708
|
+
path: string;
|
|
1709
|
+
content: string;
|
|
1710
|
+
project_id?: string | null;
|
|
1711
|
+
create_only?: boolean;
|
|
1712
|
+
}) => Promise<LibraryEntry & {
|
|
1713
|
+
created: boolean;
|
|
1714
|
+
}>;
|
|
1715
|
+
/** Makes a folder and the ones above it; an existing folder is fine. */
|
|
1716
|
+
mkdir: (path: string, opts?: {
|
|
1717
|
+
project_id?: string | null;
|
|
1718
|
+
}) => Promise<LibraryEntry & {
|
|
1719
|
+
created: boolean;
|
|
1720
|
+
}>;
|
|
1721
|
+
/** Moves or renames (a folder takes what is in it); `overwrite` replaces what is at `to`. */
|
|
1722
|
+
move: (body: {
|
|
1723
|
+
from: string;
|
|
1724
|
+
to: string;
|
|
1725
|
+
project_id?: string | null;
|
|
1726
|
+
overwrite?: boolean;
|
|
1727
|
+
}) => Promise<LibraryEntry & {
|
|
1728
|
+
moved: number;
|
|
1729
|
+
}>;
|
|
1730
|
+
/** Deletes a file or folder; a folder that isn't empty needs `recursive`. */
|
|
1731
|
+
delete: (path: string, opts?: {
|
|
1732
|
+
project_id?: string | null;
|
|
1733
|
+
recursive?: boolean;
|
|
1734
|
+
}) => Promise<LibraryDeleted>;
|
|
1735
|
+
/** Many files into one folder at once (a skill's folder); replaces existing files unless `overwrite: false`. */
|
|
1736
|
+
import: (body: {
|
|
1737
|
+
path?: string;
|
|
1738
|
+
files: {
|
|
1739
|
+
path: string;
|
|
1740
|
+
content: string;
|
|
1741
|
+
}[];
|
|
1742
|
+
folders?: string[];
|
|
1743
|
+
project_id?: string | null;
|
|
1744
|
+
overwrite?: boolean;
|
|
1745
|
+
}) => Promise<LibraryImport>;
|
|
1746
|
+
/** A folder (or one file) back as files, paths relative to it. */
|
|
1747
|
+
export: (path?: string, opts?: {
|
|
1748
|
+
project_id?: string | null;
|
|
1749
|
+
}) => Promise<LibraryExport>;
|
|
1750
|
+
};
|
|
1673
1751
|
/** A short-lived link to the hosted usage dashboard (admin scope needs an admin key). */
|
|
1674
1752
|
readonly dashboard: {
|
|
1675
1753
|
link: (opts?: {
|
|
@@ -1708,6 +1786,12 @@ export declare class Vibiz {
|
|
|
1708
1786
|
note: string;
|
|
1709
1787
|
};
|
|
1710
1788
|
}>;
|
|
1789
|
+
/**
|
|
1790
|
+
* Tell the thelastapi team something: a capability that's missing, an error
|
|
1791
|
+
* that didn't say how to fix it, docs that were wrong. The team reads every
|
|
1792
|
+
* report. `user_quote` only with the person's agreement.
|
|
1793
|
+
*/
|
|
1794
|
+
feedback(input: FeedbackInput): Promise<FeedbackReceipt>;
|
|
1711
1795
|
/** The account and key this client acts as. */
|
|
1712
1796
|
whoami(): Promise<WhoAmI>;
|
|
1713
1797
|
/** Revoke the key this client uses (`vibiz logout` for a key made by a browser login). */
|
|
@@ -1717,6 +1801,28 @@ export declare class Vibiz {
|
|
|
1717
1801
|
revoked: true;
|
|
1718
1802
|
}>;
|
|
1719
1803
|
}
|
|
1804
|
+
export declare const FEEDBACK_KINDS: readonly ["bug", "missing", "confusing_error", "docs", "other"];
|
|
1805
|
+
export type FeedbackKind = (typeof FEEDBACK_KINDS)[number];
|
|
1806
|
+
export interface FeedbackInput {
|
|
1807
|
+
kind: FeedbackKind;
|
|
1808
|
+
/** One or two sentences: what was needed or what went wrong. */
|
|
1809
|
+
summary: string;
|
|
1810
|
+
tried?: string;
|
|
1811
|
+
happened?: string;
|
|
1812
|
+
expected?: string;
|
|
1813
|
+
/** The tool or command involved (`vibiz_deploy`, `env set`). */
|
|
1814
|
+
tool?: string;
|
|
1815
|
+
error_code?: string;
|
|
1816
|
+
project_id?: string;
|
|
1817
|
+
/** The person's own words: only when they agreed to share them. */
|
|
1818
|
+
user_quote?: string;
|
|
1819
|
+
}
|
|
1820
|
+
export interface FeedbackReceipt {
|
|
1821
|
+
object: 'feedback';
|
|
1822
|
+
id: string;
|
|
1823
|
+
received: true;
|
|
1824
|
+
message: string;
|
|
1825
|
+
}
|
|
1720
1826
|
export interface WhoAmI {
|
|
1721
1827
|
object: 'whoami';
|
|
1722
1828
|
account: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { endUserHeader, Vibiz, VibizApiError, type VibizOptions, type WhoAmI } from './client.js';
|
|
1
|
+
export { endUserHeader, FEEDBACK_KINDS, type FeedbackInput, type FeedbackKind, type FeedbackReceipt, Vibiz, VibizApiError, type VibizOptions, type WhoAmI, } from './client.js';
|
|
2
2
|
export { assertDeployableRoot, collectFiles, type DeployBase, type DeployFilesResult, deployDirectory, deployFiles, deployPathProblem, INLINE_LIMITS, type InlineFile, type LocalFile, normalizeDeployPath, } from './deploy.js';
|
|
3
3
|
export { mergeEnvFile, writeEnvFile } from './env.js';
|
|
4
4
|
export { formatMinor, formatUnits, formatUsd } from './format.js';
|
package/dist/index.js
CHANGED
|
@@ -50,13 +50,17 @@ var Vibiz = class {
|
|
|
50
50
|
baseUrl;
|
|
51
51
|
fetchImpl;
|
|
52
52
|
async send(path, init = {}) {
|
|
53
|
-
const
|
|
53
|
+
const extra = this.options.headers;
|
|
54
|
+
const headers = {
|
|
55
|
+
...typeof extra === "function" ? extra() : extra,
|
|
56
|
+
authorization: `Bearer ${this.options.apiKey}`
|
|
57
|
+
};
|
|
54
58
|
if (init.body !== void 0) headers["content-type"] = "application/json";
|
|
55
59
|
if (init.raw) headers["content-type"] = init.contentType ?? "application/octet-stream";
|
|
56
60
|
if (init.idempotencyKey) headers["idempotency-key"] = init.idempotencyKey;
|
|
57
61
|
if (init.project) headers["x-vibiz-project"] = init.project;
|
|
58
62
|
if (this.options.user) headers["x-vibiz-user"] = endUserHeader(this.options.user);
|
|
59
|
-
|
|
63
|
+
headers["x-vibiz-client"] = this.options.client ?? "vibiz-sdk";
|
|
60
64
|
return this.fetchImpl(`${this.baseUrl}/v1${path}`, {
|
|
61
65
|
method: init.method ?? "GET",
|
|
62
66
|
headers,
|
|
@@ -851,7 +855,33 @@ var Vibiz = class {
|
|
|
851
855
|
/** Visitors, pageviews, top pages, sources, countries, events and a timeseries. */
|
|
852
856
|
get: (projectId, opts = {}) => this.request(
|
|
853
857
|
`/projects/${projectId}/analytics?period=${opts.period ?? "7d"}`
|
|
854
|
-
)
|
|
858
|
+
),
|
|
859
|
+
/**
|
|
860
|
+
* Visitor journeys, newest first: each visitor-day's source, landing page,
|
|
861
|
+
* pages in order, events, and whether it converted (a sale or a goal event).
|
|
862
|
+
*/
|
|
863
|
+
visitors: (projectId, opts = {}) => {
|
|
864
|
+
const q = new URLSearchParams();
|
|
865
|
+
q.set("period", opts.period ?? "7d");
|
|
866
|
+
if (opts.source) q.set("source", opts.source);
|
|
867
|
+
if (opts.landing) q.set("landing", opts.landing);
|
|
868
|
+
if (opts.country) q.set("country", opts.country);
|
|
869
|
+
if (opts.converted) q.set("converted", "true");
|
|
870
|
+
if (opts.goals?.length) q.set("goals", opts.goals.join(","));
|
|
871
|
+
if (opts.limit) q.set("limit", String(opts.limit));
|
|
872
|
+
if (opts.cursor) q.set("cursor", opts.cursor);
|
|
873
|
+
return this.request(`/projects/${projectId}/analytics/visitors?${q}`);
|
|
874
|
+
},
|
|
875
|
+
/** One visitor's path on one UTC day: the timeline, its replays and the sales it led to. */
|
|
876
|
+
visitor: (projectId, visitorId, opts = {}) => {
|
|
877
|
+
const q = new URLSearchParams();
|
|
878
|
+
if (opts.day) q.set("day", opts.day);
|
|
879
|
+
if (opts.goals?.length) q.set("goals", opts.goals.join(","));
|
|
880
|
+
const qs2 = q.size ? `?${q}` : "";
|
|
881
|
+
return this.request(
|
|
882
|
+
`/projects/${projectId}/analytics/visitors/${encodeURIComponent(visitorId)}${qs2}`
|
|
883
|
+
);
|
|
884
|
+
}
|
|
855
885
|
};
|
|
856
886
|
/**
|
|
857
887
|
* Mission Control (docs: Mission Control and health checks): every business
|
|
@@ -1764,6 +1794,48 @@ var Vibiz = class {
|
|
|
1764
1794
|
{ method: "POST", body }
|
|
1765
1795
|
)
|
|
1766
1796
|
};
|
|
1797
|
+
/**
|
|
1798
|
+
* The Library (docs: library): the account's (no `project_id`) or a
|
|
1799
|
+
* project's folders and text files (scripts, agent skills, notes). Stored
|
|
1800
|
+
* only: nothing in it runs or is public. Writing a file makes its folders.
|
|
1801
|
+
*/
|
|
1802
|
+
library = {
|
|
1803
|
+
/** One folder's entries (`recursive`: everything below it), with sizes, no text. */
|
|
1804
|
+
list: (opts = {}) => this.request(
|
|
1805
|
+
`/library${qs({
|
|
1806
|
+
project_id: opts.project_id,
|
|
1807
|
+
path: opts.path,
|
|
1808
|
+
recursive: opts.recursive ? "1" : void 0
|
|
1809
|
+
})}`
|
|
1810
|
+
),
|
|
1811
|
+
/** One file, with its `content`. */
|
|
1812
|
+
read: (path, opts = {}) => this.request(`/library/file${qs({ project_id: opts.project_id, path })}`),
|
|
1813
|
+
/** Creates or overwrites a file (`create_only`: refuse an existing one). */
|
|
1814
|
+
write: (body) => this.request("/library/file", {
|
|
1815
|
+
method: "PUT",
|
|
1816
|
+
body
|
|
1817
|
+
}),
|
|
1818
|
+
/** Makes a folder and the ones above it; an existing folder is fine. */
|
|
1819
|
+
mkdir: (path, opts = {}) => this.request("/library/folders", {
|
|
1820
|
+
method: "POST",
|
|
1821
|
+
body: { path, ...opts.project_id ? { project_id: opts.project_id } : {} }
|
|
1822
|
+
}),
|
|
1823
|
+
/** Moves or renames (a folder takes what is in it); `overwrite` replaces what is at `to`. */
|
|
1824
|
+
move: (body) => this.request("/library/move", { method: "POST", body }),
|
|
1825
|
+
/** Deletes a file or folder; a folder that isn't empty needs `recursive`. */
|
|
1826
|
+
delete: (path, opts = {}) => this.request(
|
|
1827
|
+
`/library${qs({
|
|
1828
|
+
project_id: opts.project_id,
|
|
1829
|
+
path,
|
|
1830
|
+
recursive: opts.recursive ? "1" : void 0
|
|
1831
|
+
})}`,
|
|
1832
|
+
{ method: "DELETE" }
|
|
1833
|
+
),
|
|
1834
|
+
/** Many files into one folder at once (a skill's folder); replaces existing files unless `overwrite: false`. */
|
|
1835
|
+
import: (body) => this.request("/library/import", { method: "POST", body }),
|
|
1836
|
+
/** A folder (or one file) back as files, paths relative to it. */
|
|
1837
|
+
export: (path = "", opts = {}) => this.request(`/library/export${qs({ project_id: opts.project_id, path })}`)
|
|
1838
|
+
};
|
|
1767
1839
|
/** A short-lived link to the hosted usage dashboard (admin scope needs an admin key). */
|
|
1768
1840
|
dashboard = {
|
|
1769
1841
|
link: (opts = {}) => this.request("/dashboard/link", { method: "POST", body: opts })
|
|
@@ -1785,6 +1857,14 @@ var Vibiz = class {
|
|
|
1785
1857
|
capabilities() {
|
|
1786
1858
|
return this.request("/capabilities");
|
|
1787
1859
|
}
|
|
1860
|
+
/**
|
|
1861
|
+
* Tell the thelastapi team something: a capability that's missing, an error
|
|
1862
|
+
* that didn't say how to fix it, docs that were wrong. The team reads every
|
|
1863
|
+
* report. `user_quote` only with the person's agreement.
|
|
1864
|
+
*/
|
|
1865
|
+
feedback(input) {
|
|
1866
|
+
return this.request("/feedback", { method: "POST", body: input });
|
|
1867
|
+
}
|
|
1788
1868
|
/** The account and key this client acts as. */
|
|
1789
1869
|
whoami() {
|
|
1790
1870
|
return this.request("/whoami");
|
|
@@ -1796,6 +1876,7 @@ var Vibiz = class {
|
|
|
1796
1876
|
});
|
|
1797
1877
|
}
|
|
1798
1878
|
};
|
|
1879
|
+
var FEEDBACK_KINDS = ["bug", "missing", "confusing_error", "docs", "other"];
|
|
1799
1880
|
var mkt = (projectId) => `/projects/${encodeURIComponent(projectId)}/email`;
|
|
1800
1881
|
var envQuery = (env) => env ? `?env=${env}` : "";
|
|
1801
1882
|
var qs = (q) => {
|
|
@@ -2172,7 +2253,7 @@ function formatMinor(minor, currency) {
|
|
|
2172
2253
|
}
|
|
2173
2254
|
|
|
2174
2255
|
// packages/sdk/src/one-key.ts
|
|
2175
|
-
var APP_SDK_VERSION = "0.3.
|
|
2256
|
+
var APP_SDK_VERSION = "0.3.25";
|
|
2176
2257
|
var ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social, phone and connectors";
|
|
2177
2258
|
function oneKeyMessage(url, host) {
|
|
2178
2259
|
const where = host ?? "your host";
|
|
@@ -2183,6 +2264,7 @@ function connectHostMessage(kind, host) {
|
|
|
2183
2264
|
}
|
|
2184
2265
|
export {
|
|
2185
2266
|
APP_SDK_VERSION,
|
|
2267
|
+
FEEDBACK_KINDS,
|
|
2186
2268
|
INLINE_LIMITS,
|
|
2187
2269
|
ONE_KEY_GIVES,
|
|
2188
2270
|
Vibiz,
|
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.25";
|
|
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
|
@@ -1105,6 +1105,147 @@ export interface AnalyticsReport {
|
|
|
1105
1105
|
visitors: number;
|
|
1106
1106
|
}>;
|
|
1107
1107
|
}
|
|
1108
|
+
/** First-touch attribution of a sale, as `vibiz.attribution()` captured it in the buyer's tab. */
|
|
1109
|
+
export interface Attribution {
|
|
1110
|
+
/** Referrer host or `utm_source`; null: a direct visit. */
|
|
1111
|
+
source: string | null;
|
|
1112
|
+
referrer: string | null;
|
|
1113
|
+
utm_source: string | null;
|
|
1114
|
+
utm_medium: string | null;
|
|
1115
|
+
utm_campaign: string | null;
|
|
1116
|
+
utm_term: string | null;
|
|
1117
|
+
utm_content: string | null;
|
|
1118
|
+
landing_page: string | null;
|
|
1119
|
+
/** The page the checkout started from. */
|
|
1120
|
+
checkout_page: string | null;
|
|
1121
|
+
/** The analytics visitor-day the sale links to (`analytics.visitor`). */
|
|
1122
|
+
visitor_id: string | null;
|
|
1123
|
+
day: string | null;
|
|
1124
|
+
first_seen_at: string | null;
|
|
1125
|
+
}
|
|
1126
|
+
/** A sale a visitor-day led to (its checkout carried that visitor's attribution). */
|
|
1127
|
+
export interface JourneySale {
|
|
1128
|
+
object: 'payment';
|
|
1129
|
+
console_url?: string;
|
|
1130
|
+
id: string;
|
|
1131
|
+
environment: 'production' | 'development';
|
|
1132
|
+
status: string;
|
|
1133
|
+
amount_cents: number;
|
|
1134
|
+
currency: string;
|
|
1135
|
+
created_at: string;
|
|
1136
|
+
checkout_page: string | null;
|
|
1137
|
+
}
|
|
1138
|
+
/** One visitor's day on the site (`GET /projects/:id/analytics/visitors`). */
|
|
1139
|
+
export interface VisitorJourney {
|
|
1140
|
+
object: 'visitor_journey';
|
|
1141
|
+
/** The journey in the web console, absolute: give it to the person. */
|
|
1142
|
+
console_url?: string;
|
|
1143
|
+
project_id: string;
|
|
1144
|
+
/** Pseudonymous: the browser's random id, the app's user (hashed) or a daily hash. */
|
|
1145
|
+
visitor_id: string;
|
|
1146
|
+
/** UTC day: a journey is one visitor on one day. */
|
|
1147
|
+
day: string;
|
|
1148
|
+
started_at: string;
|
|
1149
|
+
ended_at: string;
|
|
1150
|
+
duration_ms: number;
|
|
1151
|
+
/** The first page's source: referrer host or utm_source. Null: direct. */
|
|
1152
|
+
source: string | null;
|
|
1153
|
+
landing_page: string | null;
|
|
1154
|
+
country: string | null;
|
|
1155
|
+
device: string | null;
|
|
1156
|
+
pageviews: number;
|
|
1157
|
+
/** Custom events and outbound clicks. */
|
|
1158
|
+
events: number;
|
|
1159
|
+
/** A sale linked by attribution, or a conversion event (`goals`). */
|
|
1160
|
+
converted: boolean;
|
|
1161
|
+
sales: JourneySale[];
|
|
1162
|
+
}
|
|
1163
|
+
export interface VisitorJourneySummary extends VisitorJourney {
|
|
1164
|
+
/** Pages in order (the first 30). */
|
|
1165
|
+
pages: Array<{
|
|
1166
|
+
path: string;
|
|
1167
|
+
at: string;
|
|
1168
|
+
}>;
|
|
1169
|
+
/** Custom events in order (the first 20). */
|
|
1170
|
+
custom_events: Array<{
|
|
1171
|
+
name: string;
|
|
1172
|
+
path: string;
|
|
1173
|
+
at: string;
|
|
1174
|
+
}>;
|
|
1175
|
+
replays: Array<{
|
|
1176
|
+
id: string;
|
|
1177
|
+
object: 'replay';
|
|
1178
|
+
console_url?: string;
|
|
1179
|
+
started_at: string;
|
|
1180
|
+
duration_ms: number;
|
|
1181
|
+
}>;
|
|
1182
|
+
}
|
|
1183
|
+
export interface VisitorJourneyList {
|
|
1184
|
+
object: 'visitor_journey_list';
|
|
1185
|
+
console_url?: string;
|
|
1186
|
+
project_id: string;
|
|
1187
|
+
period: AnalyticsPeriod;
|
|
1188
|
+
from: string;
|
|
1189
|
+
to: string;
|
|
1190
|
+
filters: {
|
|
1191
|
+
source: string | null;
|
|
1192
|
+
landing: string | null;
|
|
1193
|
+
country: string | null;
|
|
1194
|
+
converted: boolean;
|
|
1195
|
+
goals: string[] | null;
|
|
1196
|
+
};
|
|
1197
|
+
/** Newest first. */
|
|
1198
|
+
data: VisitorJourneySummary[];
|
|
1199
|
+
has_more: boolean;
|
|
1200
|
+
/** Pass as `cursor` for the next page. */
|
|
1201
|
+
next_cursor: string | null;
|
|
1202
|
+
note: string;
|
|
1203
|
+
}
|
|
1204
|
+
export interface VisitorJourneyDetail extends VisitorJourney {
|
|
1205
|
+
/** Every source the visitor arrived from that day, in order. */
|
|
1206
|
+
sources: string[];
|
|
1207
|
+
/** Every pageview and event in order (at most 1,000). */
|
|
1208
|
+
timeline: Array<{
|
|
1209
|
+
at: string;
|
|
1210
|
+
offset_ms: number;
|
|
1211
|
+
type: 'pageview' | 'event';
|
|
1212
|
+
/** Events only. */
|
|
1213
|
+
name?: string;
|
|
1214
|
+
path: string;
|
|
1215
|
+
source?: string;
|
|
1216
|
+
props?: Record<string, string>;
|
|
1217
|
+
/** Pageviews: until the visitor's next event that day. */
|
|
1218
|
+
time_on_page_ms?: number;
|
|
1219
|
+
}>;
|
|
1220
|
+
timeline_truncated: boolean;
|
|
1221
|
+
/** Recordings of the visit: `visitor` stamped by the tag, `time` matched by device, country and time. */
|
|
1222
|
+
replays: Array<{
|
|
1223
|
+
id: string;
|
|
1224
|
+
object: 'replay';
|
|
1225
|
+
console_url?: string;
|
|
1226
|
+
project_id: string;
|
|
1227
|
+
started_at: string;
|
|
1228
|
+
duration_ms: number;
|
|
1229
|
+
pages: string[];
|
|
1230
|
+
source: string | null;
|
|
1231
|
+
match: 'visitor' | 'time';
|
|
1232
|
+
}>;
|
|
1233
|
+
}
|
|
1234
|
+
export interface VisitorJourneyQuery {
|
|
1235
|
+
period?: AnalyticsPeriod;
|
|
1236
|
+
/** First source, e.g. `google.com` or `newsletter`; `direct` for none. */
|
|
1237
|
+
source?: string;
|
|
1238
|
+
/** Landing page path, e.g. `/pricing`. */
|
|
1239
|
+
landing?: string;
|
|
1240
|
+
/** Two-letter country code. */
|
|
1241
|
+
country?: string;
|
|
1242
|
+
/** Only visitor-days with a sale or a conversion event. */
|
|
1243
|
+
converted?: boolean;
|
|
1244
|
+
/** Event names that count as a conversion (default: Purchase, Signup, Subscribe…). */
|
|
1245
|
+
goals?: string[];
|
|
1246
|
+
limit?: number;
|
|
1247
|
+
cursor?: string;
|
|
1248
|
+
}
|
|
1108
1249
|
export type ReplayPeriod = '24h' | '7d' | '30d';
|
|
1109
1250
|
export type ReplayTrigger = 'error' | 'rage' | 'dead' | 'event' | 'always' | 'sample';
|
|
1110
1251
|
/** Settings of the `replay` resource. */
|
|
@@ -1133,6 +1274,11 @@ export interface ReplaySummary {
|
|
|
1133
1274
|
trigger: ReplayTrigger;
|
|
1134
1275
|
device: string | null;
|
|
1135
1276
|
country: string | null;
|
|
1277
|
+
/** Where the visitor came from (referrer host or utm_source); null: direct or not known. */
|
|
1278
|
+
source?: string | null;
|
|
1279
|
+
landing_page?: string | null;
|
|
1280
|
+
/** The analytics visitor-day this tab is part of (`analytics.visitor`). */
|
|
1281
|
+
visitor_id?: string | null;
|
|
1136
1282
|
pages: string[];
|
|
1137
1283
|
counts: {
|
|
1138
1284
|
clicks: number;
|
|
@@ -2697,6 +2843,8 @@ export interface CheckoutInput {
|
|
|
2697
2843
|
metadata?: Record<string, string>;
|
|
2698
2844
|
/** The business's look on the page, over the project's brand field by field. */
|
|
2699
2845
|
brand?: CheckoutBrand;
|
|
2846
|
+
/** Where the buyer came from: what `vibiz.attribution()` gave in their browser. */
|
|
2847
|
+
attribution?: Partial<Attribution> | null;
|
|
2700
2848
|
}
|
|
2701
2849
|
export interface Checkout {
|
|
2702
2850
|
object: 'checkout';
|
|
@@ -2729,6 +2877,8 @@ export interface Payment {
|
|
|
2729
2877
|
price_id: string | null;
|
|
2730
2878
|
subscription_id: string | null;
|
|
2731
2879
|
metadata: Record<string, string>;
|
|
2880
|
+
/** Where the buyer came from, as the checkout carried it; null: sent without it. */
|
|
2881
|
+
attribution?: Attribution | null;
|
|
2732
2882
|
card: {
|
|
2733
2883
|
brand: string;
|
|
2734
2884
|
last4: string;
|
|
@@ -5020,4 +5170,88 @@ export interface MarketplaceOffer {
|
|
|
5020
5170
|
/** The buyer's, once accepted. */
|
|
5021
5171
|
transfer?: MarketplaceTransfer;
|
|
5022
5172
|
}
|
|
5173
|
+
/** A folder or text file in the account's or a project's Library. Stored only, never run. */
|
|
5174
|
+
export interface LibraryEntry {
|
|
5175
|
+
object: 'library_entry';
|
|
5176
|
+
id: string;
|
|
5177
|
+
kind: 'folder' | 'file';
|
|
5178
|
+
/** From the top of the Library, no leading slash: `skills/seo/SKILL.md`. */
|
|
5179
|
+
path: string;
|
|
5180
|
+
name: string;
|
|
5181
|
+
/** The folder it is in ('' at the top). */
|
|
5182
|
+
parent: string;
|
|
5183
|
+
scope: 'account' | 'project';
|
|
5184
|
+
project_id: string | null;
|
|
5185
|
+
/** A file's bytes; a folder's, everything below it. */
|
|
5186
|
+
size_bytes: number;
|
|
5187
|
+
/** A folder's entries directly inside it. */
|
|
5188
|
+
items?: number;
|
|
5189
|
+
created_at: string;
|
|
5190
|
+
updated_at: string;
|
|
5191
|
+
/** The key that made the last change. */
|
|
5192
|
+
updated_by: string | null;
|
|
5193
|
+
/** The file's text: only when read. */
|
|
5194
|
+
content?: string;
|
|
5195
|
+
console_url: string;
|
|
5196
|
+
}
|
|
5197
|
+
export interface LibraryList {
|
|
5198
|
+
object: 'list';
|
|
5199
|
+
scope: 'account' | 'project';
|
|
5200
|
+
project_id: string | null;
|
|
5201
|
+
path: string;
|
|
5202
|
+
recursive: boolean;
|
|
5203
|
+
/** The folder listed (null at the top). */
|
|
5204
|
+
folder: LibraryEntry | null;
|
|
5205
|
+
data: LibraryEntry[];
|
|
5206
|
+
size_bytes: number;
|
|
5207
|
+
usage: {
|
|
5208
|
+
entries: number;
|
|
5209
|
+
bytes: number;
|
|
5210
|
+
max_entries: number;
|
|
5211
|
+
max_bytes: number;
|
|
5212
|
+
max_file_bytes: number;
|
|
5213
|
+
};
|
|
5214
|
+
console_url: string;
|
|
5215
|
+
}
|
|
5216
|
+
export interface LibraryImport {
|
|
5217
|
+
object: 'library_import';
|
|
5218
|
+
scope: 'account' | 'project';
|
|
5219
|
+
project_id: string | null;
|
|
5220
|
+
path: string;
|
|
5221
|
+
created: number;
|
|
5222
|
+
updated: number;
|
|
5223
|
+
folders_created: number;
|
|
5224
|
+
data: LibraryEntry[];
|
|
5225
|
+
console_url: string;
|
|
5226
|
+
}
|
|
5227
|
+
export interface LibraryExport {
|
|
5228
|
+
object: 'library_export';
|
|
5229
|
+
scope: 'account' | 'project';
|
|
5230
|
+
project_id: string | null;
|
|
5231
|
+
path: string;
|
|
5232
|
+
kind: 'folder' | 'file';
|
|
5233
|
+
/** Relative to `path`, empty ones included. */
|
|
5234
|
+
folders: string[];
|
|
5235
|
+
/** Relative to `path` (a single file: its own name). */
|
|
5236
|
+
files: {
|
|
5237
|
+
path: string;
|
|
5238
|
+
content: string;
|
|
5239
|
+
size_bytes: number;
|
|
5240
|
+
updated_at: string;
|
|
5241
|
+
console_url: string;
|
|
5242
|
+
}[];
|
|
5243
|
+
size_bytes: number;
|
|
5244
|
+
console_url: string;
|
|
5245
|
+
}
|
|
5246
|
+
export interface LibraryDeleted {
|
|
5247
|
+
object: 'library_entry';
|
|
5248
|
+
id: string;
|
|
5249
|
+
kind: 'folder' | 'file';
|
|
5250
|
+
path: string;
|
|
5251
|
+
scope: 'account' | 'project';
|
|
5252
|
+
project_id: string | null;
|
|
5253
|
+
deleted: true;
|
|
5254
|
+
deleted_count: number;
|
|
5255
|
+
console_url: string;
|
|
5256
|
+
}
|
|
5023
5257
|
export {};
|