@bpinternal/const 0.34.0 → 0.36.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/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.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;
|
|
@@ -93,6 +160,17 @@ export declare const planSchema: z.ZodObject<{
|
|
|
93
160
|
metadata?: Record<string, string> | undefined;
|
|
94
161
|
}>>;
|
|
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>>;
|
|
163
|
+
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", {
|
|
164
|
+
enabled: true;
|
|
165
|
+
addonId: string;
|
|
166
|
+
targetType: "addon" | "credit_grant";
|
|
167
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
168
|
+
threshold: number;
|
|
169
|
+
chunkSize: number | null;
|
|
170
|
+
maxAmount: number | null;
|
|
171
|
+
} | {
|
|
172
|
+
enabled: false;
|
|
173
|
+
}>>;
|
|
96
174
|
providerProductId: string;
|
|
97
175
|
metadata?: Record<string, string> | undefined;
|
|
98
176
|
}, {
|
|
@@ -108,6 +186,17 @@ export declare const planSchema: z.ZodObject<{
|
|
|
108
186
|
metadata?: Record<string, string> | undefined;
|
|
109
187
|
}>>;
|
|
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>>;
|
|
189
|
+
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", {
|
|
190
|
+
enabled: true;
|
|
191
|
+
addonId: string;
|
|
192
|
+
targetType: "addon" | "credit_grant";
|
|
193
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
194
|
+
threshold: number;
|
|
195
|
+
chunkSize: number | null;
|
|
196
|
+
maxAmount: number | null;
|
|
197
|
+
} | {
|
|
198
|
+
enabled: false;
|
|
199
|
+
}>>;
|
|
111
200
|
providerProductId: string;
|
|
112
201
|
metadata?: Record<string, string> | undefined;
|
|
113
202
|
}>;
|
|
@@ -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.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;
|
|
@@ -286,6 +406,17 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
286
406
|
metadata?: Record<string, string> | undefined;
|
|
287
407
|
}>>;
|
|
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>>;
|
|
409
|
+
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", {
|
|
410
|
+
enabled: true;
|
|
411
|
+
addonId: string;
|
|
412
|
+
targetType: "addon" | "credit_grant";
|
|
413
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
414
|
+
threshold: number;
|
|
415
|
+
chunkSize: number | null;
|
|
416
|
+
maxAmount: number | null;
|
|
417
|
+
} | {
|
|
418
|
+
enabled: false;
|
|
419
|
+
}>>;
|
|
289
420
|
providerProductId: string;
|
|
290
421
|
metadata?: Record<string, string> | undefined;
|
|
291
422
|
}, {
|
|
@@ -301,6 +432,17 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
301
432
|
metadata?: Record<string, string> | undefined;
|
|
302
433
|
}>>;
|
|
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>>;
|
|
435
|
+
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", {
|
|
436
|
+
enabled: true;
|
|
437
|
+
addonId: string;
|
|
438
|
+
targetType: "addon" | "credit_grant";
|
|
439
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
440
|
+
threshold: number;
|
|
441
|
+
chunkSize: number | null;
|
|
442
|
+
maxAmount: number | null;
|
|
443
|
+
} | {
|
|
444
|
+
enabled: false;
|
|
445
|
+
}>>;
|
|
304
446
|
providerProductId: string;
|
|
305
447
|
metadata?: Record<string, string> | undefined;
|
|
306
448
|
}>>;
|
|
@@ -451,6 +593,17 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
451
593
|
metadata?: Record<string, string> | undefined;
|
|
452
594
|
}>>;
|
|
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>>;
|
|
596
|
+
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", {
|
|
597
|
+
enabled: true;
|
|
598
|
+
addonId: string;
|
|
599
|
+
targetType: "addon" | "credit_grant";
|
|
600
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
601
|
+
threshold: number;
|
|
602
|
+
chunkSize: number | null;
|
|
603
|
+
maxAmount: number | null;
|
|
604
|
+
} | {
|
|
605
|
+
enabled: false;
|
|
606
|
+
}>>;
|
|
454
607
|
providerProductId: string;
|
|
455
608
|
metadata?: Record<string, string> | undefined;
|
|
456
609
|
}>;
|
|
@@ -509,6 +662,17 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
509
662
|
metadata?: Record<string, string> | undefined;
|
|
510
663
|
}>>;
|
|
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>>;
|
|
665
|
+
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", {
|
|
666
|
+
enabled: true;
|
|
667
|
+
addonId: string;
|
|
668
|
+
targetType: "addon" | "credit_grant";
|
|
669
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
670
|
+
threshold: number;
|
|
671
|
+
chunkSize: number | null;
|
|
672
|
+
maxAmount: number | null;
|
|
673
|
+
} | {
|
|
674
|
+
enabled: false;
|
|
675
|
+
}>>;
|
|
512
676
|
providerProductId: string;
|
|
513
677
|
metadata?: Record<string, string> | undefined;
|
|
514
678
|
}>;
|
|
@@ -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.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;
|
|
@@ -596,6 +791,17 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
596
791
|
metadata?: Record<string, string> | undefined;
|
|
597
792
|
}>>;
|
|
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>>;
|
|
794
|
+
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", {
|
|
795
|
+
enabled: true;
|
|
796
|
+
addonId: string;
|
|
797
|
+
targetType: "addon" | "credit_grant";
|
|
798
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
799
|
+
threshold: number;
|
|
800
|
+
chunkSize: number | null;
|
|
801
|
+
maxAmount: number | null;
|
|
802
|
+
} | {
|
|
803
|
+
enabled: false;
|
|
804
|
+
}>>;
|
|
599
805
|
providerProductId: string;
|
|
600
806
|
metadata?: Record<string, string> | undefined;
|
|
601
807
|
}, {
|
|
@@ -611,6 +817,17 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
611
817
|
metadata?: Record<string, string> | undefined;
|
|
612
818
|
}>>;
|
|
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>>;
|
|
820
|
+
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", {
|
|
821
|
+
enabled: true;
|
|
822
|
+
addonId: string;
|
|
823
|
+
targetType: "addon" | "credit_grant";
|
|
824
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
825
|
+
threshold: number;
|
|
826
|
+
chunkSize: number | null;
|
|
827
|
+
maxAmount: number | null;
|
|
828
|
+
} | {
|
|
829
|
+
enabled: false;
|
|
830
|
+
}>>;
|
|
614
831
|
providerProductId: string;
|
|
615
832
|
metadata?: Record<string, string> | undefined;
|
|
616
833
|
}>>;
|
|
@@ -761,6 +978,17 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
761
978
|
metadata?: Record<string, string> | undefined;
|
|
762
979
|
}>>;
|
|
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>>;
|
|
981
|
+
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", {
|
|
982
|
+
enabled: true;
|
|
983
|
+
addonId: string;
|
|
984
|
+
targetType: "addon" | "credit_grant";
|
|
985
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
986
|
+
threshold: number;
|
|
987
|
+
chunkSize: number | null;
|
|
988
|
+
maxAmount: number | null;
|
|
989
|
+
} | {
|
|
990
|
+
enabled: false;
|
|
991
|
+
}>>;
|
|
764
992
|
providerProductId: string;
|
|
765
993
|
metadata?: Record<string, string> | undefined;
|
|
766
994
|
}>;
|
|
@@ -819,6 +1047,17 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
819
1047
|
metadata?: Record<string, string> | undefined;
|
|
820
1048
|
}>>;
|
|
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>>;
|
|
1050
|
+
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", {
|
|
1051
|
+
enabled: true;
|
|
1052
|
+
addonId: string;
|
|
1053
|
+
targetType: "addon" | "credit_grant";
|
|
1054
|
+
thresholdType: "percentage" | "remaining_amount";
|
|
1055
|
+
threshold: number;
|
|
1056
|
+
chunkSize: number | null;
|
|
1057
|
+
maxAmount: number | null;
|
|
1058
|
+
} | {
|
|
1059
|
+
enabled: false;
|
|
1060
|
+
}>>;
|
|
822
1061
|
providerProductId: string;
|
|
823
1062
|
metadata?: Record<string, string> | undefined;
|
|
824
1063
|
}>;
|
|
@@ -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),
|
|
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
|
};
|