diff --git a/cypress/e2e/billing-limits.cy.ts b/cypress/e2e/billing-limits.cy.ts index 179549caa4900..4f412004a0cc5 100644 --- a/cypress/e2e/billing-limits.cy.ts +++ b/cypress/e2e/billing-limits.cy.ts @@ -61,6 +61,38 @@ describe('Billing Limits', () => { ) }) + it('Show existing limit and allow user to change set to $0', () => { + cy.intercept('GET', '/api/billing/', (req) => { + req.reply({ + statusCode: 200, + body: { + ...require('../fixtures/api/billing/billing.json'), + custom_limits_usd: { product_analytics: 100 }, + }, + }) + }).as('getBilling') + cy.visit('/organization/billing') + cy.wait('@getBilling') + + cy.intercept('PATCH', '/api/billing/', (req) => { + req.reply({ + statusCode: 200, + body: { + ...require('../fixtures/api/billing/billing.json'), + custom_limits_usd: { product_analytics: 0 }, + }, + }) + }).as('patchBilling') + + cy.get('[data-attr="billing-limit-input-wrapper-product_analytics"]').scrollIntoView() + cy.get('[data-attr="billing-limit-set-product_analytics"]').should('be.visible') + cy.contains('Edit limit').click() + cy.get('[data-attr="billing-limit-input-product_analytics"]').clear().type('0') + cy.get('[data-attr="save-billing-limit-product_analytics"]').click() + cy.wait('@patchBilling') + cy.get('[data-attr="billing-limit-set-product_analytics"]').should('contain', 'You have a $0 billing limit set') + }) + it('Show existing limit and allow user to remove it', () => { cy.intercept('GET', '/api/billing/', (req) => { req.reply({ diff --git a/frontend/__snapshots__/exporter-exporter--user-paths-insight--dark.png b/frontend/__snapshots__/exporter-exporter--user-paths-insight--dark.png index acc74d32b1329..7cff26c475c50 100644 Binary files a/frontend/__snapshots__/exporter-exporter--user-paths-insight--dark.png and b/frontend/__snapshots__/exporter-exporter--user-paths-insight--dark.png differ diff --git a/frontend/__snapshots__/exporter-exporter--user-paths-insight--light.png b/frontend/__snapshots__/exporter-exporter--user-paths-insight--light.png index 333981c508581..25984c46d9502 100644 Binary files a/frontend/__snapshots__/exporter-exporter--user-paths-insight--light.png and b/frontend/__snapshots__/exporter-exporter--user-paths-insight--light.png differ diff --git a/frontend/__snapshots__/scenes-app-dashboards--edit--light.png b/frontend/__snapshots__/scenes-app-dashboards--edit--light.png index b1c99ed31db14..ea51aea309fff 100644 Binary files a/frontend/__snapshots__/scenes-app-dashboards--edit--light.png and b/frontend/__snapshots__/scenes-app-dashboards--edit--light.png differ diff --git a/frontend/src/scenes/billing/billingProductLogic.ts b/frontend/src/scenes/billing/billingProductLogic.ts index 709fc8cad20c4..b3cb9c710adaa 100644 --- a/frontend/src/scenes/billing/billingProductLogic.ts +++ b/frontend/src/scenes/billing/billingProductLogic.ts @@ -163,7 +163,10 @@ export const billingProductLogic = kea([ return product.usage_key ? billing?.custom_limits_usd?.[product.usage_key] ?? null : null }, ], - hasCustomLimitSet: [(s) => [s.customLimitUsd], (customLimitUsd) => !!customLimitUsd && customLimitUsd >= 0], + hasCustomLimitSet: [ + (s) => [s.customLimitUsd], + (customLimitUsd) => (!!customLimitUsd || customLimitUsd === 0) && customLimitUsd >= 0, + ], currentAndUpgradePlans: [ (_s, p) => [p.product], (product) => {