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

@hg-storefront/order-feedback

v1.0.3

Published

React hooks and SDK plugin configuration for the order feedback flow in Hemglass storefront.

Readme

@hg-storefront/order-feedback

React hooks and SDK plugin configuration for the order feedback flow in Hemglass storefront.

What This Package Adds

When OrderFeedbackPlugin is enabled, the storefront SDK gets these methods:

  • orderFeedbackEligibility(orderId) -> checks if feedback is currently allowed for an order
  • setOrderFeedbackRating({ orderId, rating }) -> saves rating step (1-5)
  • submitOrderFeedback({ orderId, rating, comment }) -> submits final feedback

The API can return success or typed business errors such as:

  • OrderNotEligibleForFeedbackError
  • InvalidOrderFeedbackRatingError
  • OrderFeedbackMissingRatingError
  • OrderFeedbackCommentRequiredError
  • OrderFeedbackCommentTooLongError

Setup

Add OrderFeedbackPlugin to the pluginConfigs array in your provider configuration:

import { OrderFeedbackPlugin } from '@hg-storefront/order-feedback'

export const providerConfig = {
  options: {
    pluginConfigs: [OrderFeedbackPlugin],
  },
}

How The Flow Works

  1. Check eligibility with useOrderFeedbackEligibility(orderId)
  2. User selects rating -> call setRating({ orderId, rating })
  3. User submits comment + rating -> call submitFeedback({ orderId, rating, comment })
  4. Handle success/error result from each call

useOrderFeedbackEligibility is configured to stay live:

  • staleTime: 0
  • gcTime: 0
  • refetch on mount, window focus, and reconnect
  • rating/submit mutations do not automatically invalidate or refetch the eligibility query

Hook API

useOrderFeedbackEligibility(orderId, enabled?)

Returns React Query query state, for example:

  • data: boolean | OrderFeedbackErrorResult
  • isLoading
  • error
  • refetch

useSetOrderFeedbackRating()

Returns:

  • setRating(input) - async action function
  • error
  • isLoading

useSubmitOrderFeedback()

Returns:

  • submitFeedback(input) - async action function
  • error
  • isLoading

Types And Input Shape

type SetOrderFeedbackRatingInput = {
  orderId: string
  rating: number
}

type SubmitOrderFeedbackInput = {
  orderId: string
  rating: number
  comment?: string | null
}

Usage Example

import {
  useOrderFeedbackEligibility,
  useSetOrderFeedbackRating,
  useSubmitOrderFeedback,
} from '@hg-storefront/order-feedback'

function OrderFeedback({ orderId }: { orderId: string }) {
  const { data: eligibility } = useOrderFeedbackEligibility(orderId)
  const { setRating, isLoading: isRatingLoading } = useSetOrderFeedbackRating()
  const { submitFeedback, isLoading: isSubmitLoading } = useSubmitOrderFeedback()

  const onRate = async (rating: number) => {
    await setRating({ orderId, rating })
  }

  const onSubmit = async (rating: number, comment?: string) => {
    await submitFeedback({
      orderId,
      rating,
      comment: comment ?? null,
    })
  }

  return (
    <div>
      <div>Eligibility: {typeof eligibility === 'boolean' ? String(eligibility) : 'error'}</div>
      <button onClick={() => onRate(5)} disabled={isRatingLoading}>
        Rate 5
      </button>
      <button onClick={() => onSubmit(5, 'Super!')} disabled={isSubmitLoading}>
        Submit feedback
      </button>
    </div>
  )
}