@bpinternal/const 0.17.0 → 0.19.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.
@@ -1,183 +1,56 @@
1
1
  export type BillingAddonId = keyof typeof addons;
2
2
  export declare const addons: {
3
- readonly bot_addon: {
4
- readonly id: "bot_addon";
5
- readonly name: "Add-on - Bot";
6
- readonly description: "Add one more bot to your workspace";
7
- readonly prices: {
8
- readonly month: {
9
- readonly amount: 10;
10
- readonly currency: "usd";
11
- readonly interval: "month";
12
- readonly providerPriceId: "__UNKNOWN_STRIPE_ID__";
13
- };
14
- };
15
- readonly feature: "bot_count";
16
- readonly increment: 1;
17
- readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
18
- };
19
- readonly collaborator_addon: {
20
- readonly id: "collaborator_addon";
21
- readonly name: "Add-on - Collaborators";
22
- readonly description: "Add one more collaborator to your workspace";
23
- readonly prices: {
24
- readonly month: {
25
- readonly amount: 25;
26
- readonly currency: "usd";
27
- readonly interval: "month";
28
- readonly providerPriceId: "__UNKNOWN_STRIPE_ID__";
29
- };
30
- };
31
- readonly feature: "collaborator_count";
32
- readonly increment: 1;
33
- readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
34
- };
35
- readonly messages_events_addon: {
36
- readonly id: "messages_events_addon";
37
- readonly name: "Add-on - Messages & Events";
38
- readonly description: "Adds 5,000 messages and events";
39
- readonly prorationDisabled: true;
40
- readonly prices: {
41
- readonly month: {
42
- readonly amount: 20;
43
- readonly currency: "usd";
44
- readonly interval: "month";
45
- readonly providerPriceId: "__UNKNOWN_STRIPE_ID__";
46
- };
47
- };
48
- readonly feature: "incoming_messages_events";
49
- readonly increment: 5000;
50
- readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
51
- };
52
- readonly table_rows_addon: {
53
- readonly id: "table_rows_addon";
54
- readonly name: "Add-on - Table Rows";
55
- readonly description: "Adds 100,000 additional table rows";
56
- readonly prices: {
57
- readonly month: {
58
- readonly amount: 25;
59
- readonly currency: "usd";
60
- readonly interval: "month";
61
- readonly providerPriceId: "__UNKNOWN_STRIPE_ID__";
62
- };
63
- };
64
- readonly feature: "table_rows";
65
- readonly increment: 100000;
66
- readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
67
- };
68
- readonly file_storage_addon: {
69
- readonly id: "file_storage_addon";
70
- readonly name: "Add-on - File Storage";
71
- readonly description: "Adds 10GB of File Storage";
72
- readonly prices: {
73
- readonly month: {
74
- readonly amount: 10;
75
- readonly currency: "usd";
76
- readonly interval: "month";
77
- readonly providerPriceId: "__UNKNOWN_STRIPE_ID__";
78
- };
79
- };
80
- readonly feature: "file_storage";
81
- readonly increment: 10000000000;
82
- readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
83
- };
84
- readonly vector_db_storage_addon: {
85
- readonly id: "vector_db_storage_addon";
86
- readonly name: "Add-on - Vector DB Storage";
87
- readonly description: "Add 1 GB of vector database storage";
88
- readonly prices: {
89
- readonly month: {
90
- readonly amount: 20;
91
- readonly currency: "usd";
92
- readonly interval: "month";
93
- readonly providerPriceId: "__UNKNOWN_STRIPE_ID__";
94
- };
95
- };
96
- readonly feature: "vector_db_storage";
97
- readonly increment: 1000000000;
98
- readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
99
- };
100
- readonly web_search_addon: {
101
- readonly id: "web_search_addon";
102
- readonly name: "Web Search and Crawl";
103
- readonly description: "Web search and crawl functionality";
104
- readonly prices: {
105
- readonly month: {
106
- readonly amount: 10;
107
- readonly currency: "usd";
108
- readonly interval: "month";
109
- readonly providerPriceId: "__UNKNOWN_STRIPE_ID__";
110
- };
111
- };
112
- readonly feature: "integration_spend";
113
- readonly increment: 10000000000;
114
- readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
115
- };
116
- readonly ai_credits_addon: {
117
- readonly id: "ai_credits_addon";
118
- readonly name: "AI Tokens";
119
- readonly description: "Add $25 worth of AI credits";
120
- readonly prices: {
121
- readonly month: {
122
- readonly amount: 25;
123
- readonly currency: "usd";
124
- readonly interval: "month";
125
- readonly providerPriceId: "__UNKNOWN_STRIPE_ID__";
126
- };
127
- };
128
- readonly feature: "integration_spend";
129
- readonly increment: 25000000000;
130
- readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
131
- };
132
- readonly enterprise_ai_token: {
133
- readonly id: "enterprise_ai_token";
134
- readonly name: "Enterprise - AI Token";
135
- readonly description: "Enterprise AI token credits";
136
- readonly prices: {
137
- readonly month: {
138
- readonly amount: -1;
139
- readonly currency: "usd";
140
- readonly interval: "month";
141
- readonly providerPriceId: "__UNKNOWN_STRIPE_ID__";
142
- };
143
- };
144
- readonly feature: "integration_spend";
145
- readonly increment: 100000000000;
146
- readonly hidden: true;
147
- readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
148
- };
149
- readonly enterprise_additional_workspace: {
150
- readonly id: "enterprise_additional_workspace";
151
- readonly name: "Enterprise - Additional Workspace";
152
- readonly description: "Enterprise additional workspace";
153
- readonly prices: {
154
- readonly month: {
155
- readonly amount: -1;
156
- readonly currency: "usd";
157
- readonly interval: "month";
158
- readonly providerPriceId: "__UNKNOWN_STRIPE_ID__";
159
- };
160
- };
161
- readonly feature: "collaborator_count";
162
- readonly increment: 10;
163
- readonly hidden: true;
164
- readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
165
- };
166
3
  readonly conversation_sessions_addon: {
167
4
  readonly id: "conversation_sessions_addon";
168
5
  readonly name: "Add-on - Conversation Sessions";
169
6
  readonly description: "Adds 500 conversations sessions per month";
170
- readonly prices: {
171
- readonly month: {
172
- readonly amount: 20;
173
- readonly currency: "usd";
174
- readonly interval: "month";
175
- readonly providerPriceId: "__UNKNOWN_STRIPE_ID__";
176
- };
7
+ readonly prices: Record<string, {
8
+ month: {
9
+ amount: number;
10
+ currency: "usd";
11
+ interval: "month" | "year";
12
+ providerPriceId: string;
13
+ metadata?: Record<string, string> | undefined;
14
+ };
15
+ year?: {
16
+ amount: number;
17
+ currency: "usd";
18
+ interval: "month" | "year";
19
+ providerPriceId: string;
20
+ metadata?: Record<string, string> | undefined;
21
+ } | undefined;
22
+ }>;
23
+ readonly increments: {
24
+ readonly conversation_sessions: 500;
177
25
  };
178
- readonly feature: "conversation_sessions";
179
- readonly increment: 500;
180
26
  readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
181
27
  readonly autoRechargeable: true;
182
28
  };
29
+ readonly storage_addon: {
30
+ readonly id: "storage_addon";
31
+ readonly name: "Add-on - Storage";
32
+ readonly description: "Adds table rows, vector db space and files";
33
+ readonly prices: Record<string, {
34
+ month: {
35
+ amount: number;
36
+ currency: "usd";
37
+ interval: "month" | "year";
38
+ providerPriceId: string;
39
+ metadata?: Record<string, string> | undefined;
40
+ };
41
+ year?: {
42
+ amount: number;
43
+ currency: "usd";
44
+ interval: "month" | "year";
45
+ providerPriceId: string;
46
+ metadata?: Record<string, string> | undefined;
47
+ } | undefined;
48
+ }>;
49
+ readonly increments: {
50
+ readonly table_rows: 100000;
51
+ readonly vector_db_storage: number;
52
+ readonly file_storage: number;
53
+ };
54
+ readonly providerProductId: "__UNKNOWN_STRIPE_ID__";
55
+ };
183
56
  };
@@ -3,186 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addons = void 0;
4
4
  const consts_1 = require("../consts");
5
5
  const schemas_1 = require("./schemas");
6
- /* IMPORTANT: the `name` field is used to match existing products in Stripe DO NOT CHANGE THE NAME OF AN EXISTING PRODUCT */
7
- exports.addons = {
8
- bot_addon: {
9
- id: 'bot_addon',
10
- name: 'Add-on - Bot',
11
- description: 'Add one more bot to your workspace',
12
- prices: {
13
- month: {
14
- amount: 10,
15
- currency: 'usd',
16
- interval: 'month',
17
- providerPriceId: schemas_1.UNKNOWN_STRIPE_ID,
18
- },
19
- },
20
- feature: 'bot_count',
21
- increment: 1,
22
- providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
23
- },
24
- collaborator_addon: {
25
- id: 'collaborator_addon',
26
- name: 'Add-on - Collaborators',
27
- description: 'Add one more collaborator to your workspace',
28
- prices: {
29
- month: {
30
- amount: 25,
31
- currency: 'usd',
32
- interval: 'month',
33
- providerPriceId: schemas_1.UNKNOWN_STRIPE_ID,
34
- },
35
- },
36
- feature: 'collaborator_count',
37
- increment: 1,
38
- providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
39
- },
40
- messages_events_addon: {
41
- id: 'messages_events_addon',
42
- name: 'Add-on - Messages & Events',
43
- description: 'Adds 5,000 messages and events',
44
- prorationDisabled: true,
45
- prices: {
46
- month: {
47
- amount: 20,
48
- currency: 'usd',
49
- interval: 'month',
50
- providerPriceId: schemas_1.UNKNOWN_STRIPE_ID,
51
- },
52
- },
53
- feature: 'incoming_messages_events',
54
- increment: 5000,
55
- providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
56
- },
57
- table_rows_addon: {
58
- id: 'table_rows_addon',
59
- name: 'Add-on - Table Rows',
60
- description: 'Adds 100,000 additional table rows',
61
- prices: {
62
- month: {
63
- amount: 25,
64
- currency: 'usd',
65
- interval: 'month',
66
- providerPriceId: schemas_1.UNKNOWN_STRIPE_ID,
67
- },
68
- },
69
- feature: 'table_rows',
70
- increment: 100000,
71
- providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
72
- },
73
- file_storage_addon: {
74
- id: 'file_storage_addon',
75
- name: 'Add-on - File Storage',
76
- description: 'Adds 10GB of File Storage',
77
- prices: {
78
- month: {
79
- amount: 10,
80
- currency: 'usd',
81
- interval: 'month',
82
- providerPriceId: schemas_1.UNKNOWN_STRIPE_ID,
83
- },
84
- },
85
- feature: 'file_storage',
86
- increment: 10_000_000_000, // 10 GB
87
- providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
88
- },
89
- vector_db_storage_addon: {
90
- id: 'vector_db_storage_addon',
91
- name: 'Add-on - Vector DB Storage',
92
- description: 'Add 1 GB of vector database storage',
93
- prices: {
94
- month: {
95
- amount: 20,
96
- currency: 'usd',
97
- interval: 'month',
98
- providerPriceId: schemas_1.UNKNOWN_STRIPE_ID,
99
- },
100
- },
101
- feature: 'vector_db_storage',
102
- increment: 1_000_000_000, // 1 GB
103
- providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
104
- },
105
- web_search_addon: {
106
- id: 'web_search_addon',
107
- name: 'Web Search and Crawl',
108
- description: 'Web search and crawl functionality',
109
- prices: {
110
- month: {
111
- amount: 10,
112
- currency: 'usd',
113
- interval: 'month',
114
- providerPriceId: schemas_1.UNKNOWN_STRIPE_ID,
115
- },
116
- },
117
- feature: 'integration_spend',
118
- increment: 10_000_000_000, // $10 in nano-dollars
119
- providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
120
- },
121
- ai_credits_addon: {
122
- id: 'ai_credits_addon',
123
- name: 'AI Tokens',
124
- description: 'Add $25 worth of AI credits',
125
- prices: {
126
- month: {
127
- amount: 25,
128
- currency: 'usd',
129
- interval: 'month',
130
- providerPriceId: schemas_1.UNKNOWN_STRIPE_ID,
131
- },
132
- },
133
- feature: 'integration_spend',
134
- increment: 25_000_000_000, // $25 in nano-dollars
135
- providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
136
- },
137
- enterprise_ai_token: {
138
- id: 'enterprise_ai_token',
139
- name: 'Enterprise - AI Token',
140
- description: 'Enterprise AI token credits',
141
- prices: {
6
+ const constantMonthlyPrice = (amount, scope = ['community', 'plus', 'team', 'enterprise', 'managed']) => {
7
+ return scope
8
+ .map((plan) => ({
9
+ [plan]: {
142
10
  month: {
143
- amount: consts_1.FREE_PRICE, // Custom pricing
11
+ amount,
144
12
  currency: 'usd',
145
13
  interval: 'month',
146
14
  providerPriceId: schemas_1.UNKNOWN_STRIPE_ID,
147
15
  },
148
16
  },
149
- feature: 'integration_spend',
150
- increment: 100_000_000_000, // $100 in nano-dollars
151
- hidden: true,
152
- providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
153
- },
154
- enterprise_additional_workspace: {
155
- id: 'enterprise_additional_workspace',
156
- name: 'Enterprise - Additional Workspace',
157
- description: 'Enterprise additional workspace',
158
- prices: {
159
- month: {
160
- amount: consts_1.FREE_PRICE, // Custom pricing
161
- currency: 'usd',
162
- interval: 'month',
163
- providerPriceId: schemas_1.UNKNOWN_STRIPE_ID,
164
- },
165
- },
166
- feature: 'collaborator_count',
167
- increment: 10,
168
- hidden: true,
169
- providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
170
- },
17
+ }))
18
+ .reduce((acc, curr) => ({ ...acc, ...curr }), {});
19
+ };
20
+ /* IMPORTANT: the `name` field is used to match existing products in Stripe DO NOT CHANGE THE NAME OF AN EXISTING PRODUCT */
21
+ exports.addons = {
171
22
  conversation_sessions_addon: {
172
23
  id: 'conversation_sessions_addon',
173
24
  name: 'Add-on - Conversation Sessions',
174
25
  description: 'Adds 500 conversations sessions per month',
175
- prices: {
176
- month: {
177
- amount: 20,
178
- currency: 'usd',
179
- interval: 'month',
180
- providerPriceId: schemas_1.UNKNOWN_STRIPE_ID,
181
- },
182
- },
183
- feature: 'conversation_sessions',
184
- increment: 500, // not sure about this number
26
+ prices: constantMonthlyPrice(20),
27
+ increments: { conversation_sessions: 500 },
185
28
  providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
186
29
  autoRechargeable: true,
187
30
  },
31
+ storage_addon: {
32
+ id: 'storage_addon',
33
+ name: 'Add-on - Storage',
34
+ description: 'Adds table rows, vector db space and files',
35
+ prices: constantMonthlyPrice(40),
36
+ increments: {
37
+ table_rows: 100_000,
38
+ vector_db_storage: 1 * consts_1.GB,
39
+ file_storage: 10 * consts_1.GB,
40
+ },
41
+ providerProductId: schemas_1.UNKNOWN_STRIPE_ID,
42
+ },
188
43
  };