@vibiz/cli 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -378,6 +378,11 @@ var Vibiz = class {
|
|
|
378
378
|
method: "POST",
|
|
379
379
|
body: input
|
|
380
380
|
}),
|
|
381
|
+
/** A Google Ads campaign, paused by default: an `ad_change` of kind `create_campaign`. */
|
|
382
|
+
createCampaign: (id, input, env) => this.request(`/projects/${id}/social/ads/changes${envQuery(env)}`, {
|
|
383
|
+
method: "POST",
|
|
384
|
+
body: { ...input, kind: "create_campaign" }
|
|
385
|
+
}),
|
|
381
386
|
approveAdChange: (id, changeId, env) => this.request(
|
|
382
387
|
`/projects/${id}/social/ads/changes/${encodeURIComponent(changeId)}/approve${envQuery(env)}`,
|
|
383
388
|
{ method: "POST", body: {} }
|
|
@@ -496,7 +501,27 @@ var Vibiz = class {
|
|
|
496
501
|
}),
|
|
497
502
|
disconnect: (id, env) => this.request(`/projects/${id}/payments/own-account${envQuery(env)}`, {
|
|
498
503
|
method: "DELETE"
|
|
499
|
-
})
|
|
504
|
+
}),
|
|
505
|
+
/** Back on the Stripe connected once for every project (owner in production). */
|
|
506
|
+
useAccount: (id, env) => this.request(
|
|
507
|
+
`/projects/${id}/payments/own-account/use-account${envQuery(env)}`,
|
|
508
|
+
{ method: "POST", body: {} }
|
|
509
|
+
)
|
|
510
|
+
},
|
|
511
|
+
/**
|
|
512
|
+
* App Store and Google Play through the owner's own RevenueCat account
|
|
513
|
+
* (docs: app-store). `setup` creates the app there, mirrors the catalog
|
|
514
|
+
* and answers the public SDK key and the owner's checklist; re-running converges.
|
|
515
|
+
*/
|
|
516
|
+
appStore: {
|
|
517
|
+
get: (id, env) => this.request(`/projects/${id}/payments/app-store${envQuery(env)}`),
|
|
518
|
+
setup: (id, input, env) => this.request(`/projects/${id}/payments/app-store/setup${envQuery(env)}`, {
|
|
519
|
+
method: "POST",
|
|
520
|
+
body: input
|
|
521
|
+
}),
|
|
522
|
+
subscriptions: (id, opts = {}) => this.request(
|
|
523
|
+
`/projects/${id}/payments/app-store/subscriptions${paymentsQuery(opts)}`
|
|
524
|
+
)
|
|
500
525
|
}
|
|
501
526
|
},
|
|
502
527
|
/**
|
|
@@ -790,6 +815,27 @@ var Vibiz = class {
|
|
|
790
815
|
`/replays/${id}/events${qs2 ? `?${qs2}` : ""}`
|
|
791
816
|
);
|
|
792
817
|
},
|
|
818
|
+
/**
|
|
819
|
+
* Still pictures of what the visitor saw at the moments that matter (each
|
|
820
|
+
* page, error, rage and dead click, abandoned form, and the end), or at
|
|
821
|
+
* one instant (`at`, ms from the start). Look at them for broken layout.
|
|
822
|
+
* Each new picture is one metered page screenshot; ones taken before are free.
|
|
823
|
+
*/
|
|
824
|
+
frames: (id, opts = {}) => {
|
|
825
|
+
const q = new URLSearchParams();
|
|
826
|
+
if (opts.moments?.length) q.set("moments", opts.moments.join(","));
|
|
827
|
+
if (opts.limit !== void 0) q.set("limit", String(opts.limit));
|
|
828
|
+
if (opts.at !== void 0) q.set("at", String(Math.round(opts.at)));
|
|
829
|
+
if (opts.pointer === false) q.set("pointer", "false");
|
|
830
|
+
const qs2 = q.toString();
|
|
831
|
+
return this.request(`/replays/${id}/frames${qs2 ? `?${qs2}` : ""}`);
|
|
832
|
+
},
|
|
833
|
+
/** A frame's PNG from its signed `image.url` (no key sent). */
|
|
834
|
+
frameImage: async (url) => {
|
|
835
|
+
const res = await this.fetchImpl(url);
|
|
836
|
+
if (!res.ok) return this.fail(res);
|
|
837
|
+
return new Uint8Array(await res.arrayBuffer());
|
|
838
|
+
},
|
|
793
839
|
/** A link to the hosted player for a person, valid for `expires_in` seconds (default 1 h, max 24 h). */
|
|
794
840
|
share: (id, opts = {}) => this.request(`/replays/${id}/share`, {
|
|
795
841
|
method: "POST",
|
|
@@ -1334,6 +1380,41 @@ var Vibiz = class {
|
|
|
1334
1380
|
),
|
|
1335
1381
|
charges: (opts = {}) => this.request(`/billing/charges${qs(opts)}`)
|
|
1336
1382
|
};
|
|
1383
|
+
/**
|
|
1384
|
+
* Payments across the account (docs/PAYMENTS.md "One Stripe for every
|
|
1385
|
+
* project"): the owner's Stripe connected once and used by every project.
|
|
1386
|
+
* `link` (any key) is for the owner to complete; `update`, `apply` (in
|
|
1387
|
+
* production) and `disconnect` are the owner's.
|
|
1388
|
+
*/
|
|
1389
|
+
payments = {
|
|
1390
|
+
ownAccount: {
|
|
1391
|
+
get: () => this.request("/payments/own-account"),
|
|
1392
|
+
link: (env = "production") => this.request(`/payments/own-account/link?env=${env}`, {
|
|
1393
|
+
method: "POST",
|
|
1394
|
+
body: {}
|
|
1395
|
+
}),
|
|
1396
|
+
update: (input) => this.request("/payments/own-account", { method: "POST", body: input }),
|
|
1397
|
+
apply: (input = {}) => this.request("/payments/own-account/apply", {
|
|
1398
|
+
method: "POST",
|
|
1399
|
+
body: input
|
|
1400
|
+
}),
|
|
1401
|
+
disconnect: (env = "production") => this.request(`/payments/own-account?env=${env}`, {
|
|
1402
|
+
method: "DELETE"
|
|
1403
|
+
})
|
|
1404
|
+
},
|
|
1405
|
+
/**
|
|
1406
|
+
* The owner's own RevenueCat account (docs: app-store), connected once.
|
|
1407
|
+
* `link` (any key) is for the owner: they paste the secret key on that page.
|
|
1408
|
+
*/
|
|
1409
|
+
appStore: {
|
|
1410
|
+
get: () => this.request("/payments/app-store"),
|
|
1411
|
+
link: () => this.request("/payments/app-store/link", { method: "POST", body: {} }),
|
|
1412
|
+
disconnect: (connectionId) => this.request(
|
|
1413
|
+
`/payments/app-store/connections/${encodeURIComponent(connectionId)}`,
|
|
1414
|
+
{ method: "DELETE" }
|
|
1415
|
+
)
|
|
1416
|
+
}
|
|
1417
|
+
};
|
|
1337
1418
|
/** Request counts, error rate and latency by capability. */
|
|
1338
1419
|
metrics = {
|
|
1339
1420
|
get: (opts = {}) => this.request(`/metrics?period=${opts.period ?? "30d"}`)
|
|
@@ -1730,9 +1811,42 @@ function formatUnits(units) {
|
|
|
1730
1811
|
}
|
|
1731
1812
|
return parts.join(" \xB7 ") || "\u2013";
|
|
1732
1813
|
}
|
|
1814
|
+
var EXPONENTS = {
|
|
1815
|
+
bif: 0,
|
|
1816
|
+
clp: 0,
|
|
1817
|
+
djf: 0,
|
|
1818
|
+
gnf: 0,
|
|
1819
|
+
isk: 0,
|
|
1820
|
+
jpy: 0,
|
|
1821
|
+
kmf: 0,
|
|
1822
|
+
krw: 0,
|
|
1823
|
+
pyg: 0,
|
|
1824
|
+
rwf: 0,
|
|
1825
|
+
ugx: 0,
|
|
1826
|
+
uyi: 0,
|
|
1827
|
+
vnd: 0,
|
|
1828
|
+
vuv: 0,
|
|
1829
|
+
xaf: 0,
|
|
1830
|
+
xof: 0,
|
|
1831
|
+
xpf: 0,
|
|
1832
|
+
bhd: 3,
|
|
1833
|
+
iqd: 3,
|
|
1834
|
+
jod: 3,
|
|
1835
|
+
kwd: 3,
|
|
1836
|
+
lyd: 3,
|
|
1837
|
+
omr: 3,
|
|
1838
|
+
tnd: 3,
|
|
1839
|
+
clf: 4,
|
|
1840
|
+
uyw: 4
|
|
1841
|
+
};
|
|
1842
|
+
function formatMinor(minor, currency) {
|
|
1843
|
+
if (minor === null || minor === void 0) return "\u2013";
|
|
1844
|
+
const exp = currency ? EXPONENTS[currency.toLowerCase()] ?? 2 : 2;
|
|
1845
|
+
return `${(minor / 10 ** exp).toFixed(exp)}${currency ? ` ${currency.toUpperCase()}` : ""}`;
|
|
1846
|
+
}
|
|
1733
1847
|
|
|
1734
1848
|
// packages/sdk/src/one-key.ts
|
|
1735
|
-
var APP_SDK_VERSION = "0.
|
|
1849
|
+
var APP_SDK_VERSION = "0.3.0";
|
|
1736
1850
|
var ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social, phone and connectors";
|
|
1737
1851
|
function oneKeyMessage(url, host) {
|
|
1738
1852
|
const where = host ?? "your host";
|
|
@@ -1753,6 +1867,7 @@ export {
|
|
|
1753
1867
|
writeEnvFile,
|
|
1754
1868
|
formatUsd,
|
|
1755
1869
|
formatUnits,
|
|
1870
|
+
formatMinor,
|
|
1756
1871
|
APP_SDK_VERSION,
|
|
1757
1872
|
ONE_KEY_GIVES,
|
|
1758
1873
|
oneKeyMessage,
|