Members

(constant) I18nProvider

I18nProvider Component

Provides internationalization support for the application by managing locale selection and translations.

I18nProvider Component

Provides internationalization support for the application by managing locale selection and translations. Uses React Context API to provide access to the current locale and translation function (t).

Example
<I18nProvider defaultLocale="es">
  <App />
</I18nProvider>

(constant) I18nProvider

I18nProvider Component

Provides internationalization support for the application by managing locale selection and translations.

I18nProvider Component

Provides internationalization support for the application by managing locale selection and translations. Uses React Context API to provide access to the current locale and translation function (t).

Example
<I18nProvider defaultLocale="es">
  <App />
</I18nProvider>

(constant) buildQueryString

Build a query string from an object.

Build a query string from an object.

Converts an object of key/value pairs into a URL query string.

Example
const qs = buildQueryString({ foo: "bar", baz: "qux" });
console.log(qs); // "?foo=bar&baz=qux"

(constant) buildQueryString

Build a query string from an object.

Build a query string from an object.

Converts an object of key/value pairs into a URL query string.

Example
const qs = buildQueryString({ foo: "bar", baz: "qux" });
console.log(qs); // "?foo=bar&baz=qux"

(constant) debounce

Debounce function.

Debounce function.

Returns a debounced version of the provided function that delays its execution until after a specified delay has elapsed since the last time it was invoked.

Example
const debouncedLog = debounce(() => console.log('Debounced!'), 300);
window.addEventListener('resize', debouncedLog);

(constant) debounce

Debounce function.

Debounce function.

Returns a debounced version of the provided function that delays its execution until after a specified delay has elapsed since the last time it was invoked.

Example
const debouncedLog = debounce(() => console.log('Debounced!'), 300);
window.addEventListener('resize', debouncedLog);

(constant) deepClone

Deep clone an object.

Deep clone an object.

Creates a deep copy of an object. This implementation uses JSON methods, which is simple but has limitations (e.g., it doesn't copy functions or handle special objects).

Example
const original = { a: 1, b: { c: 2 } };
const clone = deepClone(original);
console.log(clone); // { a: 1, b: { c: 2 } }

(constant) deepClone

Deep clone an object.

Deep clone an object.

Creates a deep copy of an object. This implementation uses JSON methods, which is simple but has limitations (e.g., it doesn't copy functions or handle special objects).

Example
const original = { a: 1, b: { c: 2 } };
const clone = deepClone(original);
console.log(clone); // { a: 1, b: { c: 2 } }

(constant) formatDate

Format a date using the browser's locale.

Format a date using the browser's locale.

Converts a given date to a localized string format.

Example
const formattedDate = formatDate(new Date(), 'en-GB', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' });
console.log(formattedDate); // e.g., "Monday, 14 June 2021"

(constant) formatDate

Format a date using the browser's locale.

Format a date using the browser's locale.

Converts a given date to a localized string format.

Example
const formattedDate = formatDate(new Date(), 'en-GB', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' });
console.log(formattedDate); // e.g., "Monday, 14 June 2021"

(constant) generateUUID

Generate a UUID (version 4).

Generate a UUID (version 4).

Generates a universally unique identifier. Uses the built-in crypto.randomUUID if available; otherwise, falls back to a manual implementation.

Example
const id = generateUUID();
console.log(id); // e.g., "3b12f1df-5232-4f5c-9f8a-9c1234567890"

(constant) generateUUID

Generate a UUID (version 4).

Generate a UUID (version 4).

Generates a universally unique identifier. Uses the built-in crypto.randomUUID if available; otherwise, falls back to a manual implementation.

Example
const id = generateUUID();
console.log(id); // e.g., "3b12f1df-5232-4f5c-9f8a-9c1234567890"

(constant) iconCache :Map.<string, React.LazyExoticComponent.<any>>

Cache for dynamically imported icons.

Cache for dynamically imported icons. Keys are constructed from iconSet and iconName.

Type:
  • Map.<string, React.LazyExoticComponent.<any>>

(constant) iconCache :Map.<string, React.LazyExoticComponent.<any>>

Cache for dynamically imported icons.

Cache for dynamically imported icons. Keys are constructed from iconSet and iconName.

Type:
  • Map.<string, React.LazyExoticComponent.<any>>

(constant) mergeObjects

Merge multiple objects deeply.

Merge multiple objects deeply.

Merges source objects into a target object recursively. For any key that exists in multiple objects, later sources override earlier ones.

Example
const defaults = { a: 1, b: { c: 2 } };
const options = { b: { d: 3 } };
const merged = mergeObjects({}, defaults, options);
console.log(merged); // { a: 1, b: { c: 2, d: 3 } }

(constant) mergeObjects

Merge multiple objects deeply.

Merge multiple objects deeply.

Merges source objects into a target object recursively. For any key that exists in multiple objects, later sources override earlier ones.

Example
const defaults = { a: 1, b: { c: 2 } };
const options = { b: { d: 3 } };
const merged = mergeObjects({}, defaults, options);
console.log(merged); // { a: 1, b: { c: 2, d: 3 } }

(constant) parseQueryString

Parse a query string into an object.

Parse a query string into an object.

Converts a URL query string into an object of key/value pairs.

Example
const params = parseQueryString('?foo=bar&baz=qux');
console.log(params); // { foo: "bar", baz: "qux" }

(constant) parseQueryString

Parse a query string into an object.

Parse a query string into an object.

Converts a URL query string into an object of key/value pairs.

Example
const params = parseQueryString('?foo=bar&baz=qux');
console.log(params); // { foo: "bar", baz: "qux" }

(constant) throttle

Throttle function.

Throttle function.

Returns a throttled version of the provided function that ensures it is executed at most once every specified time interval.

Example
const throttledLog = throttle(() => console.log('Throttled!'), 1000);
window.addEventListener('scroll', throttledLog);

(constant) throttle

Throttle function.

Throttle function.

Returns a throttled version of the provided function that ensures it is executed at most once every specified time interval.

Example
const throttledLog = throttle(() => console.log('Throttled!'), 1000);
window.addEventListener('scroll', throttledLog);

(constant) translations :Object

Object containing all available translations.

Object containing all available translations.

Type:
  • Object
Properties
NameTypeDescription
enObject

English translations.

esObject

Spanish translations.

(constant) translations :Object

Object containing all available translations.

Object containing all available translations.

Type:
  • Object
Properties
NameTypeDescription
enObject

English translations.

esObject

Spanish translations.

(constant) useI18n

Custom hook to access the internationalization (i18n) context.

Custom hook to access the internationalization (i18n) context.

This hook uses React's useContext to retrieve the current value of I18nContext, providing components with access to localization methods, language settings, and translation utilities.

Example
import React from 'react';
import { useI18n } from '@/hooks/useI18n';

const MyComponent = () => {
  const { translate } = useI18n();

  return (
    <div>
      {translate('welcome_message')}
    </div>
  );
};

export default MyComponent;

(constant) useI18n

Custom hook to access the internationalization (i18n) context.

Custom hook to access the internationalization (i18n) context.

This hook uses React's useContext to retrieve the current value of I18nContext, providing components with access to localization methods, language settings, and translation utilities.

Example
import React from 'react';
import { useI18n } from '@/hooks/useI18n';

const MyComponent = () => {
  const { translate } = useI18n();

  return (
    <div>
      {translate('welcome_message')}
    </div>
  );
};

export default MyComponent;

Methods

Icon(props) → {JSX.Element}

Generic Icon component that dynamically imports icons from react-icons.

Generic Icon component that dynamically imports icons from react-icons.

Parameters:
NameTypeDescription
propsObject

The props for the Icon component.

Properties
NameTypeAttributesDescription
iconSetstring

The icon set to load from (e.g., "fa", "md", "gi", "si").

iconNamestring

The name of the icon to import (e.g., "FaBeer").

sizenumber | string<optional>

The size of the icon.

styleReact.CSSProperties<optional>

Inline styles to apply to the icon.

classNamestring<optional>

Additional class names for the icon.

restObject<optional>

Any additional props to pass to the icon.

Returns:

The rendered icon component.

Type: 
JSX.Element
Example
// Renders a FontAwesome beer icon with a size of 32px and orange color.
<Icon iconSet="fa" iconName="FaBeer" size={32} style={{ color: 'orange' }} />

Icon(props) → {JSX.Element}

Generic Icon component that dynamically imports icons from react-icons.

Generic Icon component that dynamically imports icons from react-icons.

Parameters:
NameTypeDescription
propsObject

The props for the Icon component.

Properties
NameTypeAttributesDescription
iconSetstring

The icon set to load from (e.g., "fa", "md", "gi", "si").

iconNamestring

The name of the icon to import (e.g., "FaBeer").

sizenumber | string<optional>

The size of the icon.

styleReact.CSSProperties<optional>

Inline styles to apply to the icon.

classNamestring<optional>

Additional class names for the icon.

restObject<optional>

Any additional props to pass to the icon.

Returns:

The rendered icon component.

Type: 
JSX.Element
Example
// Renders a FontAwesome beer icon with a size of 32px and orange color.
<Icon iconSet="fa" iconName="FaBeer" size={32} style={{ color: 'orange' }} />

Spinner() → {JSX.Element}

Spinner Component A generic spinner using inline SVG that serves as a fallback while content is loading.

Spinner Component A generic spinner using inline SVG that serves as a fallback while content is loading.

Returns:

The spinner element.

Type: 
JSX.Element

Spinner() → {JSX.Element}

Spinner Component A generic spinner using inline SVG that serves as a fallback while content is loading.

Spinner Component A generic spinner using inline SVG that serves as a fallback while content is loading.

Returns:

The spinner element.

Type: 
JSX.Element

changeLocale(_newLocale)

Placeholder function for changing locale.

Placeholder function for changing locale.

Parameters:
NameTypeDescription
_newLocalestring

The new locale.

changeLocale(_newLocale)

Placeholder function for changing locale.

Placeholder function for changing locale.

Parameters:
NameTypeDescription
_newLocalestring

The new locale.

getCachedIcon(iconSet, iconName) → {React.LazyExoticComponent.<React.ComponentType.<any>>}

Dynamically import and cache the desired icon from react-icons.

Dynamically import and cache the desired icon from react-icons.

Parameters:
NameTypeDescription
iconSetstring

The icon set to import from (e.g., "fa", "md", "gi", "si").

iconNamestring

The name of the icon (e.g., "FaBeer").

Returns:

The lazy-loaded icon component.

Type: 
React.LazyExoticComponent.<React.ComponentType.<any>>

getCachedIcon(iconSet, iconName) → {React.LazyExoticComponent.<React.ComponentType.<any>>}

Dynamically import and cache the desired icon from react-icons.

Dynamically import and cache the desired icon from react-icons.

Parameters:
NameTypeDescription
iconSetstring

The icon set to import from (e.g., "fa", "md", "gi", "si").

iconNamestring

The name of the icon (e.g., "FaBeer").

Returns:

The lazy-loaded icon component.

Type: 
React.LazyExoticComponent.<React.ComponentType.<any>>

t(key, …_args) → {string}

Default translation function with interpolation.

Default translation function with interpolation.

Parameters:
NameTypeAttributesDescription
keystring

Translation key.

_argsstring<repeatable>

Interpolation arguments.

Returns:

Translated string.

Type: 
string

t(key, …_args) → {string}

Default translation function with interpolation.

Default translation function with interpolation.

Parameters:
NameTypeAttributesDescription
keystring

Translation key.

_argsstring<repeatable>

Interpolation arguments.

Returns:

Translated string.

Type: 
string

Type Definitions

ErrorHandlerOptions

Type:
  • Object
Properties
NameTypeAttributesDefaultDescription
loggerLogger<optional>

A Logger instance for logging errors. Defaults to a console logger.

sentryEnabledboolean<optional>
false

Flag to enable Sentry integration.

sentryDsnstring<optional>

The DSN for Sentry initialization. Required if sentryEnabled is true.

ErrorHandlerOptions

Type:
  • Object
Properties
NameTypeAttributesDefaultDescription
loggerLogger<optional>

A Logger instance for logging errors. Defaults to a console logger.

sentryEnabledboolean<optional>
false

Flag to enable Sentry integration.

sentryDsnstring<optional>

The DSN for Sentry initialization. Required if sentryEnabled is true.

FetchServiceOptions

Type:
  • Object
Properties
NameTypeAttributesDescription
loggerLogger<optional>

A Logger instance to log API requests and responses. Defaults to a console logger if not provided.

defaultOptionsObject<optional>

Default options for fetch requests, which will be merged with each call.

FetchServiceOptions

Type:
  • Object
Properties
NameTypeAttributesDescription
loggerLogger<optional>

A Logger instance to log API requests and responses. Defaults to a console logger if not provided.

defaultOptionsObject<optional>

Default options for fetch requests, which will be merged with each call.

LoggerOptions

Type:
  • Object
Properties
NameTypeAttributesDefaultDescription
typestring<optional>
'console'

The logging type to use. Options: 'console', 'csv', or 'sqlite'.

filePathstring<optional>

For CSV logging, the file path to store log entries.

dbPathstring<optional>

For SQLite logging, the database file path.

LoggerOptions

Type:
  • Object
Properties
NameTypeAttributesDefaultDescription
typestring<optional>
'console'

The logging type to use. Options: 'console', 'csv', or 'sqlite'.

filePathstring<optional>

For CSV logging, the file path to store log entries.

dbPathstring<optional>

For SQLite logging, the database file path.