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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ikas/popup-script-injector

v1.0.0-alpha.18

Published

Standalone popup widget renderer for ikas storefront popups.

Readme

@ikas/popup-widget

Standalone popup widget renderer extracted from the storefront codebase. It can be consumed as a plain <script> bundle or as a React component inside Next/React applications.

Building

# install workspace dependencies first (from repo root)
npm install

# then build the widget bundle
npm run build --workspace @ikas/popup-widget

The build command produces three artefacts under dist/:

  • popup-widget.es.js
  • popup-widget.cjs.js
  • popup-widget.iife.js – automatically calls startIkasPopupWidget() after loading and registers a global IkasPopupWidget namespace.

Source maps are emitted for all formats.

Configuration Shape

The widget expects its configuration under window.ikasPopupConfig. The runtime type is exported as PopupWidgetConfig:

import type { PopupWidgetConfig } from "@ikas/popup-widget";

const exampleConfig: PopupWidgetConfig = {
  popups: [], // fill with IkasStorefrontPopup objects returned by your API
  sessionId: "session-123",
  locale: "en",
  countryCode: "US",
  merchantId: "merchant-id",
  cdnUrl: "https://cdn.myikas.dev/",
  storeUrl: "https://demo.myikas.dev",
  customerToken: undefined,
  priceListId: "price-list-id",
  salesChannelId: "sales-channel-id",
  customer: {
    email: "[email protected]",
    firstName: "Jane",
    lastName: "Doe",
  },
  services: {
    searchProducts: async () => [],
    addItemToCart: async () => ({ success: true }),
    saveCustomerFormData: async () => {},
    getLastViewedProducts: async () => [],
    formatVariantSellPrice: () => "₺0,00",
    formatVariantDiscountPrice: () => null,
    hasVariantDiscount: () => false,
    getVariantDiscountPercentage: () => null,
  },
};

Populate all relevant fields before loading the script.

Browser Usage (no framework)

  1. Populate window.ikasPopupConfig before loading the bundle:

    import type { PopupWidgetConfig } from "@ikas/popup-widget";
    
    const ikasPopupConfig: PopupWidgetConfig = {
      popups: [], // fill with IkasStorefrontPopup objects
      sessionId: "session-123", // used for localStorage tracking
      locale: "en",
      countryCode: "US",
      merchantId: "merchant-id",
      cdnUrl: "https://cdn.myikas.dev/",
      storeUrl: "https://demo.myikas.dev",
      customerToken: undefined, // optional
      priceListId: "price-list-id",
      salesChannelId: "sales-channel-id",
      services: {
        searchProducts: async (params) => {
          console.log("search products", params);
          return [];
        },
        addItemToCart: async ({ product, variant }) => {
          console.log("add to cart", product, variant);
          return { success: true };
        },
        saveCustomerFormData: async (payload) => {
          console.log("save customer", payload);
        },
        getLastViewedProducts: async () => {
          return [];
        },
        formatVariantSellPrice: () => "₺0,00",
        formatVariantDiscountPrice: () => null,
        hasVariantDiscount: () => false,
        getVariantDiscountPercentage: () => null,
      },
    };
    
    window.ikasPopupConfig = ikasPopupConfig;
    <link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"
    />
    <script src="./dist/popup-widget.iife.js" defer></script>
  2. Provide the service implementations so the widget can delegate cart operations, customer form submissions and dynamic product fetching back to your storefront.

  3. The IIFE build bootstraps itself once the script executes. When using the ES/CJS bundles you can call startIkasPopupWidget() manually:

    import { startIkasPopupWidget } from "@ikas/popup-widget";
    
    startIkasPopupWidget(window.ikasPopupConfig);

React / Next Usage

import dynamic from "next/dynamic";

const PopupListRendererForPage = dynamic(() =>
  import("@ikas/popup-widget").then((mod) => mod.PopupListRendererForPage),
  { ssr: false }
);

// … inside component tree
<PopupListRendererForPage />;

The startIkasPopupWidget helper can also be called from React apps if you want an imperative bootstrap (e.g. outside of the main React tree).

Known Gaps / TODO

  • Type declaration emission is not wired (no dist/*.d.ts). We should add a tsc build step or rollup-plugin-dts before publishing.
  • You must provide window.ikasPopupConfig.popups. No automatic fetch from the storefront API is performed.

These items are tracked as follow-up tasks before we deprecate the original packages/storefront/src/components/popup implementation.