npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mpa-common-components-fe

v1.4.56

Published

Common frontend components for MPA applications

Readme

mpa-common-components-fe

A React component library providing common frontend components for MPA (Multi-Page Application) applications.

Installation

npm install mpa-common-components-fe

Usage

Header Component

The main component is the Header which provides a complete header with device selector, notifications, brand links, and personal dropdown.

import { Header } from 'mpa-common-components-fe';

function App() {
  const [selectedDeviceId, setSelectedDeviceId] = useState('device1');
  
  const handleDeviceChange = (deviceId: string) => {
    setSelectedDeviceId(deviceId);
  };

  return (
    <Header
      selectedDeviceId={selectedDeviceId}
      onDeviceChange={handleDeviceChange}
      isVisibleDeviceSelector={true}
      rightComponents={<div>Custom right content</div>}
      leftComponents={<div>Custom left content</div>}
    />
  );
}

DeviceManagement Component

A comprehensive device management dashboard with tabs, sync settings, and history management.

import { DeviceManagement } from 'mpa-common-components-fe';

function App() {
  const [selectedDeviceId, setSelectedDeviceId] = useState('device1');
  
  const devices = [
    { id: 'device1', name: 'SM-A528B' },
    { id: 'device2', name: 'iPhone 14' },
    { id: 'device3', name: 'Samsung Galaxy' }
  ];

  const handleDeviceChange = (deviceId: string) => {
    setSelectedDeviceId(deviceId);
  };

  return (
    <DeviceManagement
      selectedDeviceId={selectedDeviceId}
      onDeviceChange={handleDeviceChange}
      devices={devices}
    />
  );
}

DeviceManagement Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | selectedDeviceId | string | Yes | The currently selected device ID | | onDeviceChange | (deviceId: string) => void | Yes | Callback when device selection changes | | devices | Array<{id: string, name: string}> | No | Array of available devices |

DeviceManagement Features

  • Top Bar: Shows expiry date and device selector
  • Tab Navigation: 6 tabs with numbered badges (1-3)
    • Sync Settings (active by default)
    • Device Information
    • Check Connection (Beta)
    • Export Data
    • Uninstall
    • Remove Device
  • Sync Status: Shows last sync time and next sync status
  • History Management: GPS, SMS, and Call history with checkboxes and clear buttons

Header Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | selectedDeviceId | string | Yes | The currently selected device ID | | onDeviceChange | (deviceId: string) => void | Yes | Callback when device selection changes | | isVisibleDeviceSelector | boolean | Yes | Whether to show the device selector | | rightComponents | React.ReactNode | No | Custom components to render on the right side | | leftComponents | React.ReactNode | No | Custom components to render on the left side |

Utility Functions

The package also exports utility functions for working with brand links and subdomains:

import { 
  getCapitalizedSubdomainFromUrl,
  getSubdomainFromUrl,
  capitalizeFirstLetter,
  findCurrentBrandLink 
} from 'mpa-common-components-fe';

// Get the capitalized subdomain from current URL
const subdomain = getCapitalizedSubdomainFromUrl(); // e.g., "Contact" from "contact.myphones.app"

// Get the raw subdomain
const rawSubdomain = getSubdomainFromUrl(); // e.g., "contact"

// Capitalize first letter of a string
const capitalized = capitalizeFirstLetter('hello'); // "Hello"

// Find current brand link from array of brand links
const currentBrandId = findCurrentBrandLink(brandLinks, window.location.href);

Dependencies

This package has the following peer dependencies:

  • react (^18.0.0 || ^19.0.0)
  • react-dom (^18.0.0 || ^19.0.0)

And the following dependencies:

  • @jframework/jfw-js (^5.1.3)
  • @tanstack/react-query (^5.83.0)
  • 1byte-react-design (^1.5.11-1)
  • antd (^5.26.6)
  • react-cookie (^8.0.1)

Development

# Install dependencies
npm install

# Start development server
npm run dev

# Build for production
npm run build

# Build library for npm
npm run build:lib

# Lint code
npm run lint

License

MIT