Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/lib/components/ProductDescriptions/CommaFour.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import MoneyBackGuaranteeIcon from "$lib/icons/features/money-back-guarantee.svg?raw";
import WarrantyIcon from "$lib/icons/features/warranty.svg?raw";

import { FOUR_PRICE, FOUR_SALE, FOUR_STRIKETHROUGH_PRICE, FOUR_TRADE_IN_CREDIT, NO_HARNESS_DISCOUNT } from '$lib/constants/prices.js';
import { FOUR_PRICE, FOUR_SALE, FOUR_STRIKETHROUGH_PRICE, FOUR_TRADE_IN_CREDIT, NO_HARNESS_DISCOUNT, affirmMonthly } from '$lib/constants/prices.js';
import { NO_HARNESS_OPTION } from '$lib/constants/vehicles.js';
</script>

Expand Down Expand Up @@ -61,6 +61,9 @@
$: priceDueToday = showDiscount ? FOUR_PRICE - NO_HARNESS_DISCOUNT : FOUR_PRICE;
$: priceAfterTradeIn = tradeInChecked ? priceDueToday - FOUR_TRADE_IN_CREDIT : priceDueToday;

// Affirm finances what's charged today — the trade-in credit lands after we receive the device
$: affirmPrice = affirmMonthly(priceDueToday);

$: additionalProductIds = (() => {
const ids = [];
if (selectedHarness && selectedHarness !== NO_HARNESS_OPTION) {
Expand Down Expand Up @@ -142,6 +145,16 @@
</div>

<span slot="price-accessory">
<div class="financing">
or ${affirmPrice}/mo with Affirm.
<a
href="https://www.affirm.com/apps/prequal/?public_api_key=EE7S5PMJUQ8H98C5&amp;device_id=063366d6-31b6-4e41-adcb-79f608745058&amp;referring_url=https%253A%252F%252Fcomma.ai%252Fshop%252Fcomma-four&amp;unit_price={priceDueToday}00&amp;page_type=product&amp;use_promo=true&amp;locale=en_US"
target="_blank"
class="highlight"
>
Prequalify now
</a>
</div>
<div class="badges">
<Badge style="dark">Free rush shipping</Badge>
{#if tradeInChecked && FOUR_TRADE_IN_CREDIT > 0}
Expand Down Expand Up @@ -244,6 +257,10 @@
border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

.financing {
text-wrap: pretty;
}

.badges {
display: flex;
flex-wrap: wrap;
Expand Down
13 changes: 13 additions & 0 deletions src/lib/constants/prices.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,16 @@ export const FOUR_STRIKETHROUGH_PRICE = null;
export const FOUR_PRICE = 999;
export const FOUR_TRADE_IN_CREDIT = 250;
export const NO_HARNESS_DISCOUNT = 50;

// Affirm's longest term, which is the one we advertise since it's the lowest monthly.
// Verified against affirm.com's own calculator at $699/$749/$949/$999 — same term and
// rate across the range, so the monthly scales with the price.
export const AFFIRM_APR = 0.15;
export const AFFIRM_TERM_MONTHS = 12;

// Standard amortized payment. Rounded up, so we never advertise less than what Affirm charges.
export function affirmMonthly(price) {
const monthlyRate = AFFIRM_APR / 12;
const payment = price * monthlyRate / (1 - Math.pow(1 + monthlyRate, -AFFIRM_TERM_MONTHS));
return Math.ceil(payment);
}
6 changes: 6 additions & 0 deletions src/routes/shop/comma-four/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,12 @@
International shipping is a $30 flat rate; customs/duties/taxes are between you and your country.
Please see FAQ for more information.
</p>
<strong>Affirm</strong>
<p>
Your rate will be based on credit, and is subject to an eligibility check.
Payment options through Affirm are provided by these lending partners: <a href="http://affirm.com/lenders" target="_blank" class="highlight">affirm.com/lenders</a>.
Options depend on your purchase amount, and a down payment may be required.
</p>
<strong>Warranty</strong>
<p>
1-year limited warranty against hardware defects. Extend it with <a href="/connect#what-is-commacare" class="highlight">commacare</a>. Open and repair the comma four at your own risk.
Expand Down
Loading