Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
26 changes: 14 additions & 12 deletions apps/web/app/(ee)/app.dub.co/embed/referrals/page-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,20 @@ export function ReferralsEmbedPageClient({
<ProgramRewardList rewards={rewards} discount={discount} />
</div>
</div>
<div className="mt-4 flex justify-center md:absolute md:bottom-3 md:right-3 md:mt-0">
<a
href="https://dub.co/partners"
target="_blank"
className="hover:text-content-default text-content-subtle bg-bg-default border-border-subtle flex w-fit items-center gap-1.5 rounded-md border px-2 py-1 transition-colors duration-75"
>
<p className="whitespace-nowrap text-xs font-medium leading-none">
Powered by
</p>
<Wordmark className="text-content-emphasis h-3.5" />
</a>
</div>
{!programEmbedData?.hidePoweredByBadge && (
<div className="mt-4 flex justify-center md:absolute md:bottom-3 md:right-3 md:mt-0">
<a
href="https://dub.co/partners"
target="_blank"
className="hover:text-content-default text-content-subtle bg-bg-default border-border-subtle flex w-fit items-center gap-1.5 rounded-md border px-2 py-1 transition-colors duration-75"
>
<p className="whitespace-nowrap text-xs font-medium leading-none">
Powered by
</p>
<Wordmark className="text-content-emphasis h-3.5" />
</a>
</div>
)}
</div>
<div className="mt-4 grid gap-2 sm:h-32 sm:grid-cols-3">
<ReferralsEmbedActivity {...stats} />
Expand Down
17 changes: 3 additions & 14 deletions apps/web/app/(ee)/app.dub.co/embed/referrals/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HeroBackground } from "@/ui/partners/hero-background";
import { Button, Copy, Wordmark } from "@dub/ui";
import { Button, Copy } from "@dub/ui";
import { Suspense } from "react";
import { DynamicHeightMessenger } from "./dynamic-height-messenger";
import { ReferralsEmbedPageClient } from "./page-client";
Expand Down Expand Up @@ -70,7 +70,7 @@ function EmbedInlineLoading({ themeOptions }: { themeOptions: ThemeOptions }) {
Referral link
</span>
<div className="xs:flex-row relative mt-3 flex flex-col items-center gap-2">
<div className="xs:w-60 border-border-default bg-bg-muted h-10 w-full rounded-md border" />
<div className="xs:w-72 border-border-default bg-bg-muted h-10 w-full rounded-md border" />
<Button
icon={<Copy className="size-4" />}
text="Copy link"
Expand All @@ -81,18 +81,7 @@ function EmbedInlineLoading({ themeOptions }: { themeOptions: ThemeOptions }) {
<span className="mt-12 text-base font-semibold text-neutral-800">
Rewards
</span>
<div className="relative mt-2 flex flex-col gap-2">
<div className="bg-bg-muted h-6 w-60 rounded-md" />
<div className="bg-bg-muted h-6 w-40 rounded-md" />
</div>
<a
href="https://dub.co/partners"
target="_blank"
className="hover:text-content-default text-content-subtle mt-4 flex items-center justify-center gap-1.5 transition-colors duration-75 md:absolute md:bottom-3 md:right-3 md:mt-0 md:translate-x-0"
>
<p className="text-xs font-medium">Powered by</p>
<Wordmark className="text-content-emphasis h-3.5" />
</a>
<div className="bg-bg-default border-border-subtle mt-2 h-20 w-[28rem] rounded-md border" />
</div>
<div className="mt-4 grid gap-2 sm:h-32 sm:grid-cols-3">
<div className="border-border-subtle bg-bg-muted h-full w-full rounded-lg border sm:col-span-2" />
Expand Down
17 changes: 4 additions & 13 deletions apps/web/lib/api/conversions/track-sale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,11 @@ export const trackSale = async ({

// Return idempotent response if invoiceId is already processed
if (invoiceId) {
// TODO: remove oldKeyValue stuff after 7 days (on Sep 18)
const [newKeyValue, oldKeyValue] = await redis.mget([
const cachedResponse = await redis.get(
`trackSale:${workspace.id}:invoiceId:${invoiceId}`,
`dub_sale_events:invoiceId:${invoiceId}`,
]);

if (newKeyValue) {
return newKeyValue;
} else if (oldKeyValue) {
return {
eventName,
customer: null,
sale: null,
};
);
if (cachedResponse) {
return cachedResponse;
}
}

Expand Down
1 change: 1 addition & 0 deletions apps/web/lib/zod/schemas/program-embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ export const programEmbedSchema = z
mode: z.enum(["enabled", "disabled"]).default("enabled"),
})
.nullish(),
hidePoweredByBadge: z.boolean().default(false),
})
.nullish();