Skip to content

Commit

Permalink
🚑 (billing) Fix chats pricing tiers incremental flat amou…
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Oct 17, 2023
1 parent 797751b commit 6b0c263
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,9 @@ export const ChatsProTiersModal = ({ isOpen, onClose }: Props) => {
<Tbody>
{proChatTiers.map((tier, index) => {
const pricePerMonth =
proChatTiers
.slice(0, index + 1)
.reduce(
(acc, slicedTier) =>
acc + (slicedTier.flat_amount ?? 0),
0
) / 100
(tier.flat_amount ??
proChatTiers.at(-2)?.flat_amount ??
0) / 100
return (
<Tr key={tier.up_to}>
<Td isNumeric>
Expand Down
10 changes: 3 additions & 7 deletions apps/landing-page/components/PricingPage/ChatsProTiersModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,9 @@ export const ChatsProTiersModal = ({ isOpen, onClose }: Props) => {
<Tbody>
{proChatTiers.map((tier, index) => {
const pricePerMonth =
proChatTiers
.slice(0, index + 1)
.reduce(
(acc, slicedTier) =>
acc + (slicedTier.flat_amount ?? 0),
0
) / 100
(tier.flat_amount ??
proChatTiers.at(-2)?.flat_amount ??
0) / 100
return (
<Tr key={tier.up_to}>
<Td isNumeric>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const AlmostReachedChatsLimitEmail = ({
<Text>
As a reminder, your billing cycle ends on {readableResetDate}. If
you&apos;d like to learn more about the Enterprise plan for an
annual commitment, reach out to .
annual commitment, reach out to [email protected].
</Text>
</MjmlColumn>
</MjmlSection>
Expand Down
58 changes: 29 additions & 29 deletions packages/lib/billing/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ export const starterChatTiers = [
},
{
up_to: 3000,
flat_amount: 1000,
flat_amount: 2000,
},
{
up_to: 3500,
flat_amount: 1000,
flat_amount: 3000,
},
{
up_to: 4000,
flat_amount: 1000,
flat_amount: 4000,
},
{
up_to: 'inf',
Expand All @@ -58,107 +58,107 @@ export const proChatTiers = [
},
{
up_to: 20000,
flat_amount: 4500,
flat_amount: 9500,
},
{
up_to: 30000,
flat_amount: 8500,
flat_amount: 18000,
},
{
up_to: 40000,
flat_amount: 8000,
flat_amount: 26000,
},
{
up_to: 50000,
flat_amount: 7500,
flat_amount: 33500,
},
{
up_to: 60000,
flat_amount: 7225,
flat_amount: 40700,
},
{
up_to: 70000,
flat_amount: 7000,
flat_amount: 47700,
},
{
up_to: 80000,
flat_amount: 6800,
flat_amount: 54500,
},
{
up_to: 90000,
flat_amount: 6600,
flat_amount: 61100,
},
{
up_to: 100000,
flat_amount: 6400,
flat_amount: 67500,
},
{
up_to: 120000,
flat_amount: 12400,
flat_amount: 79900,
},
{
up_to: 140000,
flat_amount: 12000,
flat_amount: 91900,
},
{
up_to: 160000,
flat_amount: 11800,
flat_amount: 103700,
},
{
up_to: 180000,
flat_amount: 11600,
flat_amount: 115300,
},
{
up_to: 200000,
flat_amount: 11400,
flat_amount: 126700,
},
{
up_to: 300000,
flat_amount: 55000,
flat_amount: 181700,
},
{
up_to: 400000,
flat_amount: 53000,
flat_amount: 234700,
},
{
up_to: 500000,
flat_amount: 51000,
flat_amount: 285700,
},
{
up_to: 600000,
flat_amount: 50000,
flat_amount: 335700,
},
{
up_to: 700000,
flat_amount: 49000,
flat_amount: 384700,
},
{
up_to: 800000,
flat_amount: 48000,
flat_amount: 432700,
},
{
up_to: 900000,
flat_amount: 47000,
flat_amount: 479700,
},
{
up_to: 1000000,
flat_amount: 46000,
flat_amount: 525700,
},
{
up_to: 1200000,
flat_amount: 91400,
flat_amount: 617100,
},
{
up_to: 1400000,
flat_amount: 90800,
flat_amount: 707900,
},
{
up_to: 1600000,
flat_amount: 90000,
flat_amount: 797900,
},
{
up_to: 1800000,
flat_amount: 89400,
flat_amount: 887300,
},
{
up_to: 'inf',
Expand Down
8 changes: 8 additions & 0 deletions packages/scripts/migrateSubscriptionsToUsageBased.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,14 @@ const migrateSubscriptionsToUsageBased = async () => {
price: proPriceId,
quantity: 1,
},
{
id: newSubscription.items.data.find(
(item) =>
item.price.id === starterChatsPriceId ||
item.price.id === proChatsPriceId
)?.id,
price: proChatsPriceId,
},
],
})

Expand Down

3 comments on commit 6b0c263

@vercel
Copy link

@vercel vercel bot commented on 6b0c263 Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 6b0c263 Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-typebot-io.vercel.app
builder-v2-git-main-typebot-io.vercel.app
app.typebot.io

@vercel
Copy link

@vercel vercel bot commented on 6b0c263 Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2 – ./apps/viewer

bot.afric.ai
bot.grace.bj
bot.tobb.pro
chatgov.site
cinecorn.com
ezbooking.ai
gniorder.com
help.taxt.co
kusamint.com
p18bm940.fun
psmix.online
receita.info
rhino.cr8.ai
sheep.cr8.ai
snake.cr8.ai
svhm.mprs.in
tiger.cr8.ai
video.cr8.ai
webwhats.fun
webwhats.pro
whatsapp.web
yoda.riku.ai
zebra.cr8.ai
akademicq.com
alvodelas.com
bemestar.club
bot.krdfy.com
cat.hidden.sg
cgcassets.com
cnvhub.com.br
drapamela.com
facelabko.com
filmylogy.com
goldorayo.com
payforbet.com
rabbit.cr8.ai
shop.mexwa.my
signup.cr8.ai
start.taxt.co
thegymgame.it
theusm.com.br
turkey.cr8.ai
vhpage.cr8.ai
vitamyway.com
whatchat.site
www.wiccom.it
acessovip.shop
am.nigerias.io
an.nigerias.io
ar.nigerias.io
bot.enreso.org
conversawpp.com
eventhub.com.au
feiraododia.com
fitness.riku.ai
games.klujo.com
iludogaming.com
ironcitygym.com
localove.online
projektelco.com
proscale.com.br
sellmycarbr.com
share.bot.gives
svhmapp.mprs.in
tanjakoil.store
typebot.aloe.do
acordo-certo.com
app-liberado.pro
ask.pemantau.org
batepapo.digital
bot.contakit.com
bot.imovfast.com
bot.lafabri.link
bot.piccinato.co
chat.sifucrm.com
chat.syncwin.com
chatonlineja.com
clo.closeer.work
cockroach.cr8.ai
demo.chatjer.com
desafioem21d.com
digitando.online
faqs.nigerias.io
feiraodehoje.com
georgemarttt.com
go.chatbotcv.com
guiascore900.com
haymanevents.com
kw.wpwakanda.com
localamor.online
lojamundobox.com
my.skillbrow.com
myrentalhost.com
nadieralatif.com
pray.jetdigi.com
silvercop.com.br
silvercop.online
stan.vselise.com
typebot.aloe.bot
vidalimentar.com

Please sign in to comment.