Skip to content

Commit

Permalink
chore: add storybook tests for onboarding (#19029)
Browse files Browse the repository at this point in the history
* add story for products

* add onboarding sdk story

* Add other products story

* Add billing step

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (1)

* fix type

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (1)

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and Twixes committed Dec 6, 2023
1 parent e4077c3 commit 0a3c604
Show file tree
Hide file tree
Showing 14 changed files with 2,101 additions and 375 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,923 changes: 1,923 additions & 0 deletions frontend/src/mocks/fixtures/_billing_unsubscribed.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions frontend/src/scenes/billing/PlanComparison.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const getProductTiers = (
{tiers ? (
tiers?.map((tier, i) => (
<div
key={`${plan.key}-${product.type}-${tier.up_to}`}
key={`${plan.plan_key}-${product.type}-${tier.up_to}`}
className={`flex ${width && width < 100 ? 'flex-col mb-2' : ' justify-between items-center'}`}
ref={tiersRef}
>
Expand All @@ -79,7 +79,7 @@ const getProductTiers = (
))
) : product?.free_allocation ? (
<div
key={`${plan.key}-${product.type}-tiers`}
key={`${plan.plan_key}-${product.type}-tiers`}
className={`flex ${width && width < 100 ? 'flex-col mb-2' : ' justify-between items-center'}`}
ref={tiersRef}
>
Expand Down Expand Up @@ -111,7 +111,7 @@ export const PlanComparison = ({

const upgradeButtons = plans?.map((plan) => {
return (
<td key={`${plan.key}-cta`} className="PlanTable__td__upgradeButton">
<td key={`${plan.plan_key}-cta`} className="PlanTable__td__upgradeButton">
<LemonButton
to={getUpgradeProductLink(product, plan.plan_key || '', redirectPath, includeAddons)}
type={plan.current_plan ? 'secondary' : 'primary'}
Expand Down
37 changes: 0 additions & 37 deletions frontend/src/scenes/billing/PlanTable.scss

This file was deleted.

297 changes: 0 additions & 297 deletions frontend/src/scenes/billing/PlanTable.tsx

This file was deleted.

6 changes: 4 additions & 2 deletions frontend/src/scenes/billing/billingLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export const billingLogic = kea<billingLogicType>([
}

const productOverLimit = billing.products?.find((x: BillingProductV2Type) => {
return x.percentage_usage > 1
return x.percentage_usage > 1 && x.usage_key
})

if (productOverLimit) {
Expand All @@ -223,7 +223,9 @@ export const billingLogic = kea<billingLogicType>([
title: 'You will soon hit your usage limit',
message: `You have currently used ${parseFloat(
(productApproachingLimit.percentage_usage * 100).toFixed(2)
)}% of your ${productApproachingLimit.usage_key.toLowerCase()} allocation.`,
)}% of your ${
productApproachingLimit.usage_key && productApproachingLimit.usage_key.toLowerCase()
} allocation.`,
}
}

Expand Down
5 changes: 4 additions & 1 deletion frontend/src/scenes/billing/billingProductLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ export const billingProductLogic = kea<billingProductLogicType>([
customLimitUsd: [
(s, p) => [s.billing, p.product],
(billing, product) => {
return billing?.custom_limits_usd?.[product.type] || billing?.custom_limits_usd?.[product.usage_key]
return (
billing?.custom_limits_usd?.[product.type] ||
(product.usage_key ? billing?.custom_limits_usd?.[product.usage_key] : '')
)
},
],
currentAndUpgradePlans: [
Expand Down
Loading

0 comments on commit 0a3c604

Please sign in to comment.