@bpinternal/const 0.33.0 → 0.35.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/billing-next/config/schemas.d.ts +239 -0
- package/dist/billing-next/config/schemas.js +18 -1
- package/dist/billing-next/config/utils.d.ts +41 -0
- package/dist/billing-next/config/utils.js +36 -0
- package/dist/billing-next/config/v4/plans.d.ts +64 -0
- package/dist/billing-next/config/v4/plans.js +6 -0
- package/dist/billing-next/config/v5/plans.d.ts +65 -0
- package/dist/billing-next/config/v5/plans.js +5 -0
- package/dist/billing-next/config/versions.d.ts +263 -0
- package/dist/billing-next/events.d.ts +69 -0
- package/dist/billing-next/events.js +54 -0
- package/dist/billing-next/index.d.ts +1 -0
- package/dist/billing-next/index.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
|
@@ -52,6 +52,42 @@ export declare const creditGrantPriceSchema: z.ZodObject<{
|
|
|
52
52
|
unitAmount: number;
|
|
53
53
|
metadata?: Record<string, string> | undefined;
|
|
54
54
|
}>;
|
|
55
|
+
export type AutoRechargeTargetType = z.infer<typeof autoRechargeTargetTypeSchema>;
|
|
56
|
+
export declare const autoRechargeTargetTypeSchema: z.ZodEnum<["addon", "credit_grant"]>;
|
|
57
|
+
export type AutoRechargeThresholdType = z.infer<typeof autoRechargeThresholdTypeSchema>;
|
|
58
|
+
export declare const autoRechargeThresholdTypeSchema: z.ZodEnum<["percentage", "remaining_amount"]>;
|
|
59
|
+
export type AutoRechargeFeatureDefault = z.infer<typeof autoRechargeFeatureDefaultSchema>;
|
|
60
|
+
export declare const autoRechargeFeatureDefaultSchema: z.ZodDiscriminatedUnion<"enabled", [z.ZodObject<{
|
|
61
|
+
enabled: z.ZodLiteral<true>;
|
|
62
|
+
addonId: z.ZodString;
|
|
63
|
+
targetType: z.ZodEnum<["addon", "credit_grant"]>;
|
|
64
|
+
thresholdType: z.ZodEnum<["percentage", "remaining_amount"]>;
|
|
65
|
+
threshold: z.ZodNumber;
|
|
66
|
+
chunkSize: z.ZodNullable<z.ZodNumber>;
|
|
67
|
+
maxAmount: z.ZodNullable<z.ZodNumber>;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
enabled: true;
|
|
70
|
+
addonId: string;
|
|
71
|
+
targetType: "addon" | "credit_grant";
|
|
72
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
73
|
+
threshold: number;
|
|
74
|
+
chunkSize: number | null;
|
|
75
|
+
maxAmount: number | null;
|
|
76
|
+
}, {
|
|
77
|
+
enabled: true;
|
|
78
|
+
addonId: string;
|
|
79
|
+
targetType: "addon" | "credit_grant";
|
|
80
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
81
|
+
threshold: number;
|
|
82
|
+
chunkSize: number | null;
|
|
83
|
+
maxAmount: number | null;
|
|
84
|
+
}>, z.ZodObject<{
|
|
85
|
+
enabled: z.ZodLiteral<false>;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
enabled: false;
|
|
88
|
+
}, {
|
|
89
|
+
enabled: false;
|
|
90
|
+
}>]>;
|
|
55
91
|
export type BillingPlan = z.infer<typeof planSchema>;
|
|
56
92
|
export declare const planSchema: z.ZodObject<{
|
|
57
93
|
id: z.ZodString;
|
|
@@ -79,6 +115,37 @@ export declare const planSchema: z.ZodObject<{
|
|
|
79
115
|
}>>;
|
|
80
116
|
features: z.ZodRecord<z.ZodEnum<["incoming_messages_events", "integration_spend", "table_rows", "bot_count", "collaborator_count", "file_storage", "vector_db_storage", "saved_versions", "indexed_file_count", "conversation_sessions", "ai_spend"]>, z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
|
|
81
117
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
118
|
+
autoRechargeSettings: z.ZodOptional<z.ZodRecord<z.ZodEnum<["incoming_messages_events", "integration_spend", "table_rows", "bot_count", "collaborator_count", "file_storage", "vector_db_storage", "saved_versions", "indexed_file_count", "conversation_sessions", "ai_spend"]>, z.ZodDiscriminatedUnion<"enabled", [z.ZodObject<{
|
|
119
|
+
enabled: z.ZodLiteral<true>;
|
|
120
|
+
addonId: z.ZodString;
|
|
121
|
+
targetType: z.ZodEnum<["addon", "credit_grant"]>;
|
|
122
|
+
thresholdType: z.ZodEnum<["percentage", "remaining_amount"]>;
|
|
123
|
+
threshold: z.ZodNumber;
|
|
124
|
+
chunkSize: z.ZodNullable<z.ZodNumber>;
|
|
125
|
+
maxAmount: z.ZodNullable<z.ZodNumber>;
|
|
126
|
+
}, "strip", z.ZodTypeAny, {
|
|
127
|
+
enabled: true;
|
|
128
|
+
addonId: string;
|
|
129
|
+
targetType: "addon" | "credit_grant";
|
|
130
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
131
|
+
threshold: number;
|
|
132
|
+
chunkSize: number | null;
|
|
133
|
+
maxAmount: number | null;
|
|
134
|
+
}, {
|
|
135
|
+
enabled: true;
|
|
136
|
+
addonId: string;
|
|
137
|
+
targetType: "addon" | "credit_grant";
|
|
138
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
139
|
+
threshold: number;
|
|
140
|
+
chunkSize: number | null;
|
|
141
|
+
maxAmount: number | null;
|
|
142
|
+
}>, z.ZodObject<{
|
|
143
|
+
enabled: z.ZodLiteral<false>;
|
|
144
|
+
}, "strip", z.ZodTypeAny, {
|
|
145
|
+
enabled: false;
|
|
146
|
+
}, {
|
|
147
|
+
enabled: false;
|
|
148
|
+
}>]>>>;
|
|
82
149
|
providerProductId: z.ZodString;
|
|
83
150
|
}, "strip", z.ZodTypeAny, {
|
|
84
151
|
id: string;
|
|
@@ -95,6 +162,17 @@ export declare const planSchema: z.ZodObject<{
|
|
|
95
162
|
features: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", number | boolean>>;
|
|
96
163
|
providerProductId: string;
|
|
97
164
|
metadata?: Record<string, string> | undefined;
|
|
165
|
+
autoRechargeSettings?: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", {
|
|
166
|
+
enabled: true;
|
|
167
|
+
addonId: string;
|
|
168
|
+
targetType: "addon" | "credit_grant";
|
|
169
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
170
|
+
threshold: number;
|
|
171
|
+
chunkSize: number | null;
|
|
172
|
+
maxAmount: number | null;
|
|
173
|
+
} | {
|
|
174
|
+
enabled: false;
|
|
175
|
+
}>> | undefined;
|
|
98
176
|
}, {
|
|
99
177
|
id: string;
|
|
100
178
|
name: string;
|
|
@@ -110,6 +188,17 @@ export declare const planSchema: z.ZodObject<{
|
|
|
110
188
|
features: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", number | boolean>>;
|
|
111
189
|
providerProductId: string;
|
|
112
190
|
metadata?: Record<string, string> | undefined;
|
|
191
|
+
autoRechargeSettings?: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", {
|
|
192
|
+
enabled: true;
|
|
193
|
+
addonId: string;
|
|
194
|
+
targetType: "addon" | "credit_grant";
|
|
195
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
196
|
+
threshold: number;
|
|
197
|
+
chunkSize: number | null;
|
|
198
|
+
maxAmount: number | null;
|
|
199
|
+
} | {
|
|
200
|
+
enabled: false;
|
|
201
|
+
}>> | undefined;
|
|
113
202
|
}>;
|
|
114
203
|
export type BillingAddon = z.infer<typeof addOnSchema>;
|
|
115
204
|
export declare const addOnSchema: z.ZodObject<{
|
|
@@ -272,6 +361,37 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
272
361
|
}>>;
|
|
273
362
|
features: z.ZodRecord<z.ZodEnum<["incoming_messages_events", "integration_spend", "table_rows", "bot_count", "collaborator_count", "file_storage", "vector_db_storage", "saved_versions", "indexed_file_count", "conversation_sessions", "ai_spend"]>, z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
|
|
274
363
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
364
|
+
autoRechargeSettings: z.ZodOptional<z.ZodRecord<z.ZodEnum<["incoming_messages_events", "integration_spend", "table_rows", "bot_count", "collaborator_count", "file_storage", "vector_db_storage", "saved_versions", "indexed_file_count", "conversation_sessions", "ai_spend"]>, z.ZodDiscriminatedUnion<"enabled", [z.ZodObject<{
|
|
365
|
+
enabled: z.ZodLiteral<true>;
|
|
366
|
+
addonId: z.ZodString;
|
|
367
|
+
targetType: z.ZodEnum<["addon", "credit_grant"]>;
|
|
368
|
+
thresholdType: z.ZodEnum<["percentage", "remaining_amount"]>;
|
|
369
|
+
threshold: z.ZodNumber;
|
|
370
|
+
chunkSize: z.ZodNullable<z.ZodNumber>;
|
|
371
|
+
maxAmount: z.ZodNullable<z.ZodNumber>;
|
|
372
|
+
}, "strip", z.ZodTypeAny, {
|
|
373
|
+
enabled: true;
|
|
374
|
+
addonId: string;
|
|
375
|
+
targetType: "addon" | "credit_grant";
|
|
376
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
377
|
+
threshold: number;
|
|
378
|
+
chunkSize: number | null;
|
|
379
|
+
maxAmount: number | null;
|
|
380
|
+
}, {
|
|
381
|
+
enabled: true;
|
|
382
|
+
addonId: string;
|
|
383
|
+
targetType: "addon" | "credit_grant";
|
|
384
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
385
|
+
threshold: number;
|
|
386
|
+
chunkSize: number | null;
|
|
387
|
+
maxAmount: number | null;
|
|
388
|
+
}>, z.ZodObject<{
|
|
389
|
+
enabled: z.ZodLiteral<false>;
|
|
390
|
+
}, "strip", z.ZodTypeAny, {
|
|
391
|
+
enabled: false;
|
|
392
|
+
}, {
|
|
393
|
+
enabled: false;
|
|
394
|
+
}>]>>>;
|
|
275
395
|
providerProductId: z.ZodString;
|
|
276
396
|
}, "strip", z.ZodTypeAny, {
|
|
277
397
|
id: string;
|
|
@@ -288,6 +408,17 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
288
408
|
features: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", number | boolean>>;
|
|
289
409
|
providerProductId: string;
|
|
290
410
|
metadata?: Record<string, string> | undefined;
|
|
411
|
+
autoRechargeSettings?: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", {
|
|
412
|
+
enabled: true;
|
|
413
|
+
addonId: string;
|
|
414
|
+
targetType: "addon" | "credit_grant";
|
|
415
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
416
|
+
threshold: number;
|
|
417
|
+
chunkSize: number | null;
|
|
418
|
+
maxAmount: number | null;
|
|
419
|
+
} | {
|
|
420
|
+
enabled: false;
|
|
421
|
+
}>> | undefined;
|
|
291
422
|
}, {
|
|
292
423
|
id: string;
|
|
293
424
|
name: string;
|
|
@@ -303,6 +434,17 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
303
434
|
features: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", number | boolean>>;
|
|
304
435
|
providerProductId: string;
|
|
305
436
|
metadata?: Record<string, string> | undefined;
|
|
437
|
+
autoRechargeSettings?: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", {
|
|
438
|
+
enabled: true;
|
|
439
|
+
addonId: string;
|
|
440
|
+
targetType: "addon" | "credit_grant";
|
|
441
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
442
|
+
threshold: number;
|
|
443
|
+
chunkSize: number | null;
|
|
444
|
+
maxAmount: number | null;
|
|
445
|
+
} | {
|
|
446
|
+
enabled: false;
|
|
447
|
+
}>> | undefined;
|
|
306
448
|
}>>;
|
|
307
449
|
addons: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
308
450
|
id: z.ZodString;
|
|
@@ -453,6 +595,17 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
453
595
|
features: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", number | boolean>>;
|
|
454
596
|
providerProductId: string;
|
|
455
597
|
metadata?: Record<string, string> | undefined;
|
|
598
|
+
autoRechargeSettings?: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", {
|
|
599
|
+
enabled: true;
|
|
600
|
+
addonId: string;
|
|
601
|
+
targetType: "addon" | "credit_grant";
|
|
602
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
603
|
+
threshold: number;
|
|
604
|
+
chunkSize: number | null;
|
|
605
|
+
maxAmount: number | null;
|
|
606
|
+
} | {
|
|
607
|
+
enabled: false;
|
|
608
|
+
}>> | undefined;
|
|
456
609
|
}>;
|
|
457
610
|
addons: Record<string, {
|
|
458
611
|
id: string;
|
|
@@ -511,6 +664,17 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
511
664
|
features: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", number | boolean>>;
|
|
512
665
|
providerProductId: string;
|
|
513
666
|
metadata?: Record<string, string> | undefined;
|
|
667
|
+
autoRechargeSettings?: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", {
|
|
668
|
+
enabled: true;
|
|
669
|
+
addonId: string;
|
|
670
|
+
targetType: "addon" | "credit_grant";
|
|
671
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
672
|
+
threshold: number;
|
|
673
|
+
chunkSize: number | null;
|
|
674
|
+
maxAmount: number | null;
|
|
675
|
+
} | {
|
|
676
|
+
enabled: false;
|
|
677
|
+
}>> | undefined;
|
|
514
678
|
}>;
|
|
515
679
|
addons: Record<string, {
|
|
516
680
|
id: string;
|
|
@@ -582,6 +746,37 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
582
746
|
}>>;
|
|
583
747
|
features: z.ZodRecord<z.ZodEnum<["incoming_messages_events", "integration_spend", "table_rows", "bot_count", "collaborator_count", "file_storage", "vector_db_storage", "saved_versions", "indexed_file_count", "conversation_sessions", "ai_spend"]>, z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
|
|
584
748
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
749
|
+
autoRechargeSettings: z.ZodOptional<z.ZodRecord<z.ZodEnum<["incoming_messages_events", "integration_spend", "table_rows", "bot_count", "collaborator_count", "file_storage", "vector_db_storage", "saved_versions", "indexed_file_count", "conversation_sessions", "ai_spend"]>, z.ZodDiscriminatedUnion<"enabled", [z.ZodObject<{
|
|
750
|
+
enabled: z.ZodLiteral<true>;
|
|
751
|
+
addonId: z.ZodString;
|
|
752
|
+
targetType: z.ZodEnum<["addon", "credit_grant"]>;
|
|
753
|
+
thresholdType: z.ZodEnum<["percentage", "remaining_amount"]>;
|
|
754
|
+
threshold: z.ZodNumber;
|
|
755
|
+
chunkSize: z.ZodNullable<z.ZodNumber>;
|
|
756
|
+
maxAmount: z.ZodNullable<z.ZodNumber>;
|
|
757
|
+
}, "strip", z.ZodTypeAny, {
|
|
758
|
+
enabled: true;
|
|
759
|
+
addonId: string;
|
|
760
|
+
targetType: "addon" | "credit_grant";
|
|
761
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
762
|
+
threshold: number;
|
|
763
|
+
chunkSize: number | null;
|
|
764
|
+
maxAmount: number | null;
|
|
765
|
+
}, {
|
|
766
|
+
enabled: true;
|
|
767
|
+
addonId: string;
|
|
768
|
+
targetType: "addon" | "credit_grant";
|
|
769
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
770
|
+
threshold: number;
|
|
771
|
+
chunkSize: number | null;
|
|
772
|
+
maxAmount: number | null;
|
|
773
|
+
}>, z.ZodObject<{
|
|
774
|
+
enabled: z.ZodLiteral<false>;
|
|
775
|
+
}, "strip", z.ZodTypeAny, {
|
|
776
|
+
enabled: false;
|
|
777
|
+
}, {
|
|
778
|
+
enabled: false;
|
|
779
|
+
}>]>>>;
|
|
585
780
|
providerProductId: z.ZodString;
|
|
586
781
|
}, "strip", z.ZodTypeAny, {
|
|
587
782
|
id: string;
|
|
@@ -598,6 +793,17 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
598
793
|
features: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", number | boolean>>;
|
|
599
794
|
providerProductId: string;
|
|
600
795
|
metadata?: Record<string, string> | undefined;
|
|
796
|
+
autoRechargeSettings?: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", {
|
|
797
|
+
enabled: true;
|
|
798
|
+
addonId: string;
|
|
799
|
+
targetType: "addon" | "credit_grant";
|
|
800
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
801
|
+
threshold: number;
|
|
802
|
+
chunkSize: number | null;
|
|
803
|
+
maxAmount: number | null;
|
|
804
|
+
} | {
|
|
805
|
+
enabled: false;
|
|
806
|
+
}>> | undefined;
|
|
601
807
|
}, {
|
|
602
808
|
id: string;
|
|
603
809
|
name: string;
|
|
@@ -613,6 +819,17 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
613
819
|
features: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", number | boolean>>;
|
|
614
820
|
providerProductId: string;
|
|
615
821
|
metadata?: Record<string, string> | undefined;
|
|
822
|
+
autoRechargeSettings?: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", {
|
|
823
|
+
enabled: true;
|
|
824
|
+
addonId: string;
|
|
825
|
+
targetType: "addon" | "credit_grant";
|
|
826
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
827
|
+
threshold: number;
|
|
828
|
+
chunkSize: number | null;
|
|
829
|
+
maxAmount: number | null;
|
|
830
|
+
} | {
|
|
831
|
+
enabled: false;
|
|
832
|
+
}>> | undefined;
|
|
616
833
|
}>>;
|
|
617
834
|
addons: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
618
835
|
id: z.ZodString;
|
|
@@ -763,6 +980,17 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
763
980
|
features: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", number | boolean>>;
|
|
764
981
|
providerProductId: string;
|
|
765
982
|
metadata?: Record<string, string> | undefined;
|
|
983
|
+
autoRechargeSettings?: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", {
|
|
984
|
+
enabled: true;
|
|
985
|
+
addonId: string;
|
|
986
|
+
targetType: "addon" | "credit_grant";
|
|
987
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
988
|
+
threshold: number;
|
|
989
|
+
chunkSize: number | null;
|
|
990
|
+
maxAmount: number | null;
|
|
991
|
+
} | {
|
|
992
|
+
enabled: false;
|
|
993
|
+
}>> | undefined;
|
|
766
994
|
}>;
|
|
767
995
|
addons: Record<string, {
|
|
768
996
|
id: string;
|
|
@@ -821,6 +1049,17 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
821
1049
|
features: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", number | boolean>>;
|
|
822
1050
|
providerProductId: string;
|
|
823
1051
|
metadata?: Record<string, string> | undefined;
|
|
1052
|
+
autoRechargeSettings?: Partial<Record<"bot_count" | "ai_spend" | "indexed_file_count" | "incoming_messages_events" | "integration_spend" | "table_rows" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions" | "conversation_sessions", {
|
|
1053
|
+
enabled: true;
|
|
1054
|
+
addonId: string;
|
|
1055
|
+
targetType: "addon" | "credit_grant";
|
|
1056
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
1057
|
+
threshold: number;
|
|
1058
|
+
chunkSize: number | null;
|
|
1059
|
+
maxAmount: number | null;
|
|
1060
|
+
} | {
|
|
1061
|
+
enabled: false;
|
|
1062
|
+
}>> | undefined;
|
|
824
1063
|
}>;
|
|
825
1064
|
addons: Record<string, {
|
|
826
1065
|
id: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.billingConfigSchema = exports.billingVersionConfigSchema = exports.creditGrantSchema = exports.addOnSchema = exports.planSchema = exports.creditGrantPriceSchema = exports.priceSchema = exports.aggregationSchema = exports.unitAmountSchema = exports.intervalSchema = exports.creditGrantFeatureSchema = exports.featureSchema = exports.UNKNOWN_STRIPE_ID = void 0;
|
|
3
|
+
exports.billingConfigSchema = exports.billingVersionConfigSchema = exports.creditGrantSchema = exports.addOnSchema = exports.planSchema = exports.autoRechargeFeatureDefaultSchema = exports.autoRechargeThresholdTypeSchema = exports.autoRechargeTargetTypeSchema = exports.creditGrantPriceSchema = exports.priceSchema = exports.aggregationSchema = exports.unitAmountSchema = exports.intervalSchema = exports.creditGrantFeatureSchema = exports.featureSchema = exports.UNKNOWN_STRIPE_ID = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const features_1 = require("../features");
|
|
6
6
|
/**
|
|
@@ -27,6 +27,22 @@ exports.creditGrantPriceSchema = zod_1.z.object({
|
|
|
27
27
|
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
|
|
28
28
|
providerPriceId: zod_1.z.string(), // pulumi
|
|
29
29
|
});
|
|
30
|
+
exports.autoRechargeTargetTypeSchema = zod_1.z.enum(['addon', 'credit_grant']);
|
|
31
|
+
exports.autoRechargeThresholdTypeSchema = zod_1.z.enum(['percentage', 'remaining_amount']);
|
|
32
|
+
exports.autoRechargeFeatureDefaultSchema = zod_1.z.discriminatedUnion('enabled', [
|
|
33
|
+
zod_1.z.object({
|
|
34
|
+
enabled: zod_1.z.literal(true),
|
|
35
|
+
addonId: zod_1.z.string(),
|
|
36
|
+
targetType: exports.autoRechargeTargetTypeSchema,
|
|
37
|
+
thresholdType: exports.autoRechargeThresholdTypeSchema,
|
|
38
|
+
threshold: zod_1.z.number(),
|
|
39
|
+
chunkSize: zod_1.z.number().nullable(),
|
|
40
|
+
maxAmount: zod_1.z.number().nullable(),
|
|
41
|
+
}),
|
|
42
|
+
zod_1.z.object({
|
|
43
|
+
enabled: zod_1.z.literal(false),
|
|
44
|
+
}),
|
|
45
|
+
]);
|
|
30
46
|
exports.planSchema = zod_1.z.object({
|
|
31
47
|
id: zod_1.z.string(),
|
|
32
48
|
name: zod_1.z.string(),
|
|
@@ -35,6 +51,7 @@ exports.planSchema = zod_1.z.object({
|
|
|
35
51
|
prices: zod_1.z.record(exports.intervalSchema, exports.priceSchema),
|
|
36
52
|
features: zod_1.z.record(exports.featureSchema, zod_1.z.union([zod_1.z.number(), zod_1.z.boolean()])),
|
|
37
53
|
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
|
|
54
|
+
autoRechargeSettings: zod_1.z.record(exports.featureSchema, exports.autoRechargeFeatureDefaultSchema).optional(),
|
|
38
55
|
providerProductId: zod_1.z.string(), // pulumi
|
|
39
56
|
});
|
|
40
57
|
exports.addOnSchema = zod_1.z.object({
|
|
@@ -1,6 +1,47 @@
|
|
|
1
|
+
import { BillingFeatureId } from '../features';
|
|
2
|
+
import { AutoRechargeFeatureDefault } from './schemas';
|
|
1
3
|
export declare function entitlementsForConversations(conversations: number): {
|
|
2
4
|
incoming_messages_events: number;
|
|
3
5
|
ai_spend: number;
|
|
4
6
|
conversation_sessions: number;
|
|
5
7
|
};
|
|
8
|
+
/** Plans on managed/custom contracts don't get self-serve auto-recharge. */
|
|
9
|
+
export declare function disabledAutoRechargeDefaults(): {
|
|
10
|
+
conversation_sessions: {
|
|
11
|
+
enabled: false;
|
|
12
|
+
};
|
|
13
|
+
ai_spend: {
|
|
14
|
+
enabled: false;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare function enabledAutoRechargeDefaults(): {
|
|
18
|
+
conversation_sessions: {
|
|
19
|
+
enabled: true;
|
|
20
|
+
addonId: string;
|
|
21
|
+
targetType: "addon";
|
|
22
|
+
thresholdType: "percentage";
|
|
23
|
+
threshold: number;
|
|
24
|
+
chunkSize: null;
|
|
25
|
+
maxAmount: null;
|
|
26
|
+
};
|
|
27
|
+
ai_spend: {
|
|
28
|
+
enabled: true;
|
|
29
|
+
addonId: string;
|
|
30
|
+
targetType: "credit_grant";
|
|
31
|
+
thresholdType: "remaining_amount";
|
|
32
|
+
threshold: number;
|
|
33
|
+
chunkSize: number;
|
|
34
|
+
maxAmount: null;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
type EnabledAutoRechargeFeatureIds<T> = {
|
|
38
|
+
[K in keyof T]: T[K] extends {
|
|
39
|
+
enabled: true;
|
|
40
|
+
} ? K : never;
|
|
41
|
+
}[keyof T];
|
|
42
|
+
/** Overrides a single feature's auto-recharge settings on top of an existing (enabled) default. */
|
|
43
|
+
export declare function withAutoRechargeOverride<T extends Partial<Record<BillingFeatureId, AutoRechargeFeatureDefault>>, F extends EnabledAutoRechargeFeatureIds<T> & keyof T>(defaults: T, featureId: F, overrides: Partial<Omit<Extract<T[F], {
|
|
44
|
+
enabled: true;
|
|
45
|
+
}>, 'enabled'>>): T;
|
|
46
|
+
export {};
|
|
6
47
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.entitlementsForConversations = entitlementsForConversations;
|
|
4
|
+
exports.disabledAutoRechargeDefaults = disabledAutoRechargeDefaults;
|
|
5
|
+
exports.enabledAutoRechargeDefaults = enabledAutoRechargeDefaults;
|
|
6
|
+
exports.withAutoRechargeOverride = withAutoRechargeOverride;
|
|
4
7
|
const consts_1 = require("../consts");
|
|
5
8
|
function entitlementsForConversations(conversations) {
|
|
6
9
|
return {
|
|
@@ -9,3 +12,36 @@ function entitlementsForConversations(conversations) {
|
|
|
9
12
|
conversation_sessions: conversations,
|
|
10
13
|
};
|
|
11
14
|
}
|
|
15
|
+
/** Plans on managed/custom contracts don't get self-serve auto-recharge. */
|
|
16
|
+
function disabledAutoRechargeDefaults() {
|
|
17
|
+
return {
|
|
18
|
+
conversation_sessions: { enabled: false },
|
|
19
|
+
ai_spend: { enabled: false },
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function enabledAutoRechargeDefaults() {
|
|
23
|
+
return {
|
|
24
|
+
conversation_sessions: {
|
|
25
|
+
enabled: true,
|
|
26
|
+
addonId: 'conversation_sessions_addon',
|
|
27
|
+
targetType: 'addon',
|
|
28
|
+
thresholdType: 'percentage',
|
|
29
|
+
threshold: 95,
|
|
30
|
+
chunkSize: null,
|
|
31
|
+
maxAmount: null,
|
|
32
|
+
},
|
|
33
|
+
ai_spend: {
|
|
34
|
+
enabled: true,
|
|
35
|
+
addonId: 'ai_spend_credit_grant',
|
|
36
|
+
targetType: 'credit_grant',
|
|
37
|
+
thresholdType: 'remaining_amount',
|
|
38
|
+
threshold: 500 * consts_1.NANO_DOLLAR_PER_CENT,
|
|
39
|
+
chunkSize: 1000 * consts_1.NANO_DOLLAR_PER_CENT,
|
|
40
|
+
maxAmount: null,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** Overrides a single feature's auto-recharge settings on top of an existing (enabled) default. */
|
|
45
|
+
function withAutoRechargeOverride(defaults, featureId, overrides) {
|
|
46
|
+
return { ...defaults, [featureId]: { ...defaults[featureId], ...overrides } };
|
|
47
|
+
}
|
|
@@ -25,6 +25,14 @@ export declare const v4Plans: {
|
|
|
25
25
|
readonly ai_spend: number;
|
|
26
26
|
readonly conversation_sessions: 100;
|
|
27
27
|
};
|
|
28
|
+
readonly autoRechargeSettings: {
|
|
29
|
+
conversation_sessions: {
|
|
30
|
+
enabled: false;
|
|
31
|
+
};
|
|
32
|
+
ai_spend: {
|
|
33
|
+
enabled: false;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
28
36
|
readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
|
|
29
37
|
};
|
|
30
38
|
readonly plus: {
|
|
@@ -58,6 +66,26 @@ export declare const v4Plans: {
|
|
|
58
66
|
readonly ai_spend: number;
|
|
59
67
|
readonly conversation_sessions: 250;
|
|
60
68
|
};
|
|
69
|
+
readonly autoRechargeSettings: {
|
|
70
|
+
conversation_sessions: {
|
|
71
|
+
enabled: true;
|
|
72
|
+
addonId: string;
|
|
73
|
+
targetType: "addon";
|
|
74
|
+
thresholdType: "percentage";
|
|
75
|
+
threshold: number;
|
|
76
|
+
chunkSize: null;
|
|
77
|
+
maxAmount: null;
|
|
78
|
+
};
|
|
79
|
+
ai_spend: {
|
|
80
|
+
enabled: true;
|
|
81
|
+
addonId: string;
|
|
82
|
+
targetType: "credit_grant";
|
|
83
|
+
thresholdType: "remaining_amount";
|
|
84
|
+
threshold: number;
|
|
85
|
+
chunkSize: number;
|
|
86
|
+
maxAmount: null;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
61
89
|
readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
|
|
62
90
|
};
|
|
63
91
|
readonly team: {
|
|
@@ -91,6 +119,26 @@ export declare const v4Plans: {
|
|
|
91
119
|
readonly ai_spend: number;
|
|
92
120
|
readonly conversation_sessions: 1500;
|
|
93
121
|
};
|
|
122
|
+
readonly autoRechargeSettings: {
|
|
123
|
+
conversation_sessions: {
|
|
124
|
+
enabled: true;
|
|
125
|
+
addonId: string;
|
|
126
|
+
targetType: "addon";
|
|
127
|
+
thresholdType: "percentage";
|
|
128
|
+
threshold: number;
|
|
129
|
+
chunkSize: null;
|
|
130
|
+
maxAmount: null;
|
|
131
|
+
};
|
|
132
|
+
ai_spend: {
|
|
133
|
+
enabled: true;
|
|
134
|
+
addonId: string;
|
|
135
|
+
targetType: "credit_grant";
|
|
136
|
+
thresholdType: "remaining_amount";
|
|
137
|
+
threshold: number;
|
|
138
|
+
chunkSize: number;
|
|
139
|
+
maxAmount: null;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
94
142
|
readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
|
|
95
143
|
};
|
|
96
144
|
readonly enterprise: {
|
|
@@ -118,6 +166,14 @@ export declare const v4Plans: {
|
|
|
118
166
|
ai_spend: number;
|
|
119
167
|
conversation_sessions: number;
|
|
120
168
|
};
|
|
169
|
+
readonly autoRechargeSettings: {
|
|
170
|
+
conversation_sessions: {
|
|
171
|
+
enabled: false;
|
|
172
|
+
};
|
|
173
|
+
ai_spend: {
|
|
174
|
+
enabled: false;
|
|
175
|
+
};
|
|
176
|
+
};
|
|
121
177
|
readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
|
|
122
178
|
};
|
|
123
179
|
readonly managed: {
|
|
@@ -145,6 +201,14 @@ export declare const v4Plans: {
|
|
|
145
201
|
ai_spend: number;
|
|
146
202
|
conversation_sessions: number;
|
|
147
203
|
};
|
|
204
|
+
readonly autoRechargeSettings: {
|
|
205
|
+
conversation_sessions: {
|
|
206
|
+
enabled: false;
|
|
207
|
+
};
|
|
208
|
+
ai_spend: {
|
|
209
|
+
enabled: false;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
148
212
|
readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
|
|
149
213
|
};
|
|
150
214
|
};
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.v4Plans = void 0;
|
|
4
4
|
const consts_1 = require("../../consts");
|
|
5
5
|
const schemas_1 = require("../schemas");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
6
7
|
const ENTERPRISE_PLAN_FEATURES = {
|
|
7
8
|
table_rows: 0,
|
|
8
9
|
bot_count: consts_1.SMALL_UNLIMITED,
|
|
@@ -42,6 +43,7 @@ exports.v4Plans = {
|
|
|
42
43
|
ai_spend: 100 * consts_1.AI_SPEND_PER_CONVERSATION,
|
|
43
44
|
conversation_sessions: 100,
|
|
44
45
|
},
|
|
46
|
+
autoRechargeSettings: (0, utils_1.disabledAutoRechargeDefaults)(),
|
|
45
47
|
providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
|
|
46
48
|
},
|
|
47
49
|
plus: {
|
|
@@ -75,6 +77,7 @@ exports.v4Plans = {
|
|
|
75
77
|
ai_spend: 250 * consts_1.AI_SPEND_PER_CONVERSATION,
|
|
76
78
|
conversation_sessions: 250,
|
|
77
79
|
},
|
|
80
|
+
autoRechargeSettings: (0, utils_1.enabledAutoRechargeDefaults)(),
|
|
78
81
|
providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
|
|
79
82
|
},
|
|
80
83
|
team: {
|
|
@@ -108,6 +111,7 @@ exports.v4Plans = {
|
|
|
108
111
|
ai_spend: 1_500 * consts_1.AI_SPEND_PER_CONVERSATION,
|
|
109
112
|
conversation_sessions: 1_500,
|
|
110
113
|
},
|
|
114
|
+
autoRechargeSettings: (0, utils_1.enabledAutoRechargeDefaults)(),
|
|
111
115
|
providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
|
|
112
116
|
},
|
|
113
117
|
enterprise: {
|
|
@@ -124,6 +128,7 @@ exports.v4Plans = {
|
|
|
124
128
|
},
|
|
125
129
|
},
|
|
126
130
|
features: ENTERPRISE_PLAN_FEATURES,
|
|
131
|
+
autoRechargeSettings: (0, utils_1.disabledAutoRechargeDefaults)(),
|
|
127
132
|
providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
|
|
128
133
|
},
|
|
129
134
|
managed: {
|
|
@@ -140,6 +145,7 @@ exports.v4Plans = {
|
|
|
140
145
|
},
|
|
141
146
|
},
|
|
142
147
|
features: ENTERPRISE_PLAN_FEATURES,
|
|
148
|
+
autoRechargeSettings: (0, utils_1.disabledAutoRechargeDefaults)(),
|
|
143
149
|
providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
|
|
144
150
|
},
|
|
145
151
|
};
|