@periskope/types 0.6.463 → 0.6.464

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@periskope/types",
3
- "version": "0.6.463",
3
+ "version": "0.6.464",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -26,7 +26,7 @@ export type SeatAddonPackId =
26
26
  /** Shared by v1 and v2 — recurring optional add-ons. */
27
27
  export type RecurringAddonPackId = 'priority-support-pack' | 'automation-pack';
28
28
 
29
- /** Shared by v1 and v2 — one-time charge packs. */
29
+ /** Shared by v1 and v2 — one-time charge packs. `ai-pack`: 1,000 AI credits per quantity unit. */
30
30
  export type ChargesPack =
31
31
  | 'ai-pack'
32
32
  | 'bulk-message-credits'
@@ -47,9 +47,10 @@ export const GENERIC_PACK_IDS: readonly GenericPackId[] = [
47
47
  'support-call-pack',
48
48
  ];
49
49
 
50
- export type UsageType = 'ai_credits' | 'automation_rules';
50
+ export type UsageType = 'ai_credits' | 'automation_rules' | 'bm_credits';
51
51
 
52
52
  export type UsageAllowances = Partial<Record<UsageType, number>>;
53
+
53
54
  export type UsageConsumption = Partial<Record<UsageType, number>>;
54
55
 
55
56
  /** Recurring add-on flags derived from subscription line items. */
@@ -67,7 +68,10 @@ export type OrgPlanV2 = Merge<
67
68
  {
68
69
  billing_version: 'v2';
69
70
  usage_allowances?: UsageAllowances;
71
+ usage_consumption?: UsageConsumption;
70
72
  addon_entitlements?: V2AddonEntitlements;
73
+ /** Paid one-time charge invoice ids already granted — webhook idempotency. */
74
+ processed_charge_invoices?: string[];
71
75
  }
72
76
  >;
73
77
 
@@ -169,6 +173,7 @@ export type RecurringAddonOption = {
169
173
  unit_price: BillingMoney;
170
174
  /** e.g. "pack" for automation rules. */
171
175
  unit_label?: string;
176
+ /** Automation rules included per pack unit (`automation-pack` — default `25`). */
172
177
  rules_per_pack?: number;
173
178
  };
174
179
 
@@ -183,7 +188,7 @@ export type GetRecurringAddonsResponse = {
183
188
 
184
189
  /* ----------------------------- ORDER SUMMARY (SIDEBAR + REVIEW) ----------------------------- */
185
190
 
186
- export type OrderSummaryItemType = 'plan' | 'addon';
191
+ export type OrderSummaryItemType = 'plan' | 'addon' | 'charge';
187
192
 
188
193
  export type OrderSummaryItem = {
189
194
  type: OrderSummaryItemType;
@@ -230,6 +235,29 @@ export type GetOrderSummaryResponse = {
230
235
  next_charge: OrderSummaryNextCharge | null;
231
236
  };
232
237
 
238
+ /* ----------------------------- ONE-TIME CHARGE ORDER SUMMARY ----------------------------- */
239
+
240
+ export type GetChargeOrderSummaryRequestBody = {
241
+ line_items: BillingV2LineItem[];
242
+ /** Chargebee coupon id — resolve via POST /get-coupon-details */
243
+ coupon_id?: string;
244
+ /** Override currency (e.g. INR, USD). Omit to use customer default. */
245
+ currency?: string;
246
+ };
247
+
248
+ export type GetChargeOrderSummaryResponse = {
249
+ currency_code: string;
250
+ items: OrderSummaryItem[];
251
+ /** Line items with quantity > 0 */
252
+ item_count: number;
253
+ subtotal: BillingMoney;
254
+ credits_applied: BillingMoney | null;
255
+ coupon: AppliedCouponSummary | null;
256
+ total: BillingMoney;
257
+ /** Amount due now — equals total for one-time charges (no proration). */
258
+ due_today: BillingMoney;
259
+ };
260
+
233
261
  /* ----------------------------- COUPONS ----------------------------- */
234
262
 
235
263
  export type CouponDiscountType = 'fixed_amount' | 'percentage' | 'offer_quantity';
@@ -457,6 +485,13 @@ export type PlanSummaryNextInvoice = {
457
485
  label: string;
458
486
  };
459
487
 
488
+ /** Scheduled end-of-term cancellation — null when subscription will renew. */
489
+ export type PlanSummaryCancelsOn = {
490
+ date: number;
491
+ /** e.g. "Cancels on 18 Jul 2026" */
492
+ label: string;
493
+ };
494
+
460
495
  export type PlanSummarySection = {
461
496
  current_plan: string;
462
497
  /** null when org_plan is not seeded yet */
@@ -468,8 +503,12 @@ export type PlanSummarySection = {
468
503
  rules_allowance: number | null;
469
504
  /** null on free trial — recurring BM only; free trial has top-up via charge_packs */
470
505
  bm_credits_allowance: number | null;
471
- /** null on free trial or when no upcoming renewal */
506
+ /** null on free trial recurring AI from seats; purchased top-up via charge_packs */
507
+ ai_credits_allowance: number | null;
508
+ /** null on free trial, when scheduled to cancel, or when no upcoming renewal */
472
509
  next_invoice: PlanSummaryNextInvoice | null;
510
+ /** null unless subscription is scheduled to cancel at period end (`non_renewing`) */
511
+ cancels_on: PlanSummaryCancelsOn | null;
473
512
  };
474
513
 
475
514
  export type PlanSummarySubscriptionStatus = 'active' | 'unpaid' | 'inactive';
@@ -480,10 +519,12 @@ export type PlanSummaryInvoice = ChargebeeInvoiceSummary & {
480
519
  };
481
520
 
482
521
  export type PlanSummaryChargePack = {
483
- pack_id: 'bulk-message-credits';
522
+ pack_id: 'bulk-message-credits' | 'ai-pack';
484
523
  lookup_key: string;
485
524
  name: string;
486
- /** Current top-up balance null when zero. */
525
+ /** Total purchased credits granted (from usage_allowances). */
526
+ purchased_credits: number | null;
527
+ /** Remaining after consumption — null when zero. */
487
528
  remaining_credits: number | null;
488
529
  };
489
530
 
@@ -493,8 +534,14 @@ export type GetPlanSummaryResponse = {
493
534
  subscription_status: PlanSummarySubscriptionStatus;
494
535
  /** Newest first — empty when customer has no invoices. */
495
536
  last_5_invoices: PlanSummaryInvoice[];
496
- /** BM top-up only — empty when top-up balance is zero. */
537
+ /** BM + AI one-time top-ups — empty when no purchased balance. */
497
538
  charge_packs: PlanSummaryChargePack[];
539
+ /** Purchased top-up allowances and consumption from org_plan (V2). */
540
+ usage: {
541
+ allowances: UsageAllowances;
542
+ consumption: UsageConsumption;
543
+ remaining: UsageAllowances;
544
+ } | null;
498
545
  };
499
546
 
500
547
  /* ----------------------------- WEBHOOKS ----------------------------- */
@@ -2360,6 +2360,69 @@ export type Database = {
2360
2360
  },
2361
2361
  ]
2362
2362
  }
2363
+ tbl_mcp_clients: {
2364
+ Row: {
2365
+ client: Json
2366
+ client_id: string
2367
+ created_at: string
2368
+ }
2369
+ Insert: {
2370
+ client: Json
2371
+ client_id: string
2372
+ created_at?: string
2373
+ }
2374
+ Update: {
2375
+ client?: Json
2376
+ client_id?: string
2377
+ created_at?: string
2378
+ }
2379
+ Relationships: []
2380
+ }
2381
+ tbl_mcp_tokens: {
2382
+ Row: {
2383
+ access_token_expires_at: string
2384
+ access_token_hash: string
2385
+ client_id: string
2386
+ client_name: string | null
2387
+ created_at: string
2388
+ id: string
2389
+ integration_token_id: string
2390
+ org_id: string
2391
+ phone_scopes: string[] | null
2392
+ refresh_token_expires_at: string
2393
+ refresh_token_hash: string
2394
+ revoked_at: string | null
2395
+ }
2396
+ Insert: {
2397
+ access_token_expires_at: string
2398
+ access_token_hash: string
2399
+ client_id: string
2400
+ client_name?: string | null
2401
+ created_at?: string
2402
+ id?: string
2403
+ integration_token_id: string
2404
+ org_id: string
2405
+ phone_scopes?: string[] | null
2406
+ refresh_token_expires_at: string
2407
+ refresh_token_hash: string
2408
+ revoked_at?: string | null
2409
+ }
2410
+ Update: {
2411
+ access_token_expires_at?: string
2412
+ access_token_hash?: string
2413
+ client_id?: string
2414
+ client_name?: string | null
2415
+ created_at?: string
2416
+ id?: string
2417
+ integration_token_id?: string
2418
+ org_id?: string
2419
+ phone_scopes?: string[] | null
2420
+ refresh_token_expires_at?: string
2421
+ refresh_token_hash?: string
2422
+ revoked_at?: string | null
2423
+ }
2424
+ Relationships: []
2425
+ }
2363
2426
  tbl_org: {
2364
2427
  Row: {
2365
2428
  ai_settings: Json | null
@@ -3717,6 +3780,10 @@ export type Database = {
3717
3780
  Args: { chat_ids_input?: string[]; org_id_input: string }
3718
3781
  Returns: Json[]
3719
3782
  }
3783
+ get_mcp_connections: {
3784
+ Args: { org_id_input: string }
3785
+ Returns: Json
3786
+ }
3720
3787
  get_chat_properties_by_chat_ids: {
3721
3788
  Args: { chat_id_input?: string[]; org_id_input: string }
3722
3789
  Returns: Json
@@ -4009,6 +4076,10 @@ export type Database = {
4009
4076
  Args: { chat_id_input?: string; org_id_input: string }
4010
4077
  Returns: undefined
4011
4078
  }
4079
+ revoke_mcp_connection: {
4080
+ Args: { id_input: string }
4081
+ Returns: undefined
4082
+ }
4012
4083
  update_chat_properties: {
4013
4084
  Args: {
4014
4085
  chat_id_input: string[]