@vibiz/sdk 0.2.3 → 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.
package/dist/types.d.ts CHANGED
@@ -505,11 +505,107 @@ export interface Deployment {
505
505
  status: DeploymentStatus;
506
506
  url: string | null;
507
507
  error: string | null;
508
+ /** What this deploy said it changed, for the version history. */
509
+ message: string | null;
508
510
  file_count: number;
509
511
  promoted_from: string | null;
510
512
  created_at: string;
511
513
  ready_at: string | null;
512
514
  }
515
+ /** One deploy in a project's version history, with what it changed. */
516
+ export interface Version {
517
+ id: string;
518
+ object: 'version';
519
+ project_id: string;
520
+ /** What the deploy said it changed, or null. */
521
+ message: string | null;
522
+ /** The message, or a summary from the diff ("3 files changed"). */
523
+ summary: string;
524
+ /** The name of the key that deployed it. */
525
+ who: string | null;
526
+ created_at: string;
527
+ ready_at: string | null;
528
+ target: 'preview' | 'production';
529
+ status: DeploymentStatus;
530
+ live: boolean;
531
+ url: string | null;
532
+ error: string | null;
533
+ promoted_from: string | null;
534
+ /** The version the file counts are against: the newest working one before it. */
535
+ compared_to: string | null;
536
+ files: {
537
+ total: number;
538
+ added: number;
539
+ updated: number;
540
+ deleted: number;
541
+ };
542
+ console_url?: string;
543
+ }
544
+ /** `GET /v1/projects/:id/versions`. */
545
+ export interface VersionList {
546
+ object: 'list';
547
+ data: Version[];
548
+ has_more: boolean;
549
+ next_cursor: string | null;
550
+ console_url?: string;
551
+ }
552
+ /** One changed file of a comparison. */
553
+ export interface VersionDiffFile {
554
+ path: string;
555
+ change: 'added' | 'updated' | 'deleted';
556
+ size_before: number | null;
557
+ size_after: number | null;
558
+ binary?: true;
559
+ /** Unified diff hunks; null when not shown, and `note` says why. */
560
+ diff: string | null;
561
+ note?: string;
562
+ }
563
+ /** `GET /v1/projects/:id/versions/diff`. */
564
+ export interface VersionDiff {
565
+ object: 'version_diff';
566
+ project_id: string;
567
+ from: {
568
+ id: string;
569
+ created_at: string;
570
+ } | null;
571
+ to: {
572
+ id: string;
573
+ created_at: string;
574
+ };
575
+ summary: string;
576
+ counts: {
577
+ added: number;
578
+ updated: number;
579
+ deleted: number;
580
+ };
581
+ files: VersionDiffFile[];
582
+ truncated: boolean;
583
+ note?: string;
584
+ /** Files whose contents neither we nor the host have any more, with why. */
585
+ unavailable: {
586
+ path: string;
587
+ version: string;
588
+ reason: string;
589
+ }[];
590
+ next_step?: string;
591
+ console_url?: string;
592
+ }
593
+ /** `POST /v1/projects/:id/versions/:version/restore`. */
594
+ export interface VersionRestore {
595
+ object: 'version_restore';
596
+ version: string;
597
+ /** The version itself (instant), or the new deployment rebuilding it. */
598
+ deployment: Deployment;
599
+ operation: Operation | null;
600
+ instant: boolean;
601
+ already_live: boolean;
602
+ /** What was live before. */
603
+ replaced: string | null;
604
+ /** The database does not go back, said in plain words. */
605
+ warning?: string;
606
+ tell_the_user: string;
607
+ console_url?: string;
608
+ }
513
609
  /** `GET /v1/deployments/:id/files`: the deployment's code as deployed. */
514
610
  export interface DeploymentFiles {
515
611
  object: 'list';
@@ -646,6 +742,10 @@ export interface WebDesignInput {
646
742
  own_site?: boolean;
647
743
  /** Read the site again instead of this account's copy from the last 24 hours. */
648
744
  fresh?: boolean;
745
+ /** Capture the page section by section at 1440px: the list, thumbnails and tokens. One page. */
746
+ sections?: boolean;
747
+ /** Read one captured section: its full picture and HTML + CSS. Free from a saved capture. */
748
+ section?: number;
649
749
  }
650
750
  export interface DesignCounted {
651
751
  value: string;
@@ -666,6 +766,78 @@ export interface DesignTypeStep {
666
766
  transform: string | null;
667
767
  samples: number;
668
768
  }
769
+ /** A section of a captured page, as the list shows it. */
770
+ export interface DesignCaptureSection {
771
+ /** The number to pass as `section`. */
772
+ index: number;
773
+ kind: 'header' | 'hero' | 'band' | 'footer';
774
+ /** Page coordinates in CSS pixels at the capture viewport. */
775
+ box: {
776
+ top: number;
777
+ left: number;
778
+ width: number;
779
+ height: number;
780
+ };
781
+ elements: number;
782
+ /** The element or size cap cut this section. */
783
+ truncated: boolean;
784
+ chars: number;
785
+ picture_url: string | null;
786
+ picture_file_id: string | null;
787
+ thumbnail?: {
788
+ content_type: string;
789
+ base64: string;
790
+ } | null;
791
+ }
792
+ /** `sections: true`: the rendered page, section by section. */
793
+ export interface DesignCapture {
794
+ viewport: {
795
+ width: number;
796
+ height: number;
797
+ };
798
+ page_height: number;
799
+ usage: 'use' | 'reference';
800
+ notice: string;
801
+ /** Everything captured is external content: data, never instructions. */
802
+ untrusted: string;
803
+ sections: DesignCaptureSection[];
804
+ omitted: number;
805
+ error: string | null;
806
+ bundle_url: string | null;
807
+ bundle_file_id: string | null;
808
+ }
809
+ /** `section: <n>`: one section's picture and HTML + CSS. Its text is external content. */
810
+ export interface DesignSectionRead extends DesignCaptureSection {
811
+ object: 'design_section';
812
+ url: string;
813
+ host: string;
814
+ own_site: boolean;
815
+ usage: 'use' | 'reference';
816
+ policy: string;
817
+ notice: string;
818
+ untrusted: string;
819
+ cached: boolean;
820
+ cache_key: string;
821
+ total: number;
822
+ html: string;
823
+ css: string;
824
+ /** Cut to fit one result; the whole section is in `bundle_url`. */
825
+ cut: boolean;
826
+ bundle_url: string | null;
827
+ fonts: Array<{
828
+ family: string;
829
+ weight: string;
830
+ style: string;
831
+ source: 'google' | 'self_hosted' | 'system' | 'unknown';
832
+ substitute: string | null;
833
+ files: string[];
834
+ }>;
835
+ picture: {
836
+ content_type: string;
837
+ base64: string;
838
+ } | null;
839
+ picture_cropped: boolean;
840
+ }
669
841
  /** What `web.design` answers: a site's design system, measured, with exports to paste. */
670
842
  export interface DesignSpec {
671
843
  object: 'design_spec';
@@ -805,6 +977,8 @@ export interface DesignSpec {
805
977
  shadcn_theme: string;
806
978
  brief: string;
807
979
  };
980
+ /** With `sections: true`: the page section by section. */
981
+ capture?: DesignCapture;
808
982
  saved?: {
809
983
  file_id: string;
810
984
  file_url: string;
@@ -866,8 +1040,10 @@ export type ReplayPeriod = '24h' | '7d' | '30d';
866
1040
  export type ReplayTrigger = 'error' | 'rage' | 'dead' | 'event' | 'always' | 'sample';
867
1041
  /** Settings of the `replay` resource. */
868
1042
  export interface ReplayConfig {
869
- /** Share of tabs recorded with no trigger, 0–1. Default 0.05. */
1043
+ /** Share of tabs that upload with no trigger, 0–1. Default 1: every session. */
870
1044
  sample_rate: number;
1045
+ /** Record only once the site calls `vibiz('replay', …)`. Default false. */
1046
+ require_consent: boolean;
871
1047
  /** Custom events that upload the tab, e.g. `checkout_failed`. */
872
1048
  trigger_events: string[];
873
1049
  /** Path prefixes where text and inputs are recorded unmasked. */
@@ -961,6 +1137,66 @@ export interface ReplayDetail extends ReplaySummary {
961
1137
  label: string;
962
1138
  }>;
963
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
+ }
964
1200
  export interface ReplayInsight {
965
1201
  kind: 'error' | 'rage_click' | 'dead_click' | 'form_abandoned';
966
1202
  severity: number;
@@ -1347,9 +1583,13 @@ export interface UsageRow {
1347
1583
  }
1348
1584
  export interface UsageLimits {
1349
1585
  resets_at: string;
1586
+ /** The ONE answer to how many projects this account may have (its plan, or its own limit). */
1350
1587
  projects: {
1588
+ plan: string;
1589
+ plan_label: string;
1351
1590
  used: number;
1352
1591
  limit: number;
1592
+ custom_limit: number | null;
1353
1593
  };
1354
1594
  daily_spend: {
1355
1595
  spent_usd: number;
@@ -1814,7 +2054,265 @@ export interface AdminMetrics {
1814
2054
  }
1815
2055
  /** Payments (docs/PAYMENTS.md): Vibiz is the merchant; each project a balance. */
1816
2056
  export type PaymentsEnvironment = 'production' | 'development';
1817
- export type WebhookEventType = 'payment.succeeded' | 'payment.refunded' | 'payment.failed' | 'subscription.created' | 'subscription.updated' | 'subscription.canceled' | 'invoice.paid' | 'invoice.payment_failed' | 'dispute.created' | 'dispute.closed' | 'withdrawal.paid' | 'withdrawal.failed';
2057
+ export type WebhookEventType = 'payment.succeeded' | 'payment.refunded' | 'payment.failed' | 'subscription.created' | 'subscription.updated' | 'subscription.canceled' | 'invoice.paid' | 'invoice.payment_failed' | 'dispute.created' | 'dispute.closed' | 'withdrawal.paid' | 'withdrawal.failed' | 'phone.message.received' | 'phone.call.completed';
2058
+ /** Phone numbers (docs: phone): US numbers, texts, and calls: a message, or a voice agent. */
2059
+ export type PhoneSendingStatus = 'registration_required' | 'verification_required' | 'pending_review' | 'approved' | 'rejected';
2060
+ export interface PhoneOffer {
2061
+ object: 'phone_offer';
2062
+ number: string;
2063
+ type: 'local' | 'toll_free';
2064
+ region: string | null;
2065
+ city: string | null;
2066
+ price_cents: number;
2067
+ monthly_price_cents: number;
2068
+ buy_url: string;
2069
+ }
2070
+ export interface PhoneSearch {
2071
+ object: 'phone_search';
2072
+ currency: 'usd';
2073
+ data: PhoneOffer[];
2074
+ /** What sending from such a number takes. */
2075
+ sending: string;
2076
+ console_url: string;
2077
+ next_step: string;
2078
+ }
2079
+ export interface PhoneQuote {
2080
+ object: 'phone_quote';
2081
+ number: string;
2082
+ type: 'local' | 'toll_free';
2083
+ region: string | null;
2084
+ city: string | null;
2085
+ currency: 'usd';
2086
+ price_cents: number;
2087
+ monthly_price_cents: number;
2088
+ text_price_usd: number;
2089
+ inbound_text_price_usd: number;
2090
+ paid_by: 'credits' | 'vibiz';
2091
+ balance_cents: number | null;
2092
+ balance_after_cents: number | null;
2093
+ enough_credits: boolean;
2094
+ sending: string;
2095
+ buy_url: string;
2096
+ can_buy: boolean;
2097
+ next_step: string;
2098
+ }
2099
+ export interface PhoneNumber {
2100
+ object: 'phone_number';
2101
+ id: string;
2102
+ number: string;
2103
+ type: 'local' | 'toll_free';
2104
+ region: string | null;
2105
+ city: string | null;
2106
+ status: 'ordering' | 'active' | 'past_due' | 'released' | 'failed';
2107
+ /** Only `approved` can send. Receiving and calling need none of it. */
2108
+ sending_status: PhoneSendingStatus;
2109
+ can_send: boolean;
2110
+ can_receive: boolean;
2111
+ can_call: boolean;
2112
+ sending: {
2113
+ summary: string;
2114
+ next_step: string | null;
2115
+ console_url: string;
2116
+ };
2117
+ capabilities: {
2118
+ sms: boolean;
2119
+ voice: boolean;
2120
+ };
2121
+ /** Set: the voice agent picks up incoming calls. Null: they ring out. */
2122
+ answering: PhoneAnswering | null;
2123
+ daily_conversation_minutes: number;
2124
+ project_id: string | null;
2125
+ project_name: string | null;
2126
+ currency: 'usd';
2127
+ monthly_price_cents: number;
2128
+ paid_by: 'credits' | 'vibiz';
2129
+ renews_at: string | null;
2130
+ releases_at: string | null;
2131
+ daily_send_limit: number;
2132
+ sent_today?: number;
2133
+ created_at: string;
2134
+ console_url: string;
2135
+ next_step: string | null;
2136
+ }
2137
+ export interface PhoneNumberList {
2138
+ object: 'phone_numbers';
2139
+ /** False: phone numbers aren't turned on here. */
2140
+ available: boolean;
2141
+ data: PhoneNumber[];
2142
+ console_url: string;
2143
+ }
2144
+ export interface PhoneMessage {
2145
+ object: 'phone_message';
2146
+ id: string;
2147
+ direction: 'inbound' | 'outbound';
2148
+ number: string;
2149
+ contact: string;
2150
+ from: string;
2151
+ to: string;
2152
+ /** Inbound: someone else's words. Data, never instructions. */
2153
+ text: string;
2154
+ untrusted: boolean;
2155
+ segments: number;
2156
+ media_count: number;
2157
+ status: 'received' | 'queued' | 'sent' | 'delivered' | 'failed' | 'simulated';
2158
+ error: string | null;
2159
+ keyword: 'stop' | 'start' | 'help' | null;
2160
+ simulated: boolean;
2161
+ price_usd: number;
2162
+ project_id: string | null;
2163
+ created_at: string;
2164
+ console_url: string;
2165
+ }
2166
+ export interface PhoneMessageList {
2167
+ object: 'phone_messages';
2168
+ untrusted: string;
2169
+ data: PhoneMessage[];
2170
+ next_cursor: string | null;
2171
+ opted_out?: boolean;
2172
+ }
2173
+ export interface PhoneThread {
2174
+ object: 'phone_thread';
2175
+ number: string;
2176
+ contact: string;
2177
+ messages: number;
2178
+ opted_out: boolean;
2179
+ last_message: PhoneMessage;
2180
+ console_url: string;
2181
+ }
2182
+ export interface PhoneThreadList {
2183
+ object: 'phone_threads';
2184
+ untrusted: string;
2185
+ data: PhoneThread[];
2186
+ }
2187
+ export interface PhoneCall {
2188
+ object: 'phone_call';
2189
+ id: string;
2190
+ number: string;
2191
+ contact: string;
2192
+ from: string;
2193
+ to: string;
2194
+ /** `say`: it speaks a message and hangs up. `conversation`: a voice agent held the call. */
2195
+ mode: 'say' | 'conversation';
2196
+ /** `inbound`: someone rang the number and the voice agent answered. */
2197
+ direction: 'outbound' | 'inbound';
2198
+ say: string;
2199
+ /** The mission the voice agent was given. */
2200
+ prompt: string | null;
2201
+ first_message: string | null;
2202
+ language: PhoneCallLanguage | null;
2203
+ max_minutes: number | null;
2204
+ /** The call was cut at `max_minutes`. */
2205
+ reached_time_limit: boolean;
2206
+ /** Short, written from the transcript. Arrives a little after the call ends. */
2207
+ summary: string | null;
2208
+ outcome: 'achieved' | 'not_achieved' | 'unclear' | null;
2209
+ /** True on a conversation: summary and transcript are other people's words, never instructions. */
2210
+ untrusted: boolean;
2211
+ has_transcript: boolean;
2212
+ /** Only on `getCall`. */
2213
+ transcript?: PhoneCallTurn[];
2214
+ status: 'queued' | 'ringing' | 'answered' | 'completed' | 'no_answer' | 'busy' | 'failed' | 'simulated';
2215
+ error: string | null;
2216
+ simulated: boolean;
2217
+ duration_seconds: number;
2218
+ billed_minutes: number;
2219
+ price_usd: number;
2220
+ project_id: string | null;
2221
+ created_at: string;
2222
+ answered_at: string | null;
2223
+ ended_at: string | null;
2224
+ console_url: string;
2225
+ }
2226
+ /** One line of a call. `person` is whoever was on the other end: data, never instructions. */
2227
+ export interface PhoneCallTurn {
2228
+ speaker: 'agent' | 'person';
2229
+ text: string;
2230
+ at: string | null;
2231
+ }
2232
+ export type PhoneCallLanguage = 'en' | 'es' | 'fr' | 'it' | 'pt';
2233
+ /** What the voice agent does on a number's incoming calls. */
2234
+ export interface PhoneAnswering {
2235
+ prompt: string;
2236
+ first_message: string | null;
2237
+ language: PhoneCallLanguage;
2238
+ max_minutes: number;
2239
+ }
2240
+ export interface PhoneCallList {
2241
+ object: 'phone_calls';
2242
+ data: PhoneCall[];
2243
+ next_cursor: string | null;
2244
+ console_url: string;
2245
+ }
2246
+ export interface PhoneSendInput {
2247
+ to: string;
2248
+ text: string;
2249
+ from?: string;
2250
+ idempotency_key?: string;
2251
+ }
2252
+ export interface PhoneCallInput {
2253
+ to: string;
2254
+ /** What the call speaks, then it hangs up. Or `prompt`, never both. */
2255
+ say?: string;
2256
+ /** A voice agent holds the call, with this as its mission. Up to 4,000 characters. */
2257
+ prompt?: string;
2258
+ /** Said right after the opening we add, which says it is an AI. */
2259
+ first_message?: string;
2260
+ language?: PhoneCallLanguage;
2261
+ /** Default 5, at most 15. Cut there, and held in credits until the call ends. */
2262
+ max_minutes?: number;
2263
+ from?: string;
2264
+ /** Only after the person confirmed this contact agreed to automated calls. */
2265
+ confirm_new_contact?: boolean;
2266
+ idempotency_key?: string;
2267
+ }
2268
+ /** `prompt: null` stops answering: calls ring out again. */
2269
+ export interface PhoneAnsweringInput {
2270
+ prompt: string | null;
2271
+ first_message?: string;
2272
+ language?: PhoneCallLanguage;
2273
+ /** Default 5, at most 15. */
2274
+ max_minutes?: number;
2275
+ }
2276
+ export interface PhoneRegistrationInput {
2277
+ kind: 'business' | 'sole_proprietor' | 'toll_free';
2278
+ legal_name: string;
2279
+ brand_name: string;
2280
+ tax_id?: string;
2281
+ website: string;
2282
+ address: {
2283
+ street: string;
2284
+ city: string;
2285
+ state: string;
2286
+ zip: string;
2287
+ };
2288
+ contact_name: string;
2289
+ contact_email: string;
2290
+ contact_phone: string;
2291
+ mobile_phone?: string;
2292
+ use_case: 'account_notifications' | 'customer_care' | 'delivery_notifications' | 'security_codes' | 'marketing' | 'mixed';
2293
+ description: string;
2294
+ sample_messages: string[];
2295
+ opt_in: string;
2296
+ opt_in_url?: string;
2297
+ monthly_volume?: number;
2298
+ expected_fee_cents: number;
2299
+ }
2300
+ export interface PhoneRegistrationRequirements {
2301
+ object: 'phone_registration_requirements';
2302
+ number: string;
2303
+ sending_status: PhoneSendingStatus;
2304
+ kinds: Array<{
2305
+ kind: PhoneRegistrationInput['kind'];
2306
+ fee_cents: number;
2307
+ carrier_monthly_cents: number;
2308
+ needs_tax_id: boolean;
2309
+ needs_mobile_phone: boolean;
2310
+ }>;
2311
+ required: string[];
2312
+ use_cases: string[];
2313
+ rules: string[];
2314
+ console_url: string;
2315
+ }
1818
2316
  /**
1819
2317
  * Where a project's sales go (docs/PAYMENTS.md "Your own account"): through
1820
2318
  * Vibiz (the default: a balance here, then withdrawing), or the owner's own
@@ -1826,12 +2324,19 @@ export interface PaymentsAccountMode {
1826
2324
  /** Whether owners can connect their own account here right now. */
1827
2325
  available: boolean;
1828
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;
1829
2331
  account_name: string | null;
1830
2332
  livemode: boolean | null;
1831
2333
  connected_at: string | null;
1832
- /** The last connection's end, while not connected: `owner` here, `deauthorized` from their dashboard. */
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
+ */
1833
2338
  disconnected_at: string | null;
1834
- disconnect_reason: 'owner' | 'deauthorized' | null;
2339
+ disconnect_reason: 'owner' | 'deauthorized' | 'account' | null;
1835
2340
  };
1836
2341
  /** What to do about it, in a sentence an agent can act on. */
1837
2342
  note: string;
@@ -1845,6 +2350,85 @@ export interface OwnAccountLink {
1845
2350
  expires_at: string;
1846
2351
  account: PaymentsAccountMode;
1847
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
+ }
1848
2432
  export interface PaymentsAccount {
1849
2433
  object: 'payments_account';
1850
2434
  /** This object's page in the web console, absolute: give it to the person (docs: console-urls). */
@@ -1852,6 +2436,7 @@ export interface PaymentsAccount {
1852
2436
  project_id: string;
1853
2437
  environment: PaymentsEnvironment;
1854
2438
  status: 'active' | 'frozen';
2439
+ /** The balance's currency: sales in another currency are added at what they settled for in USD. */
1855
2440
  currency: 'usd';
1856
2441
  /** Where new sales go; `balance` and withdrawing are Vibiz's (and money from before a switch). */
1857
2442
  account: PaymentsAccountMode;
@@ -1898,23 +2483,66 @@ export interface PaymentsAccount {
1898
2483
  has_secret: boolean;
1899
2484
  events: WebhookEventType[];
1900
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
+ };
1901
2498
  created_at: string;
1902
2499
  updated_at: string;
1903
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
+ };
1904
2528
  export interface PaymentPrice {
1905
2529
  object: 'price';
1906
2530
  id: string;
1907
2531
  product_id: string;
1908
2532
  active: boolean;
2533
+ /** In the smallest unit of `currency`. */
1909
2534
  unit_amount_cents: number;
1910
- currency: 'usd';
2535
+ currency: PaymentCurrency;
1911
2536
  type: 'one_time' | 'recurring';
1912
2537
  interval: 'day' | 'week' | 'month' | 'year' | null;
1913
2538
  interval_count: number | null;
1914
2539
  lookup_key: string | null;
1915
2540
  }
1916
2541
  export interface PaymentPriceInput {
2542
+ /** In the smallest unit of `currency` (at least its minimum: 50 for usd and eur, 30 for gbp, ¥50…). */
1917
2543
  unit_amount_cents: number;
2544
+ /** Left out: usd. Any case. */
2545
+ currency?: PaymentCurrency | (string & {});
1918
2546
  type: 'one_time' | 'recurring';
1919
2547
  interval?: 'day' | 'week' | 'month' | 'year';
1920
2548
  interval_count?: number;
@@ -1932,14 +2560,19 @@ export interface PaymentProduct {
1932
2560
  export interface CheckoutInput {
1933
2561
  price_id?: string;
1934
2562
  lookup_key?: string;
2563
+ /** An item priced here, in the smallest unit of `currency`, with `name`. */
1935
2564
  amount_cents?: number;
1936
2565
  name?: string;
2566
+ /** With `amount_cents` (left out: usd); a price sells in its own. */
2567
+ currency?: PaymentCurrency | (string & {});
1937
2568
  quantity?: number;
1938
2569
  user?: string;
1939
2570
  customer_email?: string;
1940
2571
  success_url: string;
1941
2572
  cancel_url: string;
1942
2573
  metadata?: Record<string, string>;
2574
+ /** The business's look on the page, over the project's brand field by field. */
2575
+ brand?: CheckoutBrand;
1943
2576
  }
1944
2577
  export interface Checkout {
1945
2578
  object: 'checkout';
@@ -1953,11 +2586,19 @@ export interface Payment {
1953
2586
  console_url?: string;
1954
2587
  id: string;
1955
2588
  status: 'succeeded' | 'refunded' | 'partially_refunded' | 'disputed' | 'failed';
2589
+ /** In `currency`, its smallest unit (as `refunded_cents` and the dispute's amount). */
1956
2590
  amount_cents: number;
1957
2591
  refunded_cents: number;
2592
+ /** Through Vibiz in another currency: in USD, the balance's (as `net_cents`). */
1958
2593
  fee_cents: number;
1959
2594
  net_cents: number;
1960
- currency: 'usd';
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;
1961
2602
  description: string | null;
1962
2603
  user: string | null;
1963
2604
  customer_email: string | null;
@@ -1988,12 +2629,124 @@ export interface PaymentSubscription {
1988
2629
  user: string | null;
1989
2630
  customer_email: string | null;
1990
2631
  price_id: string | null;
1991
- /** `own`: billed on the owner's own Stripe account. */
2632
+ /** `own`: billed on the owner's own Stripe account, or paid by a store. */
1992
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[];
1993
2640
  current_period_end: string | null;
1994
2641
  cancel_at_period_end: boolean;
1995
2642
  created_at: string;
1996
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
+ }
1997
2750
  export interface Withdrawal {
1998
2751
  object: 'withdrawal';
1999
2752
  id: string;
@@ -2463,10 +3216,63 @@ export interface SocialAdCampaign {
2463
3216
  clicks: number | null;
2464
3217
  conversions: number | null;
2465
3218
  }
2466
- export interface SocialAdChangeInput {
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'>> {
2467
3273
  account_id: string;
2468
3274
  ad_account_id: string;
2469
- kind: 'boost' | 'pause' | 'resume' | 'budget';
3275
+ kind: SocialAdChangeKind;
2470
3276
  campaign_id?: string;
2471
3277
  daily_budget_cents?: number;
2472
3278
  post_id?: string;
@@ -2486,11 +3292,14 @@ export interface SocialAdChange {
2486
3292
  environment: SocialEnvironment;
2487
3293
  account_id: string;
2488
3294
  ad_account_id: string;
2489
- kind: 'boost' | 'pause' | 'resume' | 'budget';
3295
+ kind: SocialAdChangeKind;
2490
3296
  request: Record<string, unknown>;
2491
3297
  status: 'pending_approval' | 'applying' | 'applied' | 'rejected' | 'failed';
3298
+ /** create_campaign also carries `ad_group_id` and `ad_id`. */
2492
3299
  result: {
2493
3300
  campaign_id: string | null;
3301
+ ad_group_id?: string | null;
3302
+ ad_id?: string | null;
2494
3303
  } | null;
2495
3304
  error: string | null;
2496
3305
  requested_by: string | null;
@@ -2595,7 +3404,7 @@ export interface BillingCharge {
2595
3404
  created_at: string;
2596
3405
  console_url: string;
2597
3406
  }
2598
- export type BillingEntryKind = 'trial' | 'topup' | 'company_payment' | 'domain' | 'domain_refund' | 'usage' | 'refund' | 'dispute' | 'dispute_reversal' | 'adjustment';
3407
+ export type BillingEntryKind = 'trial' | 'topup' | 'company_payment' | 'domain' | 'domain_refund' | 'phone' | 'phone_refund' | 'usage' | 'refund' | 'dispute' | 'dispute_reversal' | 'adjustment';
2599
3408
  export interface BillingEntry {
2600
3409
  object: 'billing_entry';
2601
3410
  id: string;
@@ -3258,3 +4067,4 @@ export interface EmailPage<T> {
3258
4067
  has_more: boolean;
3259
4068
  next_cursor: string | null;
3260
4069
  }
4070
+ export {};