Skip to content

External URLs Module

The external URLs module (lib/external-urls/index.js) provides a centralized location for all external URLs and links used throughout the application. This includes third-party services, documentation links, social media profiles, and API endpoints.

Purpose

  • Centralized external link management: All external URLs are defined in one place for easier maintenance
  • Consistent URL generation: Helper functions ensure URLs are generated correctly with proper encoding
  • Easy updates: When external services change URLs, only one file needs to be updated

URL Categories

Google Services

Google Maps

import { GOOGLE_MAPS } from '@power-rent/lib/external-urls';
// Generate Google Maps place URL by place_id
GOOGLE_MAPS.getPlaceUrl('ChIJN1t_tDeuEmsRUsoyG83frY4')
// Returns: 'https://www.google.com/maps/place/?q=place_id:ChIJN1t_tDeuEmsRUsoyG83frY4'
// Documentation links
GOOGLE_MAPS.DOCS.DISTANCE_MATRIX_OVERVIEW
// 'https://developers.google.com/maps/documentation/distance-matrix/overview'
GOOGLE_MAPS.DOCS.DISTANCE_MATRIX_RESPONSE
// 'https://developers.google.com/maps/documentation/distance-matrix/distance-matrix#DistanceMatrixResponse-status'

Google Fonts

import { GOOGLE_FONTS } from '@power-rent/lib/external-urls';
// Font stylesheets
GOOGLE_FONTS.MONTSERRAT_FULL
// 'https://fonts.googleapis.com/css?family=Montserrat:500,600,700&display=swap&subset=cyrillic,cyrillic-ext,latin-ext'
GOOGLE_FONTS.ROBOTO_FULL
// 'https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap&subset=cyrillic,cyrillic-ext,latin-ext'
GOOGLE_FONTS.INTER
// 'https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap'
// Static domain for preconnect optimization
GOOGLE_FONTS.STATIC_DOMAIN
// 'https://fonts.gstatic.com'

Stripe

import { STRIPE } from '@power-rent/lib/external-urls';
// Generate Stripe Connect account dashboard URL
STRIPE.getConnectAccountUrl('acct_1234567890')
// Returns: 'https://dashboard.stripe.com/connect/accounts/acct_1234567890'
// Generate Stripe customer dashboard URL
STRIPE.getCustomerUrl('cus_1234567890')
// Returns: 'https://dashboard.stripe.com/customers/cus_1234567890'
// Generate Stripe payment URL (with environment prefix)
STRIPE.getPaymentUrl('/test', 'pi_1234567890')
// Returns: 'https://dashboard.stripe.com/test/payments/pi_1234567890'
// Support documentation
STRIPE.SUPPORT.LOCATE_API_KEYS
// 'https://support.stripe.com/questions/locate-api-keys-in-the-dashboard'

YouTube

import { YOUTUBE } from '@power-rent/lib/external-urls';
// Billion Rent YouTube channel
YOUTUBE.BILLION_CHANNEL
// 'https://www.youtube.com/@BillionRent'
// Video URLs
YOUTUBE.VIDEOS.START_INSTRUCTIONS_MOBILE
// 'https://www.youtube.com/watch?v=KKuExLcGs_w'
YOUTUBE.VIDEOS.START_INSTRUCTIONS_DESKTOP
// 'https://www.youtube.com/watch?v=xYGMKfRUVMk'
YOUTUBE.VIDEOS.VIDEO_PROOF_MOBILE
// 'https://www.youtube.com/watch?v=sequBAnTejQ&t=18s'
YOUTUBE.VIDEOS.VIDEO_PROOF_DESKTOP
// 'https://www.youtube.com/watch?v=MBNgw2mHfMo'

Billion Rent

import { BILLION } from '@power-rent/lib/external-urls';
// Billion Rent homepage
BILLION.HOME
// 'https://billionrent.com'
// Social media profiles
BILLION.LINKEDIN
// 'https://www.linkedin.com/company/billion-rent'
BILLION.FACEBOOK
// 'https://www.facebook.com/billionrentapp?mibextid=ZbWKwL'
BILLION.INSTAGRAM
// 'https://www.instagram.com/billion_rent?igsh=MW9wcXB5dno4azg1dg=='
// WhatsApp contact
BILLION.WHATSAPP
// 'https://wa.me/393334667151'

Linear

import { LINEAR } from '@power-rent/lib/external-urls';
// Documentation links
LINEAR.PLANS_MANAGEMENT
// 'https://linear.app/toprent/document/plans-management-db0344f07fb9'
LINEAR.PRICING_MANAGEMENT
// 'https://linear.app/toprent/document/pricing-management-6649a69392ce'

External Services

import { EXTERNAL_SERVICES } from '@power-rent/lib/external-urls';
// Freepik image attribution
EXTERNAL_SERVICES.FREEPIK.OFFLINE_BANNER_IMAGE
// 'https://www.freepik.com/free-vector/internet-network-warning-404-error-page-file-found-web-page_16304695.htm#query=no%20internet%20connection&position=6&from_view=keyword&track=ais'
// EstiaCard website
EXTERNAL_SERVICES.ESTIACARD
// 'https://estiacard.com/'
// Cargos documentation
EXTERNAL_SERVICES.CARGOS_DOCS
// 'https://toprentapp.com/tpost/3cviml94a1-cargos-come-funziona-e-a-cosa-serve'

URL Shortener

import { SHORTENER } from '@power-rent/lib/external-urls';
// Shortener API endpoint
SHORTENER.API_URL
// 'https://short.toprent.app/api/short'

Usage Examples

import { BILLION, YOUTUBE } from '@power-rent/lib/external-urls';
function SocialLinks() {
const handleOpenLinkedIn = () => {
window.open(BILLION.LINKEDIN, '_blank', 'noopener,noreferrer');
};
const handleWatchVideo = () => {
window.open(YOUTUBE.VIDEOS.START_INSTRUCTIONS_DESKTOP, '_blank');
};
return (
<div>
<button onClick={handleOpenLinkedIn}>LinkedIn</button>
<button onClick={handleWatchVideo}>Watch Tutorial</button>
</div>
);
}

Google Maps Integration

import { GOOGLE_MAPS } from '@power-rent/lib/external-urls';
function LocationLink({ placeId, children }) {
const mapsUrl = GOOGLE_MAPS.getPlaceUrl(placeId);
return (
<a href={mapsUrl} target="_blank" rel="noopener noreferrer">
{children}
</a>
);
}
import { STRIPE } from '@power-rent/lib/external-urls';
function PaymentDetails({ paymentIntentId, environment = '' }) {
const stripeUrl = STRIPE.getPaymentUrl(environment, paymentIntentId);
return (
<a href={stripeUrl} target="_blank" rel="noopener noreferrer">
View in Stripe Dashboard
</a>
);
}

Google Fonts Preconnect

import { GOOGLE_FONTS } from '@power-rent/lib/external-urls';
import Head from 'next/head';
function FontOptimization() {
return (
<Head>
<link rel="preconnect" href={GOOGLE_FONTS.STATIC_DOMAIN} crossOrigin="anonymous" />
<link href={GOOGLE_FONTS.INTER} rel="stylesheet" />
</Head>
);
}
import Link from 'next/link';
import { BILLION, EXTERNAL_SERVICES } from '@power-rent/lib/external-urls';
function Footer() {
return (
<footer>
<Link href={BILLION.HOME}>Billion Rent</Link>
<Link href={EXTERNAL_SERVICES.ESTIACARD}>EstiaCard</Link>
</footer>
);
}

Type Exports

The module exports Flow types for each URL category:

import type {
GoogleMapsUrl,
GoogleFontsUrl,
StripeUrl,
YoutubeUrl,
BillionUrl,
LinearUrl,
ExternalServicesUrl,
} from '@power-rent/lib/external-urls';

Best Practices

  1. Always use URL constants: Never hardcode external URLs. Use the exported constants instead.
  2. Use helper functions: For dynamic URLs (like Stripe dashboard links), use the provided helper functions to ensure proper encoding.
  3. Security: When opening external links, always use rel="noopener noreferrer" for security.
  4. Import only what you need: Import specific URL categories to keep bundle size small.
  5. Update documentation: When adding new external URLs, update this documentation.

Maintenance

When adding new external URLs:

  1. Add the URL constant to the appropriate category object
  2. If the URL requires dynamic parameters, add a helper function following the existing naming pattern
  3. For documentation links, group them under a DOCS or SUPPORT sub-object
  4. Update this documentation to reflect the new URLs