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.

fix constants

Steven Teyff4547808432
diff --git a/apps/web/.env.example b/apps/web/.env.example
index 4fa1052d9b..55fe606568 100644
--- a/apps/web/.env.example
+++ b/apps/web/.env.example
@@ -10,7 +10,7 @@ NEXT_PUBLIC_APP_SHORT_DOMAIN=dub.sh
# Get your Tinybird Auth Token here: https://www.tinybird.co/docs/concepts/auth-tokens.html
TINYBIRD_API_KEY=
# Varies based on your Tinybird region: https://www.tinybird.co/docs/api-reference/api-reference.html#regions-and-endpoints
-TINYBIRD_API_URL=https://api.us-east.tinybird.co
+TINYBIRD_API_URL=https://api.tinybird.co
# Vercel's Domains API – required for adding and removing domains
# Learn how to set this up: https://vercel.com/templates/next.js/domains-api
diff --git a/packages/utils/src/constants/domains.ts b/packages/utils/src/constants/domains.ts
new file mode 100644
index 0000000000..05b952a0a5
--- /dev/null
+++ b/packages/utils/src/constants/domains.ts
@@ -0,0 +1,21 @@
+export const SECOND_LEVEL_DOMAINS = new Set([
+ "com",
+ "co",
+ "net",
+ "org",
+ "edu",
+ "gov",
+ "in",
+]);
+
+export const SPECIAL_APEX_DOMAINS = new Set([
+ "my.id",
+ "github.io",
+ "vercel.app",
+ "now.sh",
+ "pages.dev",
+ "webflow.io",
+ "netlify.app",
+ "fly.dev",
+ "web.app",
+]);
diff --git a/packages/utils/src/constants/framer-motion.ts b/packages/utils/src/constants/framer-motion.ts
new file mode 100644
index 0000000000..cb1e41353a
--- /dev/null
+++ b/packages/utils/src/constants/framer-motion.ts
@@ -0,0 +1,23 @@
+export const FRAMER_MOTION_LIST_ITEM_VARIANTS = {
+ hidden: { scale: 0.8, opacity: 0 },
+ show: { scale: 1, opacity: 1, transition: { type: "spring" } },
+};
+
+export const STAGGER_CHILD_VARIANTS = {
+ hidden: { opacity: 0, y: 20 },
+ show: { opacity: 1, y: 0, transition: { duration: 0.4, type: "spring" } },
+};
+
+export const SWIPE_REVEAL_ANIMATION_SETTINGS = {
+ initial: { height: 0 },
+ animate: { height: "auto" },
+ exit: { height: 0 },
+ transition: { duration: 0.15, ease: "easeOut" },
+};
+
+export const FADE_IN_ANIMATION_SETTINGS = {
+ initial: { opacity: 0 },
+ animate: { opacity: 1 },
+ exit: { opacity: 0 },
+ transition: { duration: 0.2 },
+};
diff --git a/packages/utils/src/constants/index.ts b/packages/utils/src/constants/index.ts
index 1a98c7afdc..cd0f0fce8a 100644
--- a/packages/utils/src/constants/index.ts
+++ b/packages/utils/src/constants/index.ts
@@ -1,41 +1,13 @@
export * from "./cctlds";
export * from "./countries";
+export * from "./domains";
+export * from "./framer-motion";
+export * from "./layout";
+export * from "./localhost";
+export * from "./middleware";
+export * from "./misc";
export * from "./pricing";
-
-export const LOCALHOST_GEO_DATA = {
- city: "San Francisco",
- region: "CA",
- country: "US",
- latitude: "37.7695",
- longitude: "-122.385",
-};
-export const LOCALHOST_IP = "63.141.57.109";
-
-export const FRAMER_MOTION_LIST_ITEM_VARIANTS = {
- hidden: { scale: 0.8, opacity: 0 },
- show: { scale: 1, opacity: 1, transition: { type: "spring" } },
-};
-
-export const STAGGER_CHILD_VARIANTS = {
- hidden: { opacity: 0, y: 20 },
- show: { opacity: 1, y: 0, transition: { duration: 0.4, type: "spring" } },
-};
-
-export const SWIPE_REVEAL_ANIMATION_SETTINGS = {
- initial: { height: 0 },
- animate: { height: "auto" },
- exit: { height: 0 },
- transition: { duration: 0.15, ease: "easeOut" },
-};
-
-export const FADE_IN_ANIMATION_SETTINGS = {
- initial: { opacity: 0 },
- animate: { opacity: 1 },
- exit: { opacity: 0 },
- transition: { duration: 0.2 },
-};
-
-export const PAGINATION_LIMIT = 100;
+export * from "./saml";
export const APP_NAME = process.env.NEXT_PUBLIC_APP_NAME || "Dub.co";
@@ -83,30 +55,6 @@ export const ADMIN_HOSTNAMES = new Set([
"admin.localhost:8888",
]);
-export const DEFAULT_REDIRECTS = {
- home: "https://dub.co",
- dub: "https://dub.co",
- signin: "https://app.dub.co/login",
- login: "https://app.dub.co/login",
- register: "https://app.dub.co/register",
- signup: "https://app.dub.co/register",
- app: "https://app.dub.co",
- dashboard: "https://app.dub.co",
- links: "https://app.dub.co/links",
- settings: "https://app.dub.co/settings",
- welcome: "https://app.dub.co/welcome",
- discord: "https://twitter.com/dubdotco", // placeholder for now
-};
-
-export const DUB_HEADERS = {
- headers: {
- "x-powered-by": "Dub.co - Link management for modern marketing teams",
- },
-};
-
-export const GOOGLE_FAVICON_URL =
- "https://www.google.com/s2/favicons?sz=64&domain_url=";
-
export const DUB_LOGO = "https://d2vwwcvoksz7ty.cloudfront.net/logo.png";
export const DUB_THUMBNAIL =
"https://d2vwwcvoksz7ty.cloudfront.net/thumbnail.png";
@@ -116,14 +64,6 @@ export const DUB_PROJECT_ID = "cl7pj5kq4006835rbjlt2ofka";
export const LEGAL_PROJECT_ID = "clrflia0j0000vs7sqfhz9c7q";
export const LEGAL_USER_ID = "clqei1lgc0000vsnzi01pbf47";
-export const HIDE_BACKGROUND_SEGMENTS = [
- "stats",
- "changelog",
- "terms",
- "privacy",
- "abuse",
-];
-
export const DUB_DOMAINS = [
{
id: "clce1z7ch00j0rbstbjufva4j",
@@ -191,94 +131,3 @@ export const DUB_DOMAINS = [
]
: []),
];
-
-export const ALL_TOOLS = [
- { name: "ChatGPT Link Shortener", slug: "chatgpt-link-shortener" },
- { name: "Amazon Link Shortener", slug: "amazon-link-shortener" },
- { name: "Spotify Link Shortener", slug: "spotify-link-shortener" },
- { name: "Metatags API", slug: "metatags" },
- { name: "QR Code API", slug: "qr-code" },
- { name: "Link Inspector", slug: "inspector" },
-];
-
-export const SECOND_LEVEL_DOMAINS = new Set([
- "com",
- "co",
- "net",
- "org",
- "edu",
- "gov",
- "in",
-]);
-
-export const SPECIAL_APEX_DOMAINS = new Set([
- "my.id",
- "github.io",
- "vercel.app",
- "now.sh",
- "pages.dev",
- "webflow.io",
- "netlify.app",
- "fly.dev",
- "web.app",
-]);
-
-export const DEFAULT_LINK_PROPS = {
- key: "",
- url: "",
- domain: "",
- archived: false,
- expiresAt: null,
- password: null,
-
- title: null,
- description: null,
- image: null,
- rewrite: false,
- ios: null,
- android: null,
-
- clicks: 0,
- userId: "",
-
- proxy: false,
-};
-
-export const SAML_PROVIDERS = [
- {
- name: "Okta",
- logo: "/_static/icons/okta.svg",
- saml: "okta",
- samlModalCopy: "Metadata URL",
- scim: "okta-scim-v2",
- scimModalCopy: {
- url: "SCIM 2.0 Base URL",
- token: "OAuth Bearer Token",
- },
- wip: false,
- },
- {
- name: "Azure AD",
- logo: "/_static/icons/azure.svg",
- saml: "azure",
- samlModalCopy: "App Federation Metadata URL",
- scim: "azure-scim-v2",
- scimModalCopy: {
- url: "Tenant URL",
- token: "Secret Token",
- },
- wip: false,
- },
- {
- name: "Google",
- logo: "/_static/icons/google.svg",
- saml: "google",
- samlModalCopy: "XML Metadata File",
- scim: "google",
- scimModalCopy: {
- url: "SCIM 2.0 Base URL",
- token: "OAuth Bearer Token",
- },
- wip: false,
- },
-];
diff --git a/packages/utils/src/constants/layout.ts b/packages/utils/src/constants/layout.ts
new file mode 100644
index 0000000000..b1c20e022e
--- /dev/null
+++ b/packages/utils/src/constants/layout.ts
@@ -0,0 +1,16 @@
+export const HIDE_BACKGROUND_SEGMENTS = [
+ "stats",
+ "changelog",
+ "terms",
+ "privacy",
+ "abuse",
+];
+
+export const ALL_TOOLS = [
+ { name: "ChatGPT Link Shortener", slug: "chatgpt-link-shortener" },
+ { name: "Amazon Link Shortener", slug: "amazon-link-shortener" },
+ { name: "Spotify Link Shortener", slug: "spotify-link-shortener" },
+ { name: "Metatags API", slug: "metatags" },
+ { name: "QR Code API", slug: "qr-code" },
+ { name: "Link Inspector", slug: "inspector" },
+];
diff --git a/packages/utils/src/constants/localhost.ts b/packages/utils/src/constants/localhost.ts
new file mode 100644
index 0000000000..3504c7b465
--- /dev/null
+++ b/packages/utils/src/constants/localhost.ts
@@ -0,0 +1,8 @@
+export const LOCALHOST_GEO_DATA = {
+ city: "San Francisco",
+ region: "CA",
+ country: "US",
+ latitude: "37.7695",
+ longitude: "-122.385",
+};
+export const LOCALHOST_IP = "63.141.57.109";
diff --git a/packages/utils/src/constants/middleware.ts b/packages/utils/src/constants/middleware.ts
new file mode 100644
index 0000000000..d602ca812b
--- /dev/null
+++ b/packages/utils/src/constants/middleware.ts
@@ -0,0 +1,20 @@
+export const DEFAULT_REDIRECTS = {
+ home: "https://dub.co",
+ dub: "https://dub.co",
+ signin: "https://app.dub.co/login",
+ login: "https://app.dub.co/login",
+ register: "https://app.dub.co/register",
+ signup: "https://app.dub.co/register",
+ app: "https://app.dub.co",
+ dashboard: "https://app.dub.co",
+ links: "https://app.dub.co/links",
+ settings: "https://app.dub.co/settings",
+ welcome: "https://app.dub.co/welcome",
+ discord: "https://twitter.com/dubdotco", // placeholder for now
+};
+
+export const DUB_HEADERS = {
+ headers: {
+ "x-powered-by": "Dub.co - Link management for modern marketing teams",
+ },
+};
diff --git a/packages/utils/src/constants/misc.ts b/packages/utils/src/constants/misc.ts
new file mode 100644
index 0000000000..060a51bdc1
--- /dev/null
+++ b/packages/utils/src/constants/misc.ts
@@ -0,0 +1,25 @@
+export const DEFAULT_LINK_PROPS = {
+ key: "",
+ url: "",
+ domain: "",
+ archived: false,
+ expiresAt: null,
+ password: null,
+
+ title: null,
+ description: null,
+ image: null,
+ rewrite: false,
+ ios: null,
+ android: null,
+
+ clicks: 0,
+ userId: "",
+
+ proxy: false,
+};
+
+export const GOOGLE_FAVICON_URL =
+ "https://www.google.com/s2/favicons?sz=64&domain_url=";
+
+export const PAGINATION_LIMIT = 100;
diff --git a/packages/utils/src/constants/saml.ts b/packages/utils/src/constants/saml.ts
new file mode 100644
index 0000000000..271abbdd5a
--- /dev/null
+++ b/packages/utils/src/constants/saml.ts
@@ -0,0 +1,38 @@
+export const SAML_PROVIDERS = [
+ {
+ name: "Okta",
+ logo: "/_static/icons/okta.svg",
+ saml: "okta",
+ samlModalCopy: "Metadata URL",
+ scim: "okta-scim-v2",
+ scimModalCopy: {
+ url: "SCIM 2.0 Base URL",
+ token: "OAuth Bearer Token",
+ },
+ wip: false,
+ },
+ {
+ name: "Azure AD",
+ logo: "/_static/icons/azure.svg",
+ saml: "azure",
+ samlModalCopy: "App Federation Metadata URL",
+ scim: "azure-scim-v2",
+ scimModalCopy: {
+ url: "Tenant URL",
+ token: "Secret Token",
+ },
+ wip: false,
+ },
+ {
+ name: "Google",
+ logo: "/_static/icons/google.svg",
+ saml: "google",
+ samlModalCopy: "XML Metadata File",
+ scim: "google",
+ scimModalCopy: {
+ url: "SCIM 2.0 Base URL",
+ token: "OAuth Bearer Token",
+ },
+ wip: false,
+ },
+];