@periskope/types 0.6.463 → 0.6.465

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.
@@ -73,6 +73,7 @@ exports.Constants = {
73
73
  "zohodesk",
74
74
  "gsheets",
75
75
  "zohocrm",
76
+ "mcp",
76
77
  ],
77
78
  enum_member_role: ["admin", "member"],
78
79
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@periskope/types",
3
- "version": "0.6.463",
3
+ "version": "0.6.465",
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 ----------------------------- */
@@ -2257,11 +2257,12 @@ export type Database = {
2257
2257
  is_revealed: boolean
2258
2258
  name: string
2259
2259
  org_id: string
2260
+ refresh_token_hash: string | null
2260
2261
  role: string
2261
2262
  token: string
2262
2263
  token_hash: string
2263
2264
  token_metadata: Json
2264
- type: Database["public"]["Enums"]["enum_integration_type"]
2265
+ type: string
2265
2266
  }
2266
2267
  Insert: {
2267
2268
  exp: string
@@ -2270,11 +2271,12 @@ export type Database = {
2270
2271
  is_revealed?: boolean
2271
2272
  name: string
2272
2273
  org_id: string
2274
+ refresh_token_hash?: string | null
2273
2275
  role: string
2274
2276
  token: string
2275
2277
  token_hash: string
2276
2278
  token_metadata?: Json
2277
- type: Database["public"]["Enums"]["enum_integration_type"]
2279
+ type: string
2278
2280
  }
2279
2281
  Update: {
2280
2282
  exp?: string
@@ -2283,11 +2285,12 @@ export type Database = {
2283
2285
  is_revealed?: boolean
2284
2286
  name?: string
2285
2287
  org_id?: string
2288
+ refresh_token_hash?: string | null
2286
2289
  role?: string
2287
2290
  token?: string
2288
2291
  token_hash?: string
2289
2292
  token_metadata?: Json
2290
- type?: Database["public"]["Enums"]["enum_integration_type"]
2293
+ type?: string
2291
2294
  }
2292
2295
  Relationships: [
2293
2296
  {
@@ -2360,6 +2363,69 @@ export type Database = {
2360
2363
  },
2361
2364
  ]
2362
2365
  }
2366
+ tbl_mcp_clients: {
2367
+ Row: {
2368
+ client: Json
2369
+ client_id: string
2370
+ created_at: string
2371
+ }
2372
+ Insert: {
2373
+ client: Json
2374
+ client_id: string
2375
+ created_at?: string
2376
+ }
2377
+ Update: {
2378
+ client?: Json
2379
+ client_id?: string
2380
+ created_at?: string
2381
+ }
2382
+ Relationships: []
2383
+ }
2384
+ tbl_mcp_tokens: {
2385
+ Row: {
2386
+ access_token_expires_at: string
2387
+ access_token_hash: string
2388
+ client_id: string
2389
+ client_name: string | null
2390
+ created_at: string
2391
+ id: string
2392
+ integration_token_id: string
2393
+ org_id: string
2394
+ phone_scopes: string[] | null
2395
+ refresh_token_expires_at: string
2396
+ refresh_token_hash: string
2397
+ revoked_at: string | null
2398
+ }
2399
+ Insert: {
2400
+ access_token_expires_at: string
2401
+ access_token_hash: string
2402
+ client_id: string
2403
+ client_name?: string | null
2404
+ created_at?: string
2405
+ id?: string
2406
+ integration_token_id: string
2407
+ org_id: string
2408
+ phone_scopes?: string[] | null
2409
+ refresh_token_expires_at: string
2410
+ refresh_token_hash: string
2411
+ revoked_at?: string | null
2412
+ }
2413
+ Update: {
2414
+ access_token_expires_at?: string
2415
+ access_token_hash?: string
2416
+ client_id?: string
2417
+ client_name?: string | null
2418
+ created_at?: string
2419
+ id?: string
2420
+ integration_token_id?: string
2421
+ org_id?: string
2422
+ phone_scopes?: string[] | null
2423
+ refresh_token_expires_at?: string
2424
+ refresh_token_hash?: string
2425
+ revoked_at?: string | null
2426
+ }
2427
+ Relationships: []
2428
+ }
2363
2429
  tbl_org: {
2364
2430
  Row: {
2365
2431
  ai_settings: Json | null
@@ -3717,6 +3783,10 @@ export type Database = {
3717
3783
  Args: { chat_ids_input?: string[]; org_id_input: string }
3718
3784
  Returns: Json[]
3719
3785
  }
3786
+ get_mcp_connections: {
3787
+ Args: { org_id_input: string }
3788
+ Returns: Json
3789
+ }
3720
3790
  get_chat_properties_by_chat_ids: {
3721
3791
  Args: { chat_id_input?: string[]; org_id_input: string }
3722
3792
  Returns: Json
@@ -4009,6 +4079,10 @@ export type Database = {
4009
4079
  Args: { chat_id_input?: string; org_id_input: string }
4010
4080
  Returns: undefined
4011
4081
  }
4082
+ revoke_mcp_connection: {
4083
+ Args: { id_input: string }
4084
+ Returns: undefined
4085
+ }
4012
4086
  update_chat_properties: {
4013
4087
  Args: {
4014
4088
  chat_id_input: string[]
@@ -4464,6 +4538,7 @@ export const Constants = {
4464
4538
  "zohodesk",
4465
4539
  "gsheets",
4466
4540
  "zohocrm",
4541
+ "mcp",
4467
4542
  ],
4468
4543
  enum_member_role: ["admin", "member"],
4469
4544
  },