feat: Use dub.customer.list to issue dual-sided incentives (#18452)

* [FEAT] Use dub.customer to issue dual-sided incentives

* update dub implementation

* uncommit yarn.lock

* Update yarn.lock

* account for self-hosting

* remove comments

---------

Co-authored-by: Omar López <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-01-17 21:33:33 +00:00
1 parent 245196fbf3
commit f411c6ed11
2 files changed
+31 -2

No files matched your search

+13
View File
@@ -3,3 +3,16 @@ import { Dub } from "dub";
export const dub = new Dub({
token: process.env.DUB_API_KEY,
});
export const getDubCustomer = async (userId: string) => {
if (!process.env.DUB_API_KEY) {
return null;
}
const customer = await dub.customers.list({
externalId: userId,
includeExpandedFields: true,
});
return customer.length > 0 ? customer[0] : null;
};