@vibiz/sdk 0.2.4 → 0.3.1
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 +65 -1
- package/dist/format.d.ts +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +117 -2
- package/dist/one-key.d.ts +1 -1
- package/dist/types.d.ts +380 -8
- 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, AiModelInfo, AiProviderKey, AiProviderKeyInput, AiProviderKeyList, AiSettings, AnalyticsPeriod, AnalyticsReport, ApiKey, AppKeyInfo, 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, 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, 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, HostKind, ImageRequest, ImageResult, InboxSettings, KeyAccess, LedgerEntry, Mailbox, MailboxInput, MailDomain, MailFolder, MailReplyInput, MailSendInput, MailThreadDetail, MailThreadList, MailView, MetricsReport, Operation, OwnAccountLink, OwnedDomain, OwnedDomainList, Payment, PaymentPrice, PaymentPriceInput, PaymentProduct, PaymentSubscription, PaymentsAccount, PaymentsEnvironment, PaymentsList, PaymentsSimulation, PhoneAnsweringInput, PhoneCall, PhoneCallInput, PhoneCallList, PhoneMessage, PhoneMessageList, PhoneNumber, PhoneNumberList, PhoneQuote, PhoneRegistrationInput, PhoneRegistrationRequirements, PhoneSearch, PhoneSendInput, PhoneThreadList, Project, ProjectExport, ReplayDetail, ReplayInsights, ReplayListOptions, ReplayPeriod, ReplayStatus, ReplaySummary, Resource, ResourceType, SecretLink, SegmentFilter, SendEmailInput, SendEmailOutput, SocialAccount, SocialAccountAnalytics, SocialAdCampaign, SocialAdChange, SocialAdChangeInput, SocialConnectLink, SocialEnvironment, SocialMedia, SocialOverview, SocialPost, SocialPostAnalytics, SocialPostInput, SpeechRequest, Transcription, UsageOptions, UsagePeriod, UsageReport, VersionDiff, VersionList, VersionRestore, VibizFile, WebDesignInput, WebhookDelivery, WebhookEventType, Withdrawal } from './types.js';
|
|
1
|
+
import type { ActionInfo, ActionResult, ActionRun, ActionRunList, ActionRunsQuery, ActionUsage, AdminMetrics, AiJob, 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, 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, HostKind, ImageRequest, ImageResult, InboxSettings, KeyAccess, LedgerEntry, Mailbox, MailboxInput, MailDomain, MailFolder, MailReplyInput, MailSendInput, MailThreadDetail, MailThreadList, MailView, MetricsReport, 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, Project, ProjectExport, ReplayDetail, ReplayFrames, ReplayFramesOptions, ReplayInsights, ReplayListOptions, ReplayPeriod, ReplayStatus, ReplaySummary, Resource, ResourceType, SecretLink, SegmentFilter, SendEmailInput, SendEmailOutput, SocialAccount, SocialAccountAnalytics, SocialAdCampaign, SocialAdChange, SocialAdChangeInput, SocialCampaignCreateInput, SocialConnectLink, SocialEnvironment, SocialMedia, SocialOverview, SocialPost, SocialPostAnalytics, SocialPostInput, SpeechRequest, Transcription, UsageOptions, UsagePeriod, UsageReport, 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.
|
|
@@ -344,6 +344,8 @@ export declare class Vibiz {
|
|
|
344
344
|
data: SocialAdChange[];
|
|
345
345
|
}>;
|
|
346
346
|
adChange: (id: string, input: SocialAdChangeInput, env?: SocialEnvironment) => Promise<SocialAdChange>;
|
|
347
|
+
/** A Google Ads campaign, paused by default: an `ad_change` of kind `create_campaign`. */
|
|
348
|
+
createCampaign: (id: string, input: SocialCampaignCreateInput, env?: SocialEnvironment) => Promise<SocialAdChange>;
|
|
347
349
|
approveAdChange: (id: string, changeId: string, env?: SocialEnvironment) => Promise<SocialAdChange>;
|
|
348
350
|
rejectAdChange: (id: string, changeId: string, env?: SocialEnvironment) => Promise<SocialAdChange>;
|
|
349
351
|
};
|
|
@@ -359,6 +361,8 @@ export declare class Vibiz {
|
|
|
359
361
|
statement_descriptor_suffix?: string | null;
|
|
360
362
|
webhook_url?: string | null;
|
|
361
363
|
webhook_events?: WebhookEventType[];
|
|
364
|
+
/** The checkout page's look for every checkout: merged field by field, null clears it. */
|
|
365
|
+
brand?: CheckoutBrandPatch | null;
|
|
362
366
|
}, env?: PaymentsEnvironment) => Promise<PaymentsAccount>;
|
|
363
367
|
/** A new signing secret, shown once (also put in the app's env as VIBIZ_WEBHOOK_SECRET). */
|
|
364
368
|
rotateWebhookSecret: (id: string, env?: PaymentsEnvironment) => Promise<{
|
|
@@ -439,6 +443,24 @@ export declare class Vibiz {
|
|
|
439
443
|
ownAccount: {
|
|
440
444
|
link: (id: string, env?: PaymentsEnvironment) => Promise<OwnAccountLink>;
|
|
441
445
|
disconnect: (id: string, env?: PaymentsEnvironment) => Promise<PaymentsAccount>;
|
|
446
|
+
/** Back on the Stripe connected once for every project (owner in production). */
|
|
447
|
+
useAccount: (id: string, env?: PaymentsEnvironment) => Promise<PaymentsAccount>;
|
|
448
|
+
};
|
|
449
|
+
/**
|
|
450
|
+
* App Store and Google Play through the owner's own RevenueCat account
|
|
451
|
+
* (docs: app-store). `setup` creates the app there, mirrors the catalog
|
|
452
|
+
* and answers the public SDK key and the owner's checklist; re-running converges.
|
|
453
|
+
*/
|
|
454
|
+
appStore: {
|
|
455
|
+
get: (id: string, env?: PaymentsEnvironment) => Promise<AppStoreState>;
|
|
456
|
+
setup: (id: string, input: AppStoreSetupInput, env?: PaymentsEnvironment) => Promise<AppStoreSetup>;
|
|
457
|
+
subscriptions: (id: string, opts?: {
|
|
458
|
+
env?: PaymentsEnvironment;
|
|
459
|
+
user?: string;
|
|
460
|
+
}) => Promise<{
|
|
461
|
+
object: "list";
|
|
462
|
+
data: PaymentSubscription[];
|
|
463
|
+
}>;
|
|
442
464
|
};
|
|
443
465
|
};
|
|
444
466
|
/**
|
|
@@ -656,6 +678,15 @@ export declare class Vibiz {
|
|
|
656
678
|
events: unknown[];
|
|
657
679
|
next_seq: number | null;
|
|
658
680
|
}>;
|
|
681
|
+
/**
|
|
682
|
+
* Still pictures of what the visitor saw at the moments that matter (each
|
|
683
|
+
* page, error, rage and dead click, abandoned form, and the end), or at
|
|
684
|
+
* one instant (`at`, ms from the start). Look at them for broken layout.
|
|
685
|
+
* Each new picture is one metered page screenshot; ones taken before are free.
|
|
686
|
+
*/
|
|
687
|
+
frames: (id: string, opts?: ReplayFramesOptions) => Promise<ReplayFrames>;
|
|
688
|
+
/** A frame's PNG from its signed `image.url` (no key sent). */
|
|
689
|
+
frameImage: (url: string) => Promise<Uint8Array>;
|
|
659
690
|
/** A link to the hosted player for a person, valid for `expires_in` seconds (default 1 h, max 24 h). */
|
|
660
691
|
share: (id: string, opts?: {
|
|
661
692
|
expires_in?: number;
|
|
@@ -1239,6 +1270,39 @@ export declare class Vibiz {
|
|
|
1239
1270
|
limit?: number;
|
|
1240
1271
|
}) => Promise<BillingList<BillingCharge>>;
|
|
1241
1272
|
};
|
|
1273
|
+
/**
|
|
1274
|
+
* Payments across the account (docs/PAYMENTS.md "One Stripe for every
|
|
1275
|
+
* project"): the owner's Stripe connected once and used by every project.
|
|
1276
|
+
* `link` (any key) is for the owner to complete; `update`, `apply` (in
|
|
1277
|
+
* production) and `disconnect` are the owner's.
|
|
1278
|
+
*/
|
|
1279
|
+
readonly payments: {
|
|
1280
|
+
ownAccount: {
|
|
1281
|
+
get: () => Promise<OwnerStripe>;
|
|
1282
|
+
link: (env?: PaymentsEnvironment) => Promise<OwnerStripeLink>;
|
|
1283
|
+
update: (input: {
|
|
1284
|
+
use_for_all_projects: boolean;
|
|
1285
|
+
}) => Promise<OwnerStripe>;
|
|
1286
|
+
apply: (input?: {
|
|
1287
|
+
env?: PaymentsEnvironment;
|
|
1288
|
+
dry_run?: boolean;
|
|
1289
|
+
include_opted_out?: boolean;
|
|
1290
|
+
}) => Promise<OwnerStripeApply>;
|
|
1291
|
+
disconnect: (env?: PaymentsEnvironment) => Promise<OwnerStripeDisconnect>;
|
|
1292
|
+
};
|
|
1293
|
+
/**
|
|
1294
|
+
* The owner's own RevenueCat account (docs: app-store), connected once.
|
|
1295
|
+
* `link` (any key) is for the owner: they paste the secret key on that page.
|
|
1296
|
+
*/
|
|
1297
|
+
appStore: {
|
|
1298
|
+
get: () => Promise<AppStoreAccount>;
|
|
1299
|
+
link: () => Promise<AppStoreConnectLink>;
|
|
1300
|
+
disconnect: (connectionId: string) => Promise<{
|
|
1301
|
+
object: "app_store_disconnected";
|
|
1302
|
+
note: string;
|
|
1303
|
+
}>;
|
|
1304
|
+
};
|
|
1305
|
+
};
|
|
1242
1306
|
/** Request counts, error rate and latency by capability. */
|
|
1243
1307
|
readonly metrics: {
|
|
1244
1308
|
get: (opts?: {
|
package/dist/format.d.ts
CHANGED
|
@@ -9,3 +9,5 @@
|
|
|
9
9
|
export declare function formatUsd(usd: number): string;
|
|
10
10
|
/** "339 in · 252 out tok", "7 img", "1 call": one short line per row. */
|
|
11
11
|
export declare function formatUnits(units: Record<string, number>): string;
|
|
12
|
+
/** Minor units of `currency` → `20.00 USD`, `3000 JPY`, `1.500 KWD` (2 decimals when unknown). */
|
|
13
|
+
export declare function formatMinor(minor: number | null | undefined, currency: string | null | undefined): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { endUserHeader, 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
|
-
export { formatUnits, formatUsd } from './format.js';
|
|
4
|
+
export { formatMinor, formatUnits, formatUsd } from './format.js';
|
|
5
5
|
export { APP_SDK_VERSION, connectHostMessage, ONE_KEY_GIVES, oneKeyMessage, } from './one-key.js';
|
|
6
6
|
export type * from './types.js';
|
package/dist/index.js
CHANGED
|
@@ -376,6 +376,11 @@ var Vibiz = class {
|
|
|
376
376
|
method: "POST",
|
|
377
377
|
body: input
|
|
378
378
|
}),
|
|
379
|
+
/** A Google Ads campaign, paused by default: an `ad_change` of kind `create_campaign`. */
|
|
380
|
+
createCampaign: (id, input, env) => this.request(`/projects/${id}/social/ads/changes${envQuery(env)}`, {
|
|
381
|
+
method: "POST",
|
|
382
|
+
body: { ...input, kind: "create_campaign" }
|
|
383
|
+
}),
|
|
379
384
|
approveAdChange: (id, changeId, env) => this.request(
|
|
380
385
|
`/projects/${id}/social/ads/changes/${encodeURIComponent(changeId)}/approve${envQuery(env)}`,
|
|
381
386
|
{ method: "POST", body: {} }
|
|
@@ -494,7 +499,27 @@ var Vibiz = class {
|
|
|
494
499
|
}),
|
|
495
500
|
disconnect: (id, env) => this.request(`/projects/${id}/payments/own-account${envQuery(env)}`, {
|
|
496
501
|
method: "DELETE"
|
|
497
|
-
})
|
|
502
|
+
}),
|
|
503
|
+
/** Back on the Stripe connected once for every project (owner in production). */
|
|
504
|
+
useAccount: (id, env) => this.request(
|
|
505
|
+
`/projects/${id}/payments/own-account/use-account${envQuery(env)}`,
|
|
506
|
+
{ method: "POST", body: {} }
|
|
507
|
+
)
|
|
508
|
+
},
|
|
509
|
+
/**
|
|
510
|
+
* App Store and Google Play through the owner's own RevenueCat account
|
|
511
|
+
* (docs: app-store). `setup` creates the app there, mirrors the catalog
|
|
512
|
+
* and answers the public SDK key and the owner's checklist; re-running converges.
|
|
513
|
+
*/
|
|
514
|
+
appStore: {
|
|
515
|
+
get: (id, env) => this.request(`/projects/${id}/payments/app-store${envQuery(env)}`),
|
|
516
|
+
setup: (id, input, env) => this.request(`/projects/${id}/payments/app-store/setup${envQuery(env)}`, {
|
|
517
|
+
method: "POST",
|
|
518
|
+
body: input
|
|
519
|
+
}),
|
|
520
|
+
subscriptions: (id, opts = {}) => this.request(
|
|
521
|
+
`/projects/${id}/payments/app-store/subscriptions${paymentsQuery(opts)}`
|
|
522
|
+
)
|
|
498
523
|
}
|
|
499
524
|
},
|
|
500
525
|
/**
|
|
@@ -788,6 +813,27 @@ var Vibiz = class {
|
|
|
788
813
|
`/replays/${id}/events${qs2 ? `?${qs2}` : ""}`
|
|
789
814
|
);
|
|
790
815
|
},
|
|
816
|
+
/**
|
|
817
|
+
* Still pictures of what the visitor saw at the moments that matter (each
|
|
818
|
+
* page, error, rage and dead click, abandoned form, and the end), or at
|
|
819
|
+
* one instant (`at`, ms from the start). Look at them for broken layout.
|
|
820
|
+
* Each new picture is one metered page screenshot; ones taken before are free.
|
|
821
|
+
*/
|
|
822
|
+
frames: (id, opts = {}) => {
|
|
823
|
+
const q = new URLSearchParams();
|
|
824
|
+
if (opts.moments?.length) q.set("moments", opts.moments.join(","));
|
|
825
|
+
if (opts.limit !== void 0) q.set("limit", String(opts.limit));
|
|
826
|
+
if (opts.at !== void 0) q.set("at", String(Math.round(opts.at)));
|
|
827
|
+
if (opts.pointer === false) q.set("pointer", "false");
|
|
828
|
+
const qs2 = q.toString();
|
|
829
|
+
return this.request(`/replays/${id}/frames${qs2 ? `?${qs2}` : ""}`);
|
|
830
|
+
},
|
|
831
|
+
/** A frame's PNG from its signed `image.url` (no key sent). */
|
|
832
|
+
frameImage: async (url) => {
|
|
833
|
+
const res = await this.fetchImpl(url);
|
|
834
|
+
if (!res.ok) return this.fail(res);
|
|
835
|
+
return new Uint8Array(await res.arrayBuffer());
|
|
836
|
+
},
|
|
791
837
|
/** A link to the hosted player for a person, valid for `expires_in` seconds (default 1 h, max 24 h). */
|
|
792
838
|
share: (id, opts = {}) => this.request(`/replays/${id}/share`, {
|
|
793
839
|
method: "POST",
|
|
@@ -1332,6 +1378,41 @@ var Vibiz = class {
|
|
|
1332
1378
|
),
|
|
1333
1379
|
charges: (opts = {}) => this.request(`/billing/charges${qs(opts)}`)
|
|
1334
1380
|
};
|
|
1381
|
+
/**
|
|
1382
|
+
* Payments across the account (docs/PAYMENTS.md "One Stripe for every
|
|
1383
|
+
* project"): the owner's Stripe connected once and used by every project.
|
|
1384
|
+
* `link` (any key) is for the owner to complete; `update`, `apply` (in
|
|
1385
|
+
* production) and `disconnect` are the owner's.
|
|
1386
|
+
*/
|
|
1387
|
+
payments = {
|
|
1388
|
+
ownAccount: {
|
|
1389
|
+
get: () => this.request("/payments/own-account"),
|
|
1390
|
+
link: (env = "production") => this.request(`/payments/own-account/link?env=${env}`, {
|
|
1391
|
+
method: "POST",
|
|
1392
|
+
body: {}
|
|
1393
|
+
}),
|
|
1394
|
+
update: (input) => this.request("/payments/own-account", { method: "POST", body: input }),
|
|
1395
|
+
apply: (input = {}) => this.request("/payments/own-account/apply", {
|
|
1396
|
+
method: "POST",
|
|
1397
|
+
body: input
|
|
1398
|
+
}),
|
|
1399
|
+
disconnect: (env = "production") => this.request(`/payments/own-account?env=${env}`, {
|
|
1400
|
+
method: "DELETE"
|
|
1401
|
+
})
|
|
1402
|
+
},
|
|
1403
|
+
/**
|
|
1404
|
+
* The owner's own RevenueCat account (docs: app-store), connected once.
|
|
1405
|
+
* `link` (any key) is for the owner: they paste the secret key on that page.
|
|
1406
|
+
*/
|
|
1407
|
+
appStore: {
|
|
1408
|
+
get: () => this.request("/payments/app-store"),
|
|
1409
|
+
link: () => this.request("/payments/app-store/link", { method: "POST", body: {} }),
|
|
1410
|
+
disconnect: (connectionId) => this.request(
|
|
1411
|
+
`/payments/app-store/connections/${encodeURIComponent(connectionId)}`,
|
|
1412
|
+
{ method: "DELETE" }
|
|
1413
|
+
)
|
|
1414
|
+
}
|
|
1415
|
+
};
|
|
1335
1416
|
/** Request counts, error rate and latency by capability. */
|
|
1336
1417
|
metrics = {
|
|
1337
1418
|
get: (opts = {}) => this.request(`/metrics?period=${opts.period ?? "30d"}`)
|
|
@@ -1728,9 +1809,42 @@ function formatUnits(units) {
|
|
|
1728
1809
|
}
|
|
1729
1810
|
return parts.join(" \xB7 ") || "\u2013";
|
|
1730
1811
|
}
|
|
1812
|
+
var EXPONENTS = {
|
|
1813
|
+
bif: 0,
|
|
1814
|
+
clp: 0,
|
|
1815
|
+
djf: 0,
|
|
1816
|
+
gnf: 0,
|
|
1817
|
+
isk: 0,
|
|
1818
|
+
jpy: 0,
|
|
1819
|
+
kmf: 0,
|
|
1820
|
+
krw: 0,
|
|
1821
|
+
pyg: 0,
|
|
1822
|
+
rwf: 0,
|
|
1823
|
+
ugx: 0,
|
|
1824
|
+
uyi: 0,
|
|
1825
|
+
vnd: 0,
|
|
1826
|
+
vuv: 0,
|
|
1827
|
+
xaf: 0,
|
|
1828
|
+
xof: 0,
|
|
1829
|
+
xpf: 0,
|
|
1830
|
+
bhd: 3,
|
|
1831
|
+
iqd: 3,
|
|
1832
|
+
jod: 3,
|
|
1833
|
+
kwd: 3,
|
|
1834
|
+
lyd: 3,
|
|
1835
|
+
omr: 3,
|
|
1836
|
+
tnd: 3,
|
|
1837
|
+
clf: 4,
|
|
1838
|
+
uyw: 4
|
|
1839
|
+
};
|
|
1840
|
+
function formatMinor(minor, currency) {
|
|
1841
|
+
if (minor === null || minor === void 0) return "\u2013";
|
|
1842
|
+
const exp = currency ? EXPONENTS[currency.toLowerCase()] ?? 2 : 2;
|
|
1843
|
+
return `${(minor / 10 ** exp).toFixed(exp)}${currency ? ` ${currency.toUpperCase()}` : ""}`;
|
|
1844
|
+
}
|
|
1731
1845
|
|
|
1732
1846
|
// packages/sdk/src/one-key.ts
|
|
1733
|
-
var APP_SDK_VERSION = "0.
|
|
1847
|
+
var APP_SDK_VERSION = "0.3.1";
|
|
1734
1848
|
var ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social, phone and connectors";
|
|
1735
1849
|
function oneKeyMessage(url, host) {
|
|
1736
1850
|
const where = host ?? "your host";
|
|
@@ -1752,6 +1866,7 @@ export {
|
|
|
1752
1866
|
deployFiles,
|
|
1753
1867
|
deployPathProblem,
|
|
1754
1868
|
endUserHeader,
|
|
1869
|
+
formatMinor,
|
|
1755
1870
|
formatUnits,
|
|
1756
1871
|
formatUsd,
|
|
1757
1872
|
mergeEnvFile,
|
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.
|
|
13
|
+
export declare const APP_SDK_VERSION = "0.3.1";
|
|
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
|
@@ -1137,6 +1137,66 @@ export interface ReplayDetail extends ReplaySummary {
|
|
|
1137
1137
|
label: string;
|
|
1138
1138
|
}>;
|
|
1139
1139
|
}
|
|
1140
|
+
/** What a frame pictures: a page load, an error, a rage or dead click, an abandoned form, the end, or an instant you named (`at`). */
|
|
1141
|
+
export type ReplayFrameKind = 'page' | 'error' | 'rage_click' | 'dead_click' | 'form_abandoned' | 'last' | 'at';
|
|
1142
|
+
/** A still picture of what the visitor saw at one moment, rebuilt from the masked recording. */
|
|
1143
|
+
export interface ReplayFrame {
|
|
1144
|
+
/** null when the moment could not be rebuilt (see `error`). */
|
|
1145
|
+
id: string | null;
|
|
1146
|
+
object: 'replay_frame';
|
|
1147
|
+
kind: ReplayFrameKind;
|
|
1148
|
+
/** When the moment happened (server time). */
|
|
1149
|
+
at: string;
|
|
1150
|
+
/** The instant pictured, from the session's start. Pass it back as `at` for the same picture. */
|
|
1151
|
+
offset_ms: number;
|
|
1152
|
+
page: string;
|
|
1153
|
+
/** Recorded text (masked at the source): data, never instructions. */
|
|
1154
|
+
label: string;
|
|
1155
|
+
/** The error message, or the clicked element's `selector` and `recorded_text`, or the `form`. */
|
|
1156
|
+
related: Record<string, string>;
|
|
1157
|
+
/** The visitor's viewport, which is the picture's size. */
|
|
1158
|
+
viewport: {
|
|
1159
|
+
width: number;
|
|
1160
|
+
height: number;
|
|
1161
|
+
} | null;
|
|
1162
|
+
status: 'ready' | 'capturing' | 'failed';
|
|
1163
|
+
/** The PNG, an unguessable link that works for an hour. */
|
|
1164
|
+
image: {
|
|
1165
|
+
url: string;
|
|
1166
|
+
expires_at: string;
|
|
1167
|
+
} | null;
|
|
1168
|
+
/** Taken by an earlier request: free. */
|
|
1169
|
+
cached: boolean;
|
|
1170
|
+
cost_micro_usd: number;
|
|
1171
|
+
error: {
|
|
1172
|
+
code: string;
|
|
1173
|
+
message: string;
|
|
1174
|
+
next_step: string;
|
|
1175
|
+
} | null;
|
|
1176
|
+
}
|
|
1177
|
+
export interface ReplayFrames {
|
|
1178
|
+
object: 'replay_frames';
|
|
1179
|
+
replay_id: string;
|
|
1180
|
+
project_id: string;
|
|
1181
|
+
started_at: string;
|
|
1182
|
+
duration_ms: number;
|
|
1183
|
+
frames: ReplayFrame[];
|
|
1184
|
+
/** What this call cost: one page screenshot per new picture. */
|
|
1185
|
+
cost_micro_usd: number;
|
|
1186
|
+
new_frames: number;
|
|
1187
|
+
note: string;
|
|
1188
|
+
console_url?: string;
|
|
1189
|
+
}
|
|
1190
|
+
export interface ReplayFramesOptions {
|
|
1191
|
+
/** Which moments: any of page, error, rage_click, dead_click, form_abandoned, last. Default all. */
|
|
1192
|
+
moments?: Array<Exclude<ReplayFrameKind, 'at'>>;
|
|
1193
|
+
/** Up to this many moments (default 6, max 12). */
|
|
1194
|
+
limit?: number;
|
|
1195
|
+
/** One picture at this many ms from the session's start, instead of the moments. */
|
|
1196
|
+
at?: number;
|
|
1197
|
+
/** Mark the pointer's position with a dot. Default true. */
|
|
1198
|
+
pointer?: boolean;
|
|
1199
|
+
}
|
|
1140
1200
|
export interface ReplayInsight {
|
|
1141
1201
|
kind: 'error' | 'rage_click' | 'dead_click' | 'form_abandoned';
|
|
1142
1202
|
severity: number;
|
|
@@ -2264,12 +2324,19 @@ export interface PaymentsAccountMode {
|
|
|
2264
2324
|
/** Whether owners can connect their own account here right now. */
|
|
2265
2325
|
available: boolean;
|
|
2266
2326
|
connected: boolean;
|
|
2327
|
+
/** `account`: the Stripe connected once for every project (Settings ▸ Payments); `project`: this project's own. */
|
|
2328
|
+
source: 'project' | 'account' | null;
|
|
2329
|
+
/** The owner took this project off the account's Stripe: Apply leaves it alone. */
|
|
2330
|
+
opted_out: boolean;
|
|
2267
2331
|
account_name: string | null;
|
|
2268
2332
|
livemode: boolean | null;
|
|
2269
2333
|
connected_at: string | null;
|
|
2270
|
-
/**
|
|
2334
|
+
/**
|
|
2335
|
+
* The last connection's end, while not connected: `owner` here, `deauthorized` from their
|
|
2336
|
+
* dashboard, `account` when the account-level Stripe was disconnected in Settings.
|
|
2337
|
+
*/
|
|
2271
2338
|
disconnected_at: string | null;
|
|
2272
|
-
disconnect_reason: 'owner' | 'deauthorized' | null;
|
|
2339
|
+
disconnect_reason: 'owner' | 'deauthorized' | 'account' | null;
|
|
2273
2340
|
};
|
|
2274
2341
|
/** What to do about it, in a sentence an agent can act on. */
|
|
2275
2342
|
note: string;
|
|
@@ -2283,6 +2350,85 @@ export interface OwnAccountLink {
|
|
|
2283
2350
|
expires_at: string;
|
|
2284
2351
|
account: PaymentsAccountMode;
|
|
2285
2352
|
}
|
|
2353
|
+
/** The account-level Stripe in one environment (Settings ▸ Payments). */
|
|
2354
|
+
export interface OwnerStripeEnvironment {
|
|
2355
|
+
available: boolean;
|
|
2356
|
+
connected: boolean;
|
|
2357
|
+
account_name: string | null;
|
|
2358
|
+
livemode: boolean | null;
|
|
2359
|
+
connected_at: string | null;
|
|
2360
|
+
disconnected_at: string | null;
|
|
2361
|
+
disconnect_reason: 'owner' | 'deauthorized' | null;
|
|
2362
|
+
}
|
|
2363
|
+
/** How one project uses the account-level Stripe in an environment. */
|
|
2364
|
+
export type OwnerStripeUsage = 'account' | 'other_account' | 'vibiz' | 'opted_out' | 'not_started';
|
|
2365
|
+
/**
|
|
2366
|
+
* `GET /v1/payments/own-account`: the owner's Stripe connected once for every
|
|
2367
|
+
* project (docs/PAYMENTS.md "One Stripe for every project").
|
|
2368
|
+
*/
|
|
2369
|
+
export interface OwnerStripe {
|
|
2370
|
+
object: 'payments_own_account';
|
|
2371
|
+
use_for_all_projects: boolean;
|
|
2372
|
+
environments: Record<PaymentsEnvironment, OwnerStripeEnvironment>;
|
|
2373
|
+
projects: {
|
|
2374
|
+
project_id: string;
|
|
2375
|
+
name: string;
|
|
2376
|
+
status: string;
|
|
2377
|
+
production: OwnerStripeUsage;
|
|
2378
|
+
development: OwnerStripeUsage;
|
|
2379
|
+
}[];
|
|
2380
|
+
note: string;
|
|
2381
|
+
console_url: string;
|
|
2382
|
+
}
|
|
2383
|
+
/** A link for the owner to connect their Stripe once for every project. */
|
|
2384
|
+
export interface OwnerStripeLink {
|
|
2385
|
+
object: 'own_account_link';
|
|
2386
|
+
scope: 'account';
|
|
2387
|
+
environment: PaymentsEnvironment;
|
|
2388
|
+
url: string;
|
|
2389
|
+
console_url: string;
|
|
2390
|
+
expires_at: string;
|
|
2391
|
+
account: OwnerStripeEnvironment;
|
|
2392
|
+
note: string;
|
|
2393
|
+
}
|
|
2394
|
+
interface OwnerStripeApplyItem {
|
|
2395
|
+
project_id: string;
|
|
2396
|
+
name: string;
|
|
2397
|
+
environment: PaymentsEnvironment;
|
|
2398
|
+
}
|
|
2399
|
+
/** `POST /v1/payments/own-account/apply`: what changed (or would, with `dry_run`), and what was skipped. */
|
|
2400
|
+
export interface OwnerStripeApply {
|
|
2401
|
+
object: 'own_account_apply';
|
|
2402
|
+
dry_run: boolean;
|
|
2403
|
+
changed: (OwnerStripeApplyItem & {
|
|
2404
|
+
from: 'vibiz' | 'not_started';
|
|
2405
|
+
/** Kept in the project's Vibiz balance, to withdraw. */
|
|
2406
|
+
balance_cents: number;
|
|
2407
|
+
/** Live subscriptions sold through Vibiz: they keep billing through Vibiz. */
|
|
2408
|
+
vibiz_subscriptions: number;
|
|
2409
|
+
})[];
|
|
2410
|
+
unchanged: (OwnerStripeApplyItem & {
|
|
2411
|
+
reason: 'already';
|
|
2412
|
+
})[];
|
|
2413
|
+
skipped: (OwnerStripeApplyItem & {
|
|
2414
|
+
reason: 'frozen' | 'deleting' | 'other_account' | 'opted_out';
|
|
2415
|
+
message: string;
|
|
2416
|
+
})[];
|
|
2417
|
+
not_connected: PaymentsEnvironment[];
|
|
2418
|
+
note: string;
|
|
2419
|
+
console_url: string;
|
|
2420
|
+
}
|
|
2421
|
+
/** `DELETE /v1/payments/own-account`: the status, and which projects moved back to Vibiz. */
|
|
2422
|
+
export interface OwnerStripeDisconnect extends OwnerStripe {
|
|
2423
|
+
moved: {
|
|
2424
|
+
project_id: string;
|
|
2425
|
+
name: string;
|
|
2426
|
+
}[];
|
|
2427
|
+
kept: {
|
|
2428
|
+
project_id: string;
|
|
2429
|
+
name: string;
|
|
2430
|
+
}[];
|
|
2431
|
+
}
|
|
2286
2432
|
export interface PaymentsAccount {
|
|
2287
2433
|
object: 'payments_account';
|
|
2288
2434
|
/** This object's page in the web console, absolute: give it to the person (docs: console-urls). */
|
|
@@ -2290,6 +2436,7 @@ export interface PaymentsAccount {
|
|
|
2290
2436
|
project_id: string;
|
|
2291
2437
|
environment: PaymentsEnvironment;
|
|
2292
2438
|
status: 'active' | 'frozen';
|
|
2439
|
+
/** The balance's currency: sales in another currency are added at what they settled for in USD. */
|
|
2293
2440
|
currency: 'usd';
|
|
2294
2441
|
/** Where new sales go; `balance` and withdrawing are Vibiz's (and money from before a switch). */
|
|
2295
2442
|
account: PaymentsAccountMode;
|
|
@@ -2336,23 +2483,66 @@ export interface PaymentsAccount {
|
|
|
2336
2483
|
has_secret: boolean;
|
|
2337
2484
|
events: WebhookEventType[];
|
|
2338
2485
|
};
|
|
2486
|
+
/** The checkout page's look for every checkout (`update({ brand })`); null: none set. */
|
|
2487
|
+
brand: CheckoutBrand | null;
|
|
2488
|
+
/** App Store and Google Play through the owner's own RevenueCat account (docs: app-store). */
|
|
2489
|
+
app_store?: {
|
|
2490
|
+
available: boolean;
|
|
2491
|
+
connected: boolean;
|
|
2492
|
+
set_up: boolean;
|
|
2493
|
+
ios_bundle_id: string | null;
|
|
2494
|
+
android_package: string | null;
|
|
2495
|
+
/** No Vibiz fee on store purchases: the store pays the owner. */
|
|
2496
|
+
note: string;
|
|
2497
|
+
};
|
|
2339
2498
|
created_at: string;
|
|
2340
2499
|
updated_at: string;
|
|
2341
2500
|
}
|
|
2501
|
+
/**
|
|
2502
|
+
* Lowercase ISO 4217 codes a project can sell in. Amounts are in the
|
|
2503
|
+
* currency's smallest unit (cents; whole units for jpy, krw and clp).
|
|
2504
|
+
*/
|
|
2505
|
+
export type PaymentCurrency = 'usd' | 'eur' | 'gbp' | 'cad' | 'aud' | 'nzd' | 'chf' | 'sek' | 'nok' | 'dkk' | 'pln' | 'czk' | 'huf' | 'ron' | 'bgn' | 'mxn' | 'brl' | 'cop' | 'clp' | 'pen' | 'ars' | 'jpy' | 'krw' | 'inr' | 'sgd' | 'hkd' | 'twd' | 'thb' | 'myr' | 'php' | 'idr' | 'zar' | 'aed' | 'ils' | 'try';
|
|
2506
|
+
export type CheckoutBrandFont = 'be_vietnam_pro' | 'bitter' | 'chakra_petch' | 'default' | 'hahmlet' | 'inconsolata' | 'inter' | 'lato' | 'lora' | 'm_plus_1_code' | 'montserrat' | 'noto_sans' | 'noto_sans_jp' | 'noto_serif' | 'nunito' | 'open_sans' | 'pridi' | 'pt_sans' | 'pt_serif' | 'raleway' | 'roboto' | 'roboto_slab' | 'source_sans_pro' | 'titillium_web' | 'ubuntu_mono' | 'zen_maru_gothic';
|
|
2507
|
+
/**
|
|
2508
|
+
* How the hosted checkout page looks. Any field left out comes from the
|
|
2509
|
+
* project's brand; through Vibiz the page always shows the project's name.
|
|
2510
|
+
*/
|
|
2511
|
+
export interface CheckoutBrand {
|
|
2512
|
+
/** At the top of the page, instead of the business name. */
|
|
2513
|
+
name?: string;
|
|
2514
|
+
/** https URLs (at most 2000 characters). With both, the logo shows and the icon is the tab's. */
|
|
2515
|
+
logo_url?: string;
|
|
2516
|
+
/** Square. */
|
|
2517
|
+
icon_url?: string;
|
|
2518
|
+
/** Hex, `#rrggbb` (or `#rgb`). */
|
|
2519
|
+
background_color?: string;
|
|
2520
|
+
button_color?: string;
|
|
2521
|
+
font?: CheckoutBrandFont;
|
|
2522
|
+
border_style?: 'pill' | 'rectangular' | 'rounded';
|
|
2523
|
+
}
|
|
2524
|
+
/** The project's brand as `payments.update` changes it: a field set to null is removed. */
|
|
2525
|
+
export type CheckoutBrandPatch = {
|
|
2526
|
+
[K in keyof CheckoutBrand]?: CheckoutBrand[K] | null;
|
|
2527
|
+
};
|
|
2342
2528
|
export interface PaymentPrice {
|
|
2343
2529
|
object: 'price';
|
|
2344
2530
|
id: string;
|
|
2345
2531
|
product_id: string;
|
|
2346
2532
|
active: boolean;
|
|
2533
|
+
/** In the smallest unit of `currency`. */
|
|
2347
2534
|
unit_amount_cents: number;
|
|
2348
|
-
currency:
|
|
2535
|
+
currency: PaymentCurrency;
|
|
2349
2536
|
type: 'one_time' | 'recurring';
|
|
2350
2537
|
interval: 'day' | 'week' | 'month' | 'year' | null;
|
|
2351
2538
|
interval_count: number | null;
|
|
2352
2539
|
lookup_key: string | null;
|
|
2353
2540
|
}
|
|
2354
2541
|
export interface PaymentPriceInput {
|
|
2542
|
+
/** In the smallest unit of `currency` (at least its minimum: 50 for usd and eur, 30 for gbp, ¥50…). */
|
|
2355
2543
|
unit_amount_cents: number;
|
|
2544
|
+
/** Left out: usd. Any case. */
|
|
2545
|
+
currency?: PaymentCurrency | (string & {});
|
|
2356
2546
|
type: 'one_time' | 'recurring';
|
|
2357
2547
|
interval?: 'day' | 'week' | 'month' | 'year';
|
|
2358
2548
|
interval_count?: number;
|
|
@@ -2370,14 +2560,19 @@ export interface PaymentProduct {
|
|
|
2370
2560
|
export interface CheckoutInput {
|
|
2371
2561
|
price_id?: string;
|
|
2372
2562
|
lookup_key?: string;
|
|
2563
|
+
/** An item priced here, in the smallest unit of `currency`, with `name`. */
|
|
2373
2564
|
amount_cents?: number;
|
|
2374
2565
|
name?: string;
|
|
2566
|
+
/** With `amount_cents` (left out: usd); a price sells in its own. */
|
|
2567
|
+
currency?: PaymentCurrency | (string & {});
|
|
2375
2568
|
quantity?: number;
|
|
2376
2569
|
user?: string;
|
|
2377
2570
|
customer_email?: string;
|
|
2378
2571
|
success_url: string;
|
|
2379
2572
|
cancel_url: string;
|
|
2380
2573
|
metadata?: Record<string, string>;
|
|
2574
|
+
/** The business's look on the page, over the project's brand field by field. */
|
|
2575
|
+
brand?: CheckoutBrand;
|
|
2381
2576
|
}
|
|
2382
2577
|
export interface Checkout {
|
|
2383
2578
|
object: 'checkout';
|
|
@@ -2391,11 +2586,19 @@ export interface Payment {
|
|
|
2391
2586
|
console_url?: string;
|
|
2392
2587
|
id: string;
|
|
2393
2588
|
status: 'succeeded' | 'refunded' | 'partially_refunded' | 'disputed' | 'failed';
|
|
2589
|
+
/** In `currency`, its smallest unit (as `refunded_cents` and the dispute's amount). */
|
|
2394
2590
|
amount_cents: number;
|
|
2395
2591
|
refunded_cents: number;
|
|
2592
|
+
/** Through Vibiz in another currency: in USD, the balance's (as `net_cents`). */
|
|
2396
2593
|
fee_cents: number;
|
|
2397
2594
|
net_cents: number;
|
|
2398
|
-
currency:
|
|
2595
|
+
currency: PaymentCurrency;
|
|
2596
|
+
/**
|
|
2597
|
+
* Through Vibiz: what the sale added to the balance before fees, in US cents
|
|
2598
|
+
* (converted at the processor's rate for another currency). Null on the
|
|
2599
|
+
* owner's own account, or before a sale in another currency settled.
|
|
2600
|
+
*/
|
|
2601
|
+
settled_usd_cents: number | null;
|
|
2399
2602
|
description: string | null;
|
|
2400
2603
|
user: string | null;
|
|
2401
2604
|
customer_email: string | null;
|
|
@@ -2426,12 +2629,124 @@ export interface PaymentSubscription {
|
|
|
2426
2629
|
user: string | null;
|
|
2427
2630
|
customer_email: string | null;
|
|
2428
2631
|
price_id: string | null;
|
|
2429
|
-
/** `own`: billed on the owner's own Stripe account. */
|
|
2632
|
+
/** `own`: billed on the owner's own Stripe account, or paid by a store. */
|
|
2430
2633
|
account: 'vibiz' | 'own';
|
|
2634
|
+
/** `web`: a checkout; `app_store` / `play_store`: bought in the app (the buyer cancels it in the store). */
|
|
2635
|
+
source?: 'web' | 'app_store' | 'play_store';
|
|
2636
|
+
/** Store purchases: `subscription` or a `one_time` unlock. */
|
|
2637
|
+
kind?: 'subscription' | 'one_time';
|
|
2638
|
+
store_product_id?: string | null;
|
|
2639
|
+
entitlements?: string[];
|
|
2431
2640
|
current_period_end: string | null;
|
|
2432
2641
|
cancel_at_period_end: boolean;
|
|
2433
2642
|
created_at: string;
|
|
2434
2643
|
}
|
|
2644
|
+
/** A key of the owner's own RevenueCat account: the project there it reaches (never the key). */
|
|
2645
|
+
export interface AppStoreConnection {
|
|
2646
|
+
object: 'app_store_connection';
|
|
2647
|
+
id: string;
|
|
2648
|
+
project: {
|
|
2649
|
+
id: string;
|
|
2650
|
+
name: string;
|
|
2651
|
+
};
|
|
2652
|
+
key_hint: string;
|
|
2653
|
+
connected_at: string;
|
|
2654
|
+
checked_at: string | null;
|
|
2655
|
+
problem: string | null;
|
|
2656
|
+
}
|
|
2657
|
+
/** A link for the owner to paste their RevenueCat secret key (in the console, never a chat). */
|
|
2658
|
+
export interface AppStoreConnectLink {
|
|
2659
|
+
object: 'app_store_connect_link';
|
|
2660
|
+
url: string;
|
|
2661
|
+
expires_at: string;
|
|
2662
|
+
connections: AppStoreConnection[];
|
|
2663
|
+
}
|
|
2664
|
+
export interface AppStoreAccount {
|
|
2665
|
+
object: 'app_store_account';
|
|
2666
|
+
available: boolean;
|
|
2667
|
+
connected: boolean;
|
|
2668
|
+
connections: AppStoreConnection[];
|
|
2669
|
+
projects: Array<{
|
|
2670
|
+
project_id: string;
|
|
2671
|
+
name: string;
|
|
2672
|
+
environment: PaymentsEnvironment;
|
|
2673
|
+
connection_id: string;
|
|
2674
|
+
ios_bundle_id: string | null;
|
|
2675
|
+
android_package: string | null;
|
|
2676
|
+
}>;
|
|
2677
|
+
fees_note: string;
|
|
2678
|
+
note: string;
|
|
2679
|
+
console_url: string;
|
|
2680
|
+
}
|
|
2681
|
+
export interface AppStoreProduct {
|
|
2682
|
+
price_id: string;
|
|
2683
|
+
lookup_key: string;
|
|
2684
|
+
entitlement: string;
|
|
2685
|
+
type: 'subscription' | 'non_consumable';
|
|
2686
|
+
/** Create it in App Store Connect with exactly this Product ID. */
|
|
2687
|
+
app_store_product_id: string | null;
|
|
2688
|
+
/** Play Console: `subscription:base-plan`, or a one-time product id. */
|
|
2689
|
+
play_product_id: string | null;
|
|
2690
|
+
/** The package in the default offering (`$rc_monthly`…). */
|
|
2691
|
+
package: string;
|
|
2692
|
+
}
|
|
2693
|
+
export interface AppStoreApp {
|
|
2694
|
+
store_project_id: string;
|
|
2695
|
+
ios: {
|
|
2696
|
+
bundle_id: string;
|
|
2697
|
+
/** The public SDK key: safe to ship in the app. */
|
|
2698
|
+
public_key: string | null;
|
|
2699
|
+
env_var: 'VIBIZ_REVENUECAT_IOS_KEY';
|
|
2700
|
+
store_credentials: boolean;
|
|
2701
|
+
} | null;
|
|
2702
|
+
android: {
|
|
2703
|
+
package: string;
|
|
2704
|
+
public_key: string | null;
|
|
2705
|
+
env_var: 'VIBIZ_REVENUECAT_ANDROID_KEY';
|
|
2706
|
+
store_credentials: boolean;
|
|
2707
|
+
} | null;
|
|
2708
|
+
products: AppStoreProduct[];
|
|
2709
|
+
entitlements: string[];
|
|
2710
|
+
offering: string | null;
|
|
2711
|
+
webhook: {
|
|
2712
|
+
url: string;
|
|
2713
|
+
registered: boolean;
|
|
2714
|
+
problem: string | null;
|
|
2715
|
+
last_event_at: string | null;
|
|
2716
|
+
};
|
|
2717
|
+
setup_at: string | null;
|
|
2718
|
+
}
|
|
2719
|
+
export interface AppStoreState {
|
|
2720
|
+
object: 'app_store';
|
|
2721
|
+
environment: PaymentsEnvironment;
|
|
2722
|
+
available: boolean;
|
|
2723
|
+
connected: boolean;
|
|
2724
|
+
connections: AppStoreConnection[];
|
|
2725
|
+
app: AppStoreApp | null;
|
|
2726
|
+
/** The steps left, each with where to do it. */
|
|
2727
|
+
next: string[];
|
|
2728
|
+
fees_note: string;
|
|
2729
|
+
console_url: string;
|
|
2730
|
+
}
|
|
2731
|
+
export interface AppStoreSetupInput {
|
|
2732
|
+
/** Xcode's bundle id (app.json ▸ ios.bundleIdentifier), e.g. `com.acme.bakery`. */
|
|
2733
|
+
ios_bundle_id?: string;
|
|
2734
|
+
android_package?: string;
|
|
2735
|
+
/** Which connected RevenueCat project, when the account has several. */
|
|
2736
|
+
store_project_id?: string;
|
|
2737
|
+
app_name?: string;
|
|
2738
|
+
}
|
|
2739
|
+
export interface AppStoreSetup extends AppStoreApp {
|
|
2740
|
+
object: 'app_store_setup';
|
|
2741
|
+
environment: PaymentsEnvironment;
|
|
2742
|
+
store_project: {
|
|
2743
|
+
id: string;
|
|
2744
|
+
name: string;
|
|
2745
|
+
};
|
|
2746
|
+
next: string[];
|
|
2747
|
+
fees_note: string;
|
|
2748
|
+
console_url: string;
|
|
2749
|
+
}
|
|
2435
2750
|
export interface Withdrawal {
|
|
2436
2751
|
object: 'withdrawal';
|
|
2437
2752
|
id: string;
|
|
@@ -2901,10 +3216,63 @@ export interface SocialAdCampaign {
|
|
|
2901
3216
|
clicks: number | null;
|
|
2902
3217
|
conversions: number | null;
|
|
2903
3218
|
}
|
|
2904
|
-
export
|
|
3219
|
+
export type SocialAdChangeKind = 'boost' | 'pause' | 'resume' | 'budget' | 'create_campaign';
|
|
3220
|
+
/**
|
|
3221
|
+
* A whole Google Ads campaign (docs/SOCIAL.md "Creating a Google Ads campaign"):
|
|
3222
|
+
* created PAUSED unless `start: 'active'`, so first spend is a `resume`.
|
|
3223
|
+
* Budgets and bids are MINOR UNITS (ISO 4217) of the ad account's currency: cents for USD, whole yen for JPY, fils for KWD. Ad spend is billed by
|
|
3224
|
+
* Google to the owner's ad account, never through Vibiz.
|
|
3225
|
+
*/
|
|
3226
|
+
export interface SocialCampaignCreateInput {
|
|
3227
|
+
account_id: string;
|
|
3228
|
+
ad_account_id: string;
|
|
3229
|
+
campaign_type: 'search' | 'display' | 'pmax';
|
|
3230
|
+
/** One line, at most 200 characters, unique in the ad account. */
|
|
3231
|
+
name: string;
|
|
3232
|
+
daily_budget_cents: number;
|
|
3233
|
+
/** An https page. */
|
|
3234
|
+
final_url: string;
|
|
3235
|
+
/** search 3–15, display exactly 1, pmax 3–15; each at most 30 characters, all different. */
|
|
3236
|
+
headlines: string[];
|
|
3237
|
+
/** search 2–4, display exactly 1, pmax 2–5; each at most 90 characters. */
|
|
3238
|
+
descriptions: string[];
|
|
3239
|
+
/** display (optional) and pmax (required): at most 90 characters. */
|
|
3240
|
+
long_headline?: string;
|
|
3241
|
+
/** display and pmax: at most 25 characters. */
|
|
3242
|
+
business_name?: string;
|
|
3243
|
+
/** search only, 1–1000: a string is broad match. */
|
|
3244
|
+
keywords?: Array<string | {
|
|
3245
|
+
text: string;
|
|
3246
|
+
match_type?: 'broad' | 'phrase' | 'exact';
|
|
3247
|
+
}>;
|
|
3248
|
+
negative_keywords?: string[];
|
|
3249
|
+
/** ISO 3166 codes such as `US`; at least one. */
|
|
3250
|
+
countries: string[];
|
|
3251
|
+
/** Google language codes such as `en`, `es`, `zh_CN`. */
|
|
3252
|
+
languages?: string[];
|
|
3253
|
+
/** `YYYY-MM-DD` in the ad account's time zone. */
|
|
3254
|
+
start_date?: string;
|
|
3255
|
+
end_date?: string | null;
|
|
3256
|
+
/** Required for search and display; pmax is always maximize_conversions. */
|
|
3257
|
+
bidding?: 'maximize_clicks' | 'maximize_conversions';
|
|
3258
|
+
/** maximize_clicks: the most to pay for one click (required with it). */
|
|
3259
|
+
max_cpc_cents?: number;
|
|
3260
|
+
/** maximize_conversions: a target cost per conversion. */
|
|
3261
|
+
target_cpa_cents?: number;
|
|
3262
|
+
/** display: one landscape (1.91:1) and one square (1:1); pmax: also a logo. URLs from `upload` or any https image. */
|
|
3263
|
+
images?: {
|
|
3264
|
+
landscape?: string[];
|
|
3265
|
+
square?: string[];
|
|
3266
|
+
logo?: string[];
|
|
3267
|
+
};
|
|
3268
|
+
/** Default `paused`. `active` starts spending once applied (pmax: paused only). */
|
|
3269
|
+
start?: 'paused' | 'active';
|
|
3270
|
+
confirm?: boolean;
|
|
3271
|
+
}
|
|
3272
|
+
export interface SocialAdChangeInput extends Partial<Omit<SocialCampaignCreateInput, 'account_id' | 'ad_account_id' | 'name'>> {
|
|
2905
3273
|
account_id: string;
|
|
2906
3274
|
ad_account_id: string;
|
|
2907
|
-
kind:
|
|
3275
|
+
kind: SocialAdChangeKind;
|
|
2908
3276
|
campaign_id?: string;
|
|
2909
3277
|
daily_budget_cents?: number;
|
|
2910
3278
|
post_id?: string;
|
|
@@ -2924,11 +3292,14 @@ export interface SocialAdChange {
|
|
|
2924
3292
|
environment: SocialEnvironment;
|
|
2925
3293
|
account_id: string;
|
|
2926
3294
|
ad_account_id: string;
|
|
2927
|
-
kind:
|
|
3295
|
+
kind: SocialAdChangeKind;
|
|
2928
3296
|
request: Record<string, unknown>;
|
|
2929
3297
|
status: 'pending_approval' | 'applying' | 'applied' | 'rejected' | 'failed';
|
|
3298
|
+
/** create_campaign also carries `ad_group_id` and `ad_id`. */
|
|
2930
3299
|
result: {
|
|
2931
3300
|
campaign_id: string | null;
|
|
3301
|
+
ad_group_id?: string | null;
|
|
3302
|
+
ad_id?: string | null;
|
|
2932
3303
|
} | null;
|
|
2933
3304
|
error: string | null;
|
|
2934
3305
|
requested_by: string | null;
|
|
@@ -3696,3 +4067,4 @@ export interface EmailPage<T> {
|
|
|
3696
4067
|
has_more: boolean;
|
|
3697
4068
|
next_cursor: string | null;
|
|
3698
4069
|
}
|
|
4070
|
+
export {};
|