2
0

🚑 (billing) Fix chats pricing tiers incremental flat amou…

This commit is contained in:
Baptiste Arnaud
2023-10-17 08:32:41 +02:00
parent 797751b418
commit 6b0c263f88
5 changed files with 44 additions and 44 deletions

View File

@@ -46,13 +46,9 @@ export const ChatsProTiersModal = ({ isOpen, onClose }: Props) => {
<Tbody> <Tbody>
{proChatTiers.map((tier, index) => { {proChatTiers.map((tier, index) => {
const pricePerMonth = const pricePerMonth =
proChatTiers (tier.flat_amount ??
.slice(0, index + 1) proChatTiers.at(-2)?.flat_amount ??
.reduce( 0) / 100
(acc, slicedTier) =>
acc + (slicedTier.flat_amount ?? 0),
0
) / 100
return ( return (
<Tr key={tier.up_to}> <Tr key={tier.up_to}>
<Td isNumeric> <Td isNumeric>

View File

@@ -46,13 +46,9 @@ export const ChatsProTiersModal = ({ isOpen, onClose }: Props) => {
<Tbody> <Tbody>
{proChatTiers.map((tier, index) => { {proChatTiers.map((tier, index) => {
const pricePerMonth = const pricePerMonth =
proChatTiers (tier.flat_amount ??
.slice(0, index + 1) proChatTiers.at(-2)?.flat_amount ??
.reduce( 0) / 100
(acc, slicedTier) =>
acc + (slicedTier.flat_amount ?? 0),
0
) / 100
return ( return (
<Tr key={tier.up_to}> <Tr key={tier.up_to}>
<Td isNumeric> <Td isNumeric>

View File

@@ -54,7 +54,7 @@ export const AlmostReachedChatsLimitEmail = ({
<Text> <Text>
As a reminder, your billing cycle ends on {readableResetDate}. If As a reminder, your billing cycle ends on {readableResetDate}. If
you&apos;d like to learn more about the Enterprise plan for an you&apos;d like to learn more about the Enterprise plan for an
annual commitment, reach out to . annual commitment, reach out to support@typebot.io.
</Text> </Text>
</MjmlColumn> </MjmlColumn>
</MjmlSection> </MjmlSection>

View File

@@ -31,15 +31,15 @@ export const starterChatTiers = [
}, },
{ {
up_to: 3000, up_to: 3000,
flat_amount: 1000, flat_amount: 2000,
}, },
{ {
up_to: 3500, up_to: 3500,
flat_amount: 1000, flat_amount: 3000,
}, },
{ {
up_to: 4000, up_to: 4000,
flat_amount: 1000, flat_amount: 4000,
}, },
{ {
up_to: 'inf', up_to: 'inf',
@@ -58,107 +58,107 @@ export const proChatTiers = [
}, },
{ {
up_to: 20000, up_to: 20000,
flat_amount: 4500, flat_amount: 9500,
}, },
{ {
up_to: 30000, up_to: 30000,
flat_amount: 8500, flat_amount: 18000,
}, },
{ {
up_to: 40000, up_to: 40000,
flat_amount: 8000, flat_amount: 26000,
}, },
{ {
up_to: 50000, up_to: 50000,
flat_amount: 7500, flat_amount: 33500,
}, },
{ {
up_to: 60000, up_to: 60000,
flat_amount: 7225, flat_amount: 40700,
}, },
{ {
up_to: 70000, up_to: 70000,
flat_amount: 7000, flat_amount: 47700,
}, },
{ {
up_to: 80000, up_to: 80000,
flat_amount: 6800, flat_amount: 54500,
}, },
{ {
up_to: 90000, up_to: 90000,
flat_amount: 6600, flat_amount: 61100,
}, },
{ {
up_to: 100000, up_to: 100000,
flat_amount: 6400, flat_amount: 67500,
}, },
{ {
up_to: 120000, up_to: 120000,
flat_amount: 12400, flat_amount: 79900,
}, },
{ {
up_to: 140000, up_to: 140000,
flat_amount: 12000, flat_amount: 91900,
}, },
{ {
up_to: 160000, up_to: 160000,
flat_amount: 11800, flat_amount: 103700,
}, },
{ {
up_to: 180000, up_to: 180000,
flat_amount: 11600, flat_amount: 115300,
}, },
{ {
up_to: 200000, up_to: 200000,
flat_amount: 11400, flat_amount: 126700,
}, },
{ {
up_to: 300000, up_to: 300000,
flat_amount: 55000, flat_amount: 181700,
}, },
{ {
up_to: 400000, up_to: 400000,
flat_amount: 53000, flat_amount: 234700,
}, },
{ {
up_to: 500000, up_to: 500000,
flat_amount: 51000, flat_amount: 285700,
}, },
{ {
up_to: 600000, up_to: 600000,
flat_amount: 50000, flat_amount: 335700,
}, },
{ {
up_to: 700000, up_to: 700000,
flat_amount: 49000, flat_amount: 384700,
}, },
{ {
up_to: 800000, up_to: 800000,
flat_amount: 48000, flat_amount: 432700,
}, },
{ {
up_to: 900000, up_to: 900000,
flat_amount: 47000, flat_amount: 479700,
}, },
{ {
up_to: 1000000, up_to: 1000000,
flat_amount: 46000, flat_amount: 525700,
}, },
{ {
up_to: 1200000, up_to: 1200000,
flat_amount: 91400, flat_amount: 617100,
}, },
{ {
up_to: 1400000, up_to: 1400000,
flat_amount: 90800, flat_amount: 707900,
}, },
{ {
up_to: 1600000, up_to: 1600000,
flat_amount: 90000, flat_amount: 797900,
}, },
{ {
up_to: 1800000, up_to: 1800000,
flat_amount: 89400, flat_amount: 887300,
}, },
{ {
up_to: 'inf', up_to: 'inf',

View File

@@ -228,6 +228,14 @@ const migrateSubscriptionsToUsageBased = async () => {
price: proPriceId, price: proPriceId,
quantity: 1, quantity: 1,
}, },
{
id: newSubscription.items.data.find(
(item) =>
item.price.id === starterChatsPriceId ||
item.price.id === proChatsPriceId
)?.id,
price: proChatsPriceId,
},
], ],
}) })