Skip to content

Commit

Permalink
Exclude IRA rebates; add ability to show generic info about HEAR/HER (#…
Browse files Browse the repository at this point in the history
…155)

## Description

This excludes all federal non-tax-credit incentives that come from the
API, and adds in these visually-distinct cards with less-specific info
about HEAR rebates if the API response indicates the user is below
150% AMI.

One slight difference from the design spec is that the description
text is grey-500, rather than 400, which fails the a11y test for not
having enough contrast with the yellow background. I can't even see
the difference at a glance, so I think it's fine. (As a drive-by, I
fixed a couple places where we had `gray` instead of `grey`.)

Once we settle on copy, I'll start the translation workflow.

We don't have any state-specific logic yet, but there's a clear place
to add it once we figure out what exactly we want for each state. Some
states will want us to show nothing at all (either because they don't
want to commit to anything or because they already have actual HEAR
programs represented in the API), some states may want semi-specific
info in advance of rolling out actual programs, some may tell us
they're going to exclude certain items, etc. All that can be built on
this foundation.

As background, I don't want to put this in the API because the kind of
info we want for HEAR just doesn't fit within the current API shape:
it's too vague and uncertain. I don't want to extend the API shape to
encompass stuff like this because I think it's valuable, on principle,
to hold the line that the API only returns concrete, actionable
incentives that are certain, or close to certain, to be available.

https://app.asana.com/0/1206661332626418/1206925887004341

## Test Plan

Cypress tests pass.
  • Loading branch information
oyamauchi authored Apr 30, 2024
1 parent f17b2cf commit a134a94
Show file tree
Hide file tree
Showing 6 changed files with 337 additions and 74 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/state-calculator.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('rewiring-america-state-calculator', () => {

cy.get('rewiring-america-state-calculator')
.shadow()
.contains('$8,000 off a heat pump');
.contains('Discount off a heat pump');

cy.get('rewiring-america-state-calculator')
.shadow()
Expand Down
2 changes: 2 additions & 0 deletions src/api/calculator-types-v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,6 @@ export interface APIResponse {
};
location: APILocation;
incentives: Incentive[];
is_under_80_ami: boolean;
is_under_150_ami: boolean;
}
17 changes: 17 additions & 0 deletions src/i18n/strings/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export const templates = {
s1af1b11106c11c94: `Vermont`,
s1b5c0e397c13f596: `Kansas`,
s1be88e157547cb24: `Reembolso por rendimiento`,
s1cc63fbd986ae5d9: `Descuento en impermeabilización`,
s1e73057deee4510e: `Sin embargo, los reembolsos se aplicarán de forma diferente en cada estado, de manera que no podemos garantizar los montos finales, la elegibilidad ni los plazos.`,
s1f0dc611dbdf4115: `Ingresa sus ingresos brutos (ingresos antes de impuestos). Incluye salarios y sueldos, además de otras formas de ingresos, como pensiones, intereses, dividendos e ingresos por alquiler. Si está casado y presenta una declaración conjunta, incluye los ingresos de su cónyuge.`,
s24ea3f43230aae41: `[email protected]`,
s255857544a9d5ec0: `Reiniciar`,
Expand All @@ -32,6 +34,7 @@ export const templates = {
s2800ea3a8c83c188: `Nueva York`,
s280c7b72a9d4d573: `Carolina del Sur`,
s282049f502eac1de: `Proyecto`,
s2b1b3dc2f8da1ce4: `Descuento en una bomba de calor`,
s2bb426aeeaeede1a: `Texas`,
s2c430b6a8a07370e: str`${0} del costo de ${1}`,
s2de33deca4490a2f: `Kentucky`,
Expand All @@ -48,6 +51,7 @@ export const templates = {
s3ab697ad32f1c425: `Oregón`,
s3e5e50bffd99c077: `Montana`,
s3ec21e39dec13351: `Propietario`,
s3fba93629af19a87: str`Los lineamientos federales permiten un descuento de hasta \$${0}.`,
s40f2997eb54b317b: `Míchigan`,
s4371bac1b748cdc4: `kilovatio`,
s4455d8f660ceaa3b: `10,000 Btuh`,
Expand All @@ -68,6 +72,7 @@ export const templates = {
s5c876c284d9dca41: `1 persona`,
s5e25aaf62bd99625: `vatio`,
s60d7e5b7ccbd7162: `Reembolso`,
s635e3d7c474426ce: `Descuento en una secadora con bomba de calor`,
s64fbe9b97e397b12: `Estamos dedicados a proteger su privacidad.`,
s675cdfc08b387d5a: `Ohio`,
s67ef2eb5002eaaa5: `Podría ser que no hay incentivos en su área o que usted no califica financieramente para recibir ningún incentivo.`,
Expand All @@ -94,11 +99,15 @@ export const templates = {
s8b29a87eb1bdd138: `Otros incentivos disponibles para usted`,
s8e35f6b4e6e0adb9: `Pensilvania`,
s8e7e52ad112342ab: `un cargador de vehículos eléctricos`,
s8ee1a34f2ada948d: str`Los lineamientos federals permiten un reembolso de hasta \$${0}, basado en el ahorro de energía simulado o en el ahorro de energía medido logrado por el reacondicionamiento.`,
s8f668dd0fa1b8c4e: `Reembolso por eficiencia`,
s8fd029fdcc452602: `Ingresa su código postal para seleccionar una empresa de servicios eléctricos.`,
s8fd8a524edc33867: `Esperado en 2025`,
s912b944fa287f7d0: `Nuevo Hampshire`,
s9afee25dcf31efc1: `un vehículo eléctrico nuevo`,
s9b0d347a81e8f0a3: `Oklahoma`,
s9ca62f0b7e639157: `Maine`,
s9de4186c3f39ea44: `Descuento en un calentador de agua con bomba de calor`,
s9eba0933010df96e: `Más información`,
s9fbb21f25571fff1: `Le informaremos sobre incentivos, reembolsos, y más de Rewiring America.`,
s9fc7054353f62fda: `Casado que presenta una declaración por separado`,
Expand All @@ -110,19 +119,23 @@ export const templates = {
sabd5662f3f0a76be: `Descuento por adelantado`,
sad181d4343ef967f: `Wyoming`,
sae246b9f0aee2901: `Virginia Occidental`,
sae2ffd247e500180: `Descuento en cableado`,
sae79f47e1f8205fc: str`Ese código postal no está en ${0}.`,
saee4c6f0080bac8d: `Utah`,
saf510e2c8ddfc21a: `una renovación de eficiencia energética`,
safb8e695c2fc2dc3: `Declaración de impuestos`,
sb04b1070af7f7b76: `Washington, DC`,
sb1b20a59970ba607: `Incluye a cualquier persona con la que viva y que reclame como dependiente en sus impuestos, y a su cónyuge o pareja si presenta impuestos conjuntos.`,
sb1ef6ac20f1ddfff: `Descuento en un tablero eléctrico`,
sb21ad862204e6186: `Ver nuestros`,
sb3615709fedc9d4d: `Reembolsos para la Electrificación del Hogar y Electrodomésticos (HEAR)`,
sb5b955a693af9c2e: `Virginia`,
sb661e8297dd681e2: `Incentivo`,
sb694f3d582a0dbb9: `Selecciona "Cabeza de familia" si tiene un hijo o pariente que vive con usted y paga más de la mitad de los gastos de su hogar. Selecciona "Conjunta" si declara sus impuestos como pareja casada.`,
sb6975fd8aa3fa26f: `Climatización`,
sb932cf0734934406: `Su código postal ayuda a determinar la cantidad de descuentos y créditos fiscales para los que califica.`,
sb9e8a9bfc8bcf398: `Rhode Island`,
sbafed52303428041: `https://homes.rewiringamerica.org/es/federal-incentives/home-efficiency-rebates`,
sbc39ee880f922370: `Ninguno seleccionado`,
sbc6f031a2851e3fd: str`\$${0}/${1} de descuento en ${2}, hasta \$${3}`,
sbd6f35e4bb46fc68: `una estufa eléctrica/inducción`,
Expand All @@ -131,13 +144,16 @@ export const templates = {
sc026bbb64721085f: `Casado que presenta una declaración conjunta`,
sc373af4c1a974b57: `Cocina`,
sc5b20cb72269bc4f: `Los propietarios y inquilinos califican para diferentes incentivos.`,
sc9266b1b6ae1aad4: `Esperado en 2024-2025`,
sc997cfdf24ba9b58: `Aún no tenemos datos sobre las empresas de servicios eléctricos en su área.`,
sc9e494c8346b7cb5: `Otra`,
sca61f9664c0f6099: `https://homes.rewiringamerica.org/es/federal-incentives/home-electrification-appliance-rebates`,
scb043c067bac571c: `Misisipi`,
scc21fdd8a2feaeef: `Georgia`,
scc3ef5dd3649b934: `Nuevo México`,
sd01d1a3738143465: str`\$${0}/${1} de descuento en ${2}`,
sd02402d1aaffcb1d: `Secadora`,
sd0a66efc08693b44: `Reembolsos por Eficiencia Doméstica (HER)`,
sd0b6082239185272: `Seleccionar todo`,
sd26fd2eb6e7f18cb: `Minnesota`,
sd4647caeb94889ec: `Términos`,
Expand All @@ -160,6 +176,7 @@ export const templates = {
sf3affd5c9f2915e0: `Connecticut`,
sf459faf797f733a9: `Impermeabilización`,
sf844ac31d5fba2c9: `impermeabilización`,
sf8b5deb9ea9f5054: `Descuento en una estufa eléctrica`,
sfa7338035e1ef173: `Alquilar o poseer`,
sfc7214f623fe475d: `Selecciona la empresa a la que paga su factura de electricidad.`,
sfe16afc784bb9d76: `Tejado solar`,
Expand Down
107 changes: 107 additions & 0 deletions src/ira-rebates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import { APIResponse, IncentiveType } from './api/calculator-types-v1';
import { str } from './i18n/str';
import { MsgFn } from './i18n/use-translated';
import { Project } from './projects';

export type IRARebate = {
paymentMethod: IncentiveType;
project: Project;
headline: string;
program: string;
description: string;
url: string;
timeline: string | null;
};

const hearRebates: {
project: Project;
getHeadline: (msg: MsgFn) => string;
maxAmount: number;
}[] = [
{
project: 'wiring',
getHeadline: msg => msg('Discount off an electric panel'),
maxAmount: 4000,
},
{
project: 'cooking',
getHeadline: msg => msg('Discount off an electric stove'),
maxAmount: 840,
},
{
project: 'wiring',
getHeadline: msg => msg('Discount off electric wiring'),
maxAmount: 2500,
},
{
project: 'heat_pump_water_heater',
getHeadline: msg => msg('Discount off a heat pump water heater'),
maxAmount: 1750,
},
{
project: 'hvac',
getHeadline: msg => msg('Discount off a heat pump'),
maxAmount: 8000,
},
{
project: 'heat_pump_clothes_dryer',
getHeadline: msg => msg('Discount off a heat pump clothes dryer'),
maxAmount: 840,
},
{
project: 'weatherization_and_efficiency',
getHeadline: msg => msg('Discount off weatherization'),
maxAmount: 1600,
},
];

export function getRebatesFor(response: APIResponse, msg: MsgFn): IRARebate[] {
const disclaimerText = msg(
'However, rebates will be implemented differently in each state, so we cannot guarantee final amounts, eligibility, or timeline.',
);
const maxHerRebate = response.is_under_80_ami ? 8000 : 4000;

const result: IRARebate[] = [];

if (response.is_under_150_ami) {
hearRebates.forEach(rebate =>
result.push({
paymentMethod: 'pos_rebate' as IncentiveType,
project: rebate.project,
headline: rebate.getHeadline(msg),
program: msg(
'Federal Home Electrification and Appliance Rebates (HEAR)',
),
description:
msg(
str`The federal guidelines allow for a discount of up to $${rebate.maxAmount.toLocaleString()}.`,
) +
' ' +
disclaimerText,
url: msg(
'https://homes.rewiringamerica.org/federal-incentives/home-electrification-appliance-rebates',
),
timeline: msg('Expected in 2024-2025'),
}),
);
}

result.push({
paymentMethod: 'performance_rebate',
project: 'weatherization_and_efficiency',
headline: msg('Rebate for efficiency retrofits'),
program: msg('Federal Home Efficiency Rebates (HER)'),
description:
msg(
str`The federal guidelines allow for a rebate of up to $${maxHerRebate.toLocaleString()}, based on the modeled energy savings or measured energy savings achieved by the retrofit.`,
) +
' ' +
disclaimerText,
url: msg(
'https://homes.rewiringamerica.org/federal-incentives/home-efficiency-rebates',
),
timeline: msg('Expected in 2025'),
});

return result;
}
Loading

0 comments on commit a134a94

Please sign in to comment.