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

@bestvoy/order-tracking

v1.0.2

Published

A framework-agnostic order tracking search component that works with any frontend framework

Downloads

6

Readme

Order Tracking Component

A framework-agnostic, lightweight order tracking search component that works with any frontend framework or vanilla JavaScript.

Features

  • 🚀 Framework-agnostic (works with React, Vue, Angular, Svelte, or vanilla JS)
  • 📱 Responsive design with mobile support
  • 🎨 Customizable text labels
  • 🌙 Dark mode support
  • 📦 Lightweight (~5KB minified + gzipped)
  • ♿ Accessible
  • 🔌 Easy to integrate

Installation

npm install @bestvoy/order-tracking

Or via CDN:

<link rel="stylesheet" href="https://unpkg.com/@bestvoy/order-tracking/dist/order-tracking.min.css">
<script src="https://unpkg.com/@bestvoy/order-tracking/dist/order-tracking.min.js"></script>

Usage

Vanilla JavaScript

<!DOCTYPE html>
<html>
<body>
  <div id="tracking-container"></div>

  <!-- CSS is automatically injected, no need to include separately -->
  <script src="node_modules/@bestvoy/order-tracking/dist/order-tracking.js"></script>
  <script>
    const tracker = new OrderTracking({
      apiUrl: '/api/common/order_tracking',
      container: '#tracking-container',
      onSuccess: (data) => {
        console.log('Tracking successful:', data);
      },
      onError: (error) => {
        console.error('Tracking error:', error);
      }
    });
  </script>
</body>
</html>

React

import { useEffect, useRef } from 'react';
import OrderTracking from '@bestvoy/order-tracking';
import '@bestvoy/order-tracking/dist/order-tracking.css';

function TrackingComponent() {
  const containerRef = useRef(null);
  const trackerRef = useRef(null);

  useEffect(() => {
    if (containerRef.current) {
      trackerRef.current = new OrderTracking({
        apiUrl: '/api/common/order_tracking',
        container: containerRef.current,
        texts: {
          title: 'Track Your Order',
          placeholder: 'Enter order number',
          trackButton: 'Track'
        },
        onSuccess: (data) => {
          console.log('Success:', data);
        },
        onError: (error) => {
          console.error('Error:', error);
        }
      });
    }

    return () => {
      if (trackerRef.current) {
        trackerRef.current.destroy();
      }
    };
  }, []);

  return <div ref={containerRef}></div>;
}

Vue 3

<template>
  <div ref="trackingContainer"></div>
</template>

<script setup>
import { ref, onMounted, onUnmounted } from 'vue';
import OrderTracking from '@bestvoy/order-tracking';
import '@bestvoy/order-tracking/dist/order-tracking.css';

const trackingContainer = ref(null);
let tracker = null;

onMounted(() => {
  tracker = new OrderTracking({
    apiUrl: '/api/common/order_tracking',
    container: trackingContainer.value,
    onSuccess: (data) => {
      console.log('Success:', data);
    },
    onError: (error) => {
      console.error('Error:', error);
    }
  });
});

onUnmounted(() => {
  if (tracker) {
    tracker.destroy();
  }
});
</script>

Angular

import { Component, ElementRef, ViewChild, AfterViewInit, OnDestroy } from '@angular/core';
import OrderTracking from '@bestvoy/order-tracking';

@Component({
  selector: 'app-tracking',
  template: '<div #trackingContainer></div>',
  styles: [`@import '@bestvoy/order-tracking/dist/order-tracking.css';`]
})
export class TrackingComponent implements AfterViewInit, OnDestroy {
  @ViewChild('trackingContainer') containerRef!: ElementRef;
  private tracker: any;

  ngAfterViewInit() {
    this.tracker = new OrderTracking({
      apiUrl: '/api/common/order_tracking',
      container: this.containerRef.nativeElement,
      onSuccess: (data) => {
        console.log('Success:', data);
      },
      onError: (error) => {
        console.error('Error:', error);
      }
    });
  }

  ngOnDestroy() {
    if (this.tracker) {
      this.tracker.destroy();
    }
  }
}

Svelte

<script>
  import { onMount, onDestroy } from 'svelte';
  import OrderTracking from '@bestvoy/order-tracking';
  import '@bestvoy/order-tracking/dist/order-tracking.css';

  let container;
  let tracker;

  onMount(() => {
    tracker = new OrderTracking({
      apiUrl: '/api/common/order_tracking',
      container: container,
      onSuccess: (data) => {
        console.log('Success:', data);
      },
      onError: (error) => {
        console.error('Error:', error);
      }
    });
  });

  onDestroy(() => {
    if (tracker) {
      tracker.destroy();
    }
  });
</script>

<div bind:this={container}></div>

API

Constructor Options

| Option | Type | Required | Default | Description | |--------|------|----------|---------|-------------| | apiUrl | string | Yes | - | API endpoint URL (e.g., '/api/common/order_tracking') | | container | string \| HTMLElement | Yes | - | CSS selector or DOM element for the container | | texts | object | No | See below | Custom text labels | | onError | function | No | () => {} | Error callback function | | onSuccess | function | No | () => {} | Success callback function |

Text Options

{
  title: 'Order Tracking',
  placeholder: 'Enter your order number',
  trackButton: 'Track',
  errorEmpty: 'Please enter an order number',
  errorNotFound: 'Could Not Find Order',
  errorNotShipped: 'This order has not been shipped yet. Please check again after it has been shipped',
  errorGeneric: 'An error occurred while tracking your order'
}

Methods

destroy()

Clean up and remove the component.

tracker.destroy();

updateConfig(options)

Update component configuration.

tracker.updateConfig({
  texts: {
    title: 'New Title'
  }
});

API Response Format

The component expects the API to return JSON in the following format:

{
  "delivery_id": "1234567890"
}

If delivery_id exists, the component will open a tracking page at 17track.net.

Styling

The component uses CSS classes prefixed with order-tracking- to avoid conflicts. You can override styles:

.order-tracking-search-title {
  color: #your-color;
  font-size: 32px;
}

.order-tracking-search-button {
  background: #your-brand-color;
}

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)
  • Mobile browsers

License

MIT

Support

For issues and questions, please visit GitHub Issues