Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Rename create-earnings.ts to prepare-earnings.ts and update import paths

Kiran K9451c8ef0b7a
diff --git a/apps/web/app/api/stripe/integration/webhook/checkout-session-completed.ts b/apps/web/app/api/stripe/integration/webhook/checkout-session-completed.ts
index 92d0f86893..7900c4aed9 100644
--- a/apps/web/app/api/stripe/integration/webhook/checkout-session-completed.ts
+++ b/apps/web/app/api/stripe/integration/webhook/checkout-session-completed.ts
@@ -1,4 +1,4 @@
-import { prepareEarnings } from "@/lib/api/earnings/create-earnings";
+import { prepareEarnings } from "@/lib/api/earnings/prepare-earnings";
import { includeTags } from "@/lib/api/links/include-tags";
import { notifyPartnerSale } from "@/lib/api/partners/notify-partner-sale";
import { createId } from "@/lib/api/utils";
diff --git a/apps/web/app/api/stripe/integration/webhook/invoice-paid.ts b/apps/web/app/api/stripe/integration/webhook/invoice-paid.ts
index 593c0e15dc..d112d0cf53 100644
--- a/apps/web/app/api/stripe/integration/webhook/invoice-paid.ts
+++ b/apps/web/app/api/stripe/integration/webhook/invoice-paid.ts
@@ -1,4 +1,4 @@
-import { prepareEarnings } from "@/lib/api/earnings/create-earnings";
+import { prepareEarnings } from "@/lib/api/earnings/prepare-earnings";
import { includeTags } from "@/lib/api/links/include-tags";
import { notifyPartnerSale } from "@/lib/api/partners/notify-partner-sale";
import { getLeadEvent, recordSale } from "@/lib/tinybird";
diff --git a/apps/web/app/api/stripe/integration/webhook/route.ts b/apps/web/app/api/stripe/integration/webhook/route.ts
index c2ee1e7200..28b7f869ac 100644
--- a/apps/web/app/api/stripe/integration/webhook/route.ts
+++ b/apps/web/app/api/stripe/integration/webhook/route.ts
@@ -1,4 +1,4 @@
- import { stripe } from "@/lib/stripe";
+import { stripe } from "@/lib/stripe";
import { withAxiom } from "next-axiom";
import Stripe from "stripe";
import { accountApplicationDeauthorized } from "./account-application-deauthorized";
diff --git a/apps/web/app/api/track/lead/route.ts b/apps/web/app/api/track/lead/route.ts
index 1cb6a51533..38b5961e20 100644
--- a/apps/web/app/api/track/lead/route.ts
+++ b/apps/web/app/api/track/lead/route.ts
@@ -1,4 +1,4 @@
-import { prepareEarnings } from "@/lib/api/earnings/create-earnings";
+import { prepareEarnings } from "@/lib/api/earnings/prepare-earnings";
import { DubApiError } from "@/lib/api/errors";
import { includeTags } from "@/lib/api/links/include-tags";
import { createId, parseRequestBody } from "@/lib/api/utils";
diff --git a/apps/web/app/api/track/sale/route.ts b/apps/web/app/api/track/sale/route.ts
index aeb0e442fb..de1f631182 100644
--- a/apps/web/app/api/track/sale/route.ts
+++ b/apps/web/app/api/track/sale/route.ts
@@ -1,4 +1,4 @@
-import { prepareEarnings } from "@/lib/api/earnings/create-earnings";
+import { prepareEarnings } from "@/lib/api/earnings/prepare-earnings";
import { DubApiError } from "@/lib/api/errors";
import { includeTags } from "@/lib/api/links/include-tags";
import { notifyPartnerSale } from "@/lib/api/partners/notify-partner-sale";
diff --git a/apps/web/lib/api/earnings/create-earnings.ts b/apps/web/lib/api/earnings/prepare-earnings.ts
similarity index 97%
rename from apps/web/lib/api/earnings/create-earnings.ts
rename to apps/web/lib/api/earnings/prepare-earnings.ts
index e03a676a12..cba0c9562c 100644
--- a/apps/web/lib/api/earnings/create-earnings.ts
+++ b/apps/web/lib/api/earnings/prepare-earnings.ts
@@ -42,7 +42,7 @@ export const prepareEarnings = ({
}: CreateEarnings) => {
const amount = click?.amount || sale?.amount;
const invoiceId = sale?.invoiceId;
- const currency = sale?.currency || "usd";
+ const currency = sale?.currency || null;
const quantity = ["lead", "sale"].includes(event.type)
? 1
: click?.quantity || 0;
diff --git a/apps/web/lib/integrations/shopify/create-lead.ts b/apps/web/lib/integrations/shopify/create-lead.ts
index 5cb20e9757..f2b7600e93 100644
--- a/apps/web/lib/integrations/shopify/create-lead.ts
+++ b/apps/web/lib/integrations/shopify/create-lead.ts
@@ -1,4 +1,4 @@
-import { prepareEarnings } from "@/lib/api/earnings/create-earnings";
+import { prepareEarnings } from "@/lib/api/earnings/prepare-earnings";
import { includeTags } from "@/lib/api/links/include-tags";
import { createId } from "@/lib/api/utils";
import { generateRandomName } from "@/lib/names";
diff --git a/apps/web/lib/integrations/shopify/create-sale.ts b/apps/web/lib/integrations/shopify/create-sale.ts
index f42bccf86a..e2db134b23 100644
--- a/apps/web/lib/integrations/shopify/create-sale.ts
+++ b/apps/web/lib/integrations/shopify/create-sale.ts
@@ -1,4 +1,4 @@
-import { prepareEarnings } from "@/lib/api/earnings/create-earnings";
+import { prepareEarnings } from "@/lib/api/earnings/prepare-earnings";
import { includeTags } from "@/lib/api/links/include-tags";
import { notifyPartnerSale } from "@/lib/api/partners/notify-partner-sale";
import { recordSale } from "@/lib/tinybird";
diff --git a/packages/ui/src/icons/card-amex.tsx b/packages/ui/src/icons/card-amex.tsx
index 659f21984e..1832e31f9a 100644
--- a/packages/ui/src/icons/card-amex.tsx
+++ b/packages/ui/src/icons/card-amex.tsx
@@ -10,11 +10,28 @@ export function CardAmex(props: SVGProps<SVGSVGElement>) {
viewBox="0 0 24 20"
{...props}
>
- <path d="M0 10.6879L4.47134 0.598724H8.82803L9.89809 2.8535V0.598724H15.2484L16.1274 2.96815L17.0446 0.598724H22.7006V10.6891L19.1083 14.3185L24 19.4013H17.2357L15.8599 17.7962L14.4459 19.4013H3.63057V10.6879H0Z" fill="#306FC5"/>
- <path fill-rule="evenodd" clip-rule="evenodd" d="M5.5378 2.01274L2.25117 9.38854H4.42952L4.96455 7.93631H8.51869L9.09194 9.38854H11.2321L7.94544 2.01274H5.5378ZM7.90723 6.40765L6.72251 3.57962L5.5378 6.40765H7.90723Z" fill="white"/>
- <path d="M21.0919 9.38854V2.01274H17.9964L16.162 6.78981L14.3276 2.01274H11.2703V9.38854H13.1047V3.69427L15.2448 9.38854H17.041L19.1811 3.69427V9.38854H21.0919Z" fill="white"/>
- <path d="M5.11742 17.949V10.6879H11.2321V12.293H6.95181V13.5924H11.1174V15.121H6.95181V16.4586H11.2321V17.949H5.11742Z" fill="white"/>
- <path d="M20.4805 10.6879L17.0792 14.3185L20.4805 17.949H17.9964L15.8563 15.6178L13.6779 17.949H11.3085L14.6716 14.3185L11.2703 10.6879H13.6779L15.8563 13.0573L18.0728 10.6879H20.4805Z" fill="white"/>
+ <path
+ d="M0 10.6879L4.47134 0.598724H8.82803L9.89809 2.8535V0.598724H15.2484L16.1274 2.96815L17.0446 0.598724H22.7006V10.6891L19.1083 14.3185L24 19.4013H17.2357L15.8599 17.7962L14.4459 19.4013H3.63057V10.6879H0Z"
+ fill="#306FC5"
+ />
+ <path
+ fill-rule="evenodd"
+ clip-rule="evenodd"
+ d="M5.5378 2.01274L2.25117 9.38854H4.42952L4.96455 7.93631H8.51869L9.09194 9.38854H11.2321L7.94544 2.01274H5.5378ZM7.90723 6.40765L6.72251 3.57962L5.5378 6.40765H7.90723Z"
+ fill="white"
+ />
+ <path
+ d="M21.0919 9.38854V2.01274H17.9964L16.162 6.78981L14.3276 2.01274H11.2703V9.38854H13.1047V3.69427L15.2448 9.38854H17.041L19.1811 3.69427V9.38854H21.0919Z"
+ fill="white"
+ />
+ <path
+ d="M5.11742 17.949V10.6879H11.2321V12.293H6.95181V13.5924H11.1174V15.121H6.95181V16.4586H11.2321V17.949H5.11742Z"
+ fill="white"
+ />
+ <path
+ d="M20.4805 10.6879L17.0792 14.3185L20.4805 17.949H17.9964L15.8563 15.6178L13.6779 17.949H11.3085L14.6716 14.3185L11.2703 10.6879H13.6779L15.8563 13.0573L18.0728 10.6879H20.4805Z"
+ fill="white"
+ />
</svg>
);
-}
\ No newline at end of file
+}
diff --git a/packages/ui/src/icons/card-discover.tsx b/packages/ui/src/icons/card-discover.tsx
index 53b59bd912..5cda5bf021 100644
--- a/packages/ui/src/icons/card-discover.tsx
+++ b/packages/ui/src/icons/card-discover.tsx
@@ -10,29 +10,62 @@ export function CardDiscover(props: SVGProps<SVGSVGElement>) {
viewBox="0 0 22 22"
{...props}
>
- <g filter="url(#filter0_i_3233_2334)">
- <circle cx="11" cy="11" r="10.1145" fill="url(#paint0_linear_3233_2334)"/>
- </g>
- <defs>
- <filter id="filter0_i_3233_2334" x="0.885498" y="0.885483" width="22.229" height="22.229" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
- <feFlood flood-opacity="0" result="BackgroundImageFix"/>
- <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
- <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
- <feOffset dx="2" dy="2"/>
- <feGaussianBlur stdDeviation="1"/>
- <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
- <feColorMatrix type="matrix" values="0 0 0 0 0.675732 0 0 0 0 0.189457 0 0 0 0 0.144011 0 0 0 1 0"/>
- <feBlend mode="normal" in2="shape" result="effect1_innerShadow_3233_2334"/>
+ <g filter="url(#filter0_i_3233_2334)">
+ <circle
+ cx="11"
+ cy="11"
+ r="10.1145"
+ fill="url(#paint0_linear_3233_2334)"
+ />
+ </g>
+ <defs>
+ <filter
+ id="filter0_i_3233_2334"
+ x="0.885498"
+ y="0.885483"
+ width="22.229"
+ height="22.229"
+ filterUnits="userSpaceOnUse"
+ color-interpolation-filters="sRGB"
+ >
+ <feFlood flood-opacity="0" result="BackgroundImageFix" />
+ <feBlend
+ mode="normal"
+ in="SourceGraphic"
+ in2="BackgroundImageFix"
+ result="shape"
+ />
+ <feColorMatrix
+ in="SourceAlpha"
+ type="matrix"
+ values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
+ result="hardAlpha"
+ />
+ <feOffset dx="2" dy="2" />
+ <feGaussianBlur stdDeviation="1" />
+ <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1" />
+ <feColorMatrix
+ type="matrix"
+ values="0 0 0 0 0.675732 0 0 0 0 0.189457 0 0 0 0 0.144011 0 0 0 1 0"
+ />
+ <feBlend
+ mode="normal"
+ in2="shape"
+ result="effect1_innerShadow_3233_2334"
+ />
</filter>
- <linearGradient id="paint0_linear_3233_2334" x1="0.885498" y1="0.885483" x2="21.1145" y2="21.1145" gradientUnits="userSpaceOnUse">
- <stop offset="0.28" stop-color="#E0481E"/>
- <stop offset="0.765" stop-color="#F59214"/>
+ <linearGradient
+ id="paint0_linear_3233_2334"
+ x1="0.885498"
+ y1="0.885483"
+ x2="21.1145"
+ y2="21.1145"
+ gradientUnits="userSpaceOnUse"
+ >
+ <stop offset="0.28" stop-color="#E0481E" />
+ <stop offset="0.765" stop-color="#F59214" />
</linearGradient>
- </defs>
+ </defs>
</svg>
);
}
-
-
-
-
diff --git a/packages/ui/src/icons/card-mastercard.tsx b/packages/ui/src/icons/card-mastercard.tsx
index c6658afdf9..8a172278ce 100644
--- a/packages/ui/src/icons/card-mastercard.tsx
+++ b/packages/ui/src/icons/card-mastercard.tsx
@@ -10,9 +10,15 @@ export function CardMastercard(props: SVGProps<SVGSVGElement>) {
viewBox="0 0 26 16"
{...props}
>
- <path d="M16.4812 1.71H9.48193V14.2895H16.4812V1.71Z" fill="#FF5F00"/>
- <path d="M9.94376 7.99989C9.94267 6.78836 10.2173 5.59245 10.7467 4.50275C11.2762 3.41304 12.0467 2.45811 12.9999 1.71025C11.8197 0.782666 10.4024 0.205831 8.90991 0.045672C7.41742 -0.114488 5.90998 0.148487 4.55988 0.804545C3.20979 1.4606 2.07151 2.48327 1.27514 3.75566C0.478777 5.02805 0.0564575 6.49883 0.0564575 7.99989C0.0564575 9.50095 0.478777 10.9717 1.27514 12.2441C2.07151 13.5165 3.20979 14.5392 4.55988 15.1952C5.90998 15.8513 7.41742 16.1143 8.90991 15.9541C10.4024 15.7939 11.8197 15.2171 12.9999 14.2895C12.0467 13.5417 11.2762 12.5867 10.7467 11.497C10.2173 10.4073 9.94267 9.21142 9.94376 7.99989Z" fill="#EB001B"/>
- <path d="M17.9436 9.58141e-06C16.1501 -0.00277122 14.4081 0.599824 12.9997 1.71025C13.952 2.45885 14.7219 3.41394 15.2513 4.50348C15.7808 5.59301 16.0558 6.78855 16.0558 7.99989C16.0558 9.21124 15.7808 10.4068 15.2513 11.4963C14.7219 12.5858 13.952 13.5409 12.9997 14.2895C14.0023 15.0776 15.1788 15.6146 16.4311 15.8557C17.6833 16.0968 18.9751 16.0351 20.1987 15.6756C21.4222 15.3161 22.5421 14.6693 23.465 13.7891C24.3878 12.909 25.0869 11.8209 25.5038 10.6157C25.9208 9.41056 26.0436 8.12316 25.862 6.86088C25.6804 5.5986 25.1997 4.39802 24.4599 3.35924C23.7201 2.32047 22.7427 1.4736 21.6092 0.889259C20.4757 0.304914 19.2189 2.34802e-05 17.9436 9.58141e-06Z" fill="#F79E1B"/>
+ <path d="M16.4812 1.71H9.48193V14.2895H16.4812V1.71Z" fill="#FF5F00" />
+ <path
+ d="M9.94376 7.99989C9.94267 6.78836 10.2173 5.59245 10.7467 4.50275C11.2762 3.41304 12.0467 2.45811 12.9999 1.71025C11.8197 0.782666 10.4024 0.205831 8.90991 0.045672C7.41742 -0.114488 5.90998 0.148487 4.55988 0.804545C3.20979 1.4606 2.07151 2.48327 1.27514 3.75566C0.478777 5.02805 0.0564575 6.49883 0.0564575 7.99989C0.0564575 9.50095 0.478777 10.9717 1.27514 12.2441C2.07151 13.5165 3.20979 14.5392 4.55988 15.1952C5.90998 15.8513 7.41742 16.1143 8.90991 15.9541C10.4024 15.7939 11.8197 15.2171 12.9999 14.2895C12.0467 13.5417 11.2762 12.5867 10.7467 11.497C10.2173 10.4073 9.94267 9.21142 9.94376 7.99989Z"
+ fill="#EB001B"
+ />
+ <path
+ d="M17.9436 9.58141e-06C16.1501 -0.00277122 14.4081 0.599824 12.9997 1.71025C13.952 2.45885 14.7219 3.41394 15.2513 4.50348C15.7808 5.59301 16.0558 6.78855 16.0558 7.99989C16.0558 9.21124 15.7808 10.4068 15.2513 11.4963C14.7219 12.5858 13.952 13.5409 12.9997 14.2895C14.0023 15.0776 15.1788 15.6146 16.4311 15.8557C17.6833 16.0968 18.9751 16.0351 20.1987 15.6756C21.4222 15.3161 22.5421 14.6693 23.465 13.7891C24.3878 12.909 25.0869 11.8209 25.5038 10.6157C25.9208 9.41056 26.0436 8.12316 25.862 6.86088C25.6804 5.5986 25.1997 4.39802 24.4599 3.35924C23.7201 2.32047 22.7427 1.4736 21.6092 0.889259C20.4757 0.304914 19.2189 2.34802e-05 17.9436 9.58141e-06Z"
+ fill="#F79E1B"
+ />
</svg>
);
-}
\ No newline at end of file
+}
diff --git a/packages/ui/src/icons/card-visa.tsx b/packages/ui/src/icons/card-visa.tsx
index 22801b7365..f90b62cde2 100644
--- a/packages/ui/src/icons/card-visa.tsx
+++ b/packages/ui/src/icons/card-visa.tsx
@@ -10,8 +10,8 @@ export function CardVisa(props: SVGProps<SVGSVGElement>) {
viewBox="0 0 20 16"
{...props}
>
- <path
- d="M0.367215 0.000510312L0.279083 0.510302C0.279083 0.510302 1.80807 0.788926 3.18539 1.34516C4.95879 1.98252 5.08484 2.35402 5.38357 3.50628L8.63779 16H13.0003L19.7209 0.000510312H15.3686L11.0501 10.8786L9.28802 1.65746C9.12662 0.602156 8.30781 0 7.30608 0H0.367728L0.367215 0.000510312Z"
+ <path
+ d="M0.367215 0.000510312L0.279083 0.510302C0.279083 0.510302 1.80807 0.788926 3.18539 1.34516C4.95879 1.98252 5.08484 2.35402 5.38357 3.50628L8.63779 16H13.0003L19.7209 0.000510312H15.3686L11.0501 10.8786L9.28802 1.65746C9.12662 0.602156 8.30781 0 7.30608 0H0.367728L0.367215 0.000510312Z"
fill="#1434CB"
/>
</svg>