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.

update guides directory, script

Steven Teya04ffaf5b8b6
diff --git a/apps/web/integration-guides/appwrite.md b/apps/web/guides/appwrite.md
similarity index 100%
rename from apps/web/integration-guides/appwrite.md
rename to apps/web/guides/appwrite.md
diff --git a/apps/web/integration-guides/auth0.md b/apps/web/guides/auth0.md
similarity index 100%
rename from apps/web/integration-guides/auth0.md
rename to apps/web/guides/auth0.md
diff --git a/apps/web/integration-guides/betterauth.md b/apps/web/guides/betterauth.md
similarity index 100%
rename from apps/web/integration-guides/betterauth.md
rename to apps/web/guides/betterauth.md
diff --git a/apps/web/integration-guides/clerk.md b/apps/web/guides/clerk.md
similarity index 100%
rename from apps/web/integration-guides/clerk.md
rename to apps/web/guides/clerk.md
diff --git a/apps/web/integration-guides/framer.md b/apps/web/guides/framer.md
similarity index 100%
rename from apps/web/integration-guides/framer.md
rename to apps/web/guides/framer.md
diff --git a/apps/web/integration-guides/manual-client-sdk.md b/apps/web/guides/manual-client-sdk.md
similarity index 100%
rename from apps/web/integration-guides/manual-client-sdk.md
rename to apps/web/guides/manual-client-sdk.md
diff --git a/apps/web/integration-guides/manual-track-leads.md b/apps/web/guides/manual-track-leads.md
similarity index 100%
rename from apps/web/integration-guides/manual-track-leads.md
rename to apps/web/guides/manual-track-leads.md
diff --git a/apps/web/integration-guides/manual-track-sales.md b/apps/web/guides/manual-track-sales.md
similarity index 100%
rename from apps/web/integration-guides/manual-track-sales.md
rename to apps/web/guides/manual-track-sales.md
diff --git a/apps/web/integration-guides/nextauth.md b/apps/web/guides/nextauth.md
similarity index 100%
rename from apps/web/integration-guides/nextauth.md
rename to apps/web/guides/nextauth.md
diff --git a/apps/web/integration-guides/react.md b/apps/web/guides/react.md
similarity index 100%
rename from apps/web/integration-guides/react.md
rename to apps/web/guides/react.md
diff --git a/apps/web/integration-guides/rest-api.md b/apps/web/guides/rest-api.md
similarity index 100%
rename from apps/web/integration-guides/rest-api.md
rename to apps/web/guides/rest-api.md
diff --git a/apps/web/integration-guides/shopify.md b/apps/web/guides/shopify.md
similarity index 100%
rename from apps/web/integration-guides/shopify.md
rename to apps/web/guides/shopify.md
diff --git a/apps/web/integration-guides/stripe-checkout.md b/apps/web/guides/stripe-checkout.md
similarity index 100%
rename from apps/web/integration-guides/stripe-checkout.md
rename to apps/web/guides/stripe-checkout.md
diff --git a/apps/web/integration-guides/stripe-customers.md b/apps/web/guides/stripe-customers.md
similarity index 100%
rename from apps/web/integration-guides/stripe-customers.md
rename to apps/web/guides/stripe-customers.md
diff --git a/apps/web/integration-guides/stripe-payment-links.md b/apps/web/guides/stripe-payment-links.md
similarity index 100%
rename from apps/web/integration-guides/stripe-payment-links.md
rename to apps/web/guides/stripe-payment-links.md
diff --git a/apps/web/integration-guides/supabase.md b/apps/web/guides/supabase.md
similarity index 100%
rename from apps/web/integration-guides/supabase.md
rename to apps/web/guides/supabase.md
diff --git a/apps/web/integration-guides/webflow.md b/apps/web/guides/webflow.md
similarity index 100%
rename from apps/web/integration-guides/webflow.md
rename to apps/web/guides/webflow.md
diff --git a/apps/web/integration-guides/wordpress.md b/apps/web/guides/wordpress.md
similarity index 100%
rename from apps/web/integration-guides/wordpress.md
rename to apps/web/guides/wordpress.md
diff --git a/apps/web/scripts/framer/backfill-commissions.ts b/apps/web/scripts/framer/backfill-commissions.ts
index 9c0435f8c1..d1223a1123 100644
--- a/apps/web/scripts/framer/backfill-commissions.ts
+++ b/apps/web/scripts/framer/backfill-commissions.ts
@@ -5,73 +5,89 @@ import "dotenv-flow/config";
import * as fs from "fs";
import * as Papa from "papaparse";
-const partnersToBackfill: {
+const commissionsToBackfill: {
partnerEmail: string;
totalCommissionCents: number;
}[] = [];
const FRAMER_PROGRAM_ID = "prog_";
-const MONTH_TO_BACKFILL = new Date("2025-04-15");
+const MONTH_TO_BACKFILL = new Date("2025-05-15");
async function main() {
// First read the sales data
- Papa.parse(fs.createReadStream("framer_backfill_commissions.csv", "utf-8"), {
- header: true,
- skipEmptyLines: true,
- step: (result: {
- data: {
- partner_email: string;
- total_commission_cents: string;
- };
- }) => {
- partnersToBackfill.push({
- partnerEmail: result.data.partner_email,
- totalCommissionCents: parseInt(result.data.total_commission_cents),
- });
- },
- complete: async () => {
- console.log(`Found ${partnersToBackfill.length} partners to backfill`);
- const partners = await prisma.partner.findMany({
- where: {
- email: {
- in: partnersToBackfill.map((p) => p.partnerEmail),
- },
- },
- });
-
- const processedData = partnersToBackfill.map((p) => {
- const partner = partners.find((_p) => _p.email === p.partnerEmail)!;
- return {
- partnerId: partner.id,
- ...p,
+ Papa.parse(
+ fs.createReadStream("framer_backfill_commissions_may.csv", "utf-8"),
+ {
+ header: true,
+ skipEmptyLines: true,
+ step: (result: {
+ data: {
+ partner_email: string;
+ total_commission_cents: string;
};
- });
+ }) => {
+ commissionsToBackfill.push({
+ partnerEmail: result.data.partner_email,
+ totalCommissionCents: parseInt(result.data.total_commission_cents),
+ });
+ },
+ complete: async () => {
+ console.log(
+ `Found ${commissionsToBackfill.length} commissions to backfill`,
+ );
+ const partners = await prisma.partner.findMany({
+ where: {
+ email: {
+ in: commissionsToBackfill.map((p) => p.partnerEmail),
+ },
+ },
+ });
- console.table(processedData);
+ const processedData = commissionsToBackfill
+ .map((p) => {
+ const partner = partners.find((_p) => _p.email === p.partnerEmail);
+ if (!partner) {
+ console.log(`Partner not found: ${p.partnerEmail}`);
+ return null;
+ }
+ return {
+ partnerId: partner.id,
+ ...p,
+ };
+ })
+ .filter((p) => p !== null);
- const manualCommissions = processedData.map((d) => {
- return {
- id: createId({ prefix: "cm_" }),
- programId: FRAMER_PROGRAM_ID,
- partnerId: d.partnerId,
- type: CommissionType.custom,
- amount: 0,
- quantity: 1,
- earnings: d.totalCommissionCents,
- status: CommissionStatus.pending,
- createdAt: MONTH_TO_BACKFILL,
- };
- });
+ const manualCommissions = processedData.map((d) => {
+ return {
+ id: createId({ prefix: "cm_" }),
+ programId: FRAMER_PROGRAM_ID,
+ partnerId: d.partnerId,
+ type: CommissionType.custom,
+ amount: 0,
+ quantity: 1,
+ earnings: d.totalCommissionCents,
+ status: CommissionStatus.pending,
+ createdAt: MONTH_TO_BACKFILL,
+ description: `Imported commissions from FirstPromoter (${MONTH_TO_BACKFILL.toLocaleString(
+ "en-US",
+ {
+ month: "long",
+ year: "numeric",
+ },
+ )})`,
+ };
+ });
- console.table(manualCommissions);
+ console.table(manualCommissions);
- // Add manual commissions to the database
- await prisma.commission.createMany({
- data: manualCommissions,
- skipDuplicates: true,
- });
+ // Add manual commissions to the database
+ await prisma.commission.createMany({
+ data: manualCommissions,
+ skipDuplicates: true,
+ });
+ },
},
- });
+ );
}
main();