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

@sumit_yewale/adapter-core

v0.0.1

Published

Shared core logic for csvbox framework adapters

Readme

@csvbox/adapter

Shared core logic for csvbox's framework adapters — the embed protocol every framework wrapper (React, Vue 2, Vue 3, Angular) delegates to instead of duplicating it: import-URL construction, the postMessage init/event protocol, modal open/close lifecycle, and event metadata parsing.

Plain JS, no build step, no type ceremony — one file (index.js), small functions, read top to bottom. Type declarations live alongside it in index.d.ts.

Contents

  • index.js — the module. Every exported function below lives here.
  • index.d.ts — TypeScript declarations for the same exports.
  • package.json — name @csvbox/adapter, main/types pointing at the two files above.

API

  • DEFAULT_DOMAIN"app.csvbox.io", the default embed host.
  • HOLDER_STYLE / IFRAME_STYLE — the holder/iframe CSS values for the full-viewport fixed overlay (z-index: 2147483647, etc.), as plain JS style objects.
  • buildImportUrl(config, framework, libraryVersion) — builds the embed URL: domain (with optional customDomain/dataLocation prefixing), library-version, framework, preventRedirect, language, theme, env query params.
  • generateUuid() — generates the per-instance correlation token used to match incoming postMessage events to the right button instance.
  • buildInitPayload(user, dynamicColumns, options, uniqueToken) — builds the { customer, columns, options, unique_token } object posted into the iframe once it loads.
  • createModalLifecycle() — returns { markReady(), requestOpen(), markClosed() }, a small state machine for the deferred-open behavior: if openModal() is requested before the iframe has finished loading, it's queued and fired once markReady() is called from the iframe's onload. DOM creation and the actual postMessage/display-toggle calls are the caller's responsibility — this only tracks state.
  • classifyStructuredMessage(data, expectedToken) — classifies an incoming structured { type, data } message, gated on data.data.unique_token === expectedToken. Returns null if unrecognized or the token doesn't match, otherwise { type, metadata?, success? } for one of: data-on-submit, data-push-status, csvbox-modal-hidden, csvbox-upload-successful, csvbox-upload-failed.
  • classifyLegacyMessage(data) — classifies a legacy bare-string message ('mainModalHidden', 'uploadSuccessful', 'uploadFailed'), sent/accepted with no token check. Kept separate from the structured classifier since not every consumer speaks this protocol.
  • parseSubmitMetadata(eventData) — parses data-on-submit metadata.
  • parseImportMetadata(eventData) — parses data-push-status success metadata, including reconstructing per-row objects from the importer's column-index arrays + headers (_dynamic_data / _virtual_data / _unmapped_data), with dropdown-label remapping (dropdown_display_labels_mappings) when present. data-push-status failure isn't parsed at all — pass data.data straight through.

Modal lifecycle behavior: reset-on-close

createModalLifecycle()'s markClosed() resets all internal state (isModalShown, isIframeLoaded, shouldOpenOnReady) back to pristine, not just the "shown" flag. Callers are expected to pair this with actually destroying the iframe/holder DOM and nulling the reference on close, so that the next openModal() call — gated on !iframe, unconditionally, not just under a lazy flag — creates a completely fresh iframe: fresh embed URL load, fresh generateUuid() token.

This means every reopen does a full iframe reload rather than an instant visibility toggle. That's deliberate: the hosted importer app doesn't re-run whatever validation produced its first-load state (e.g. an invalid-license error) when it's simply re-shown via a stale, already-loaded session — only a genuinely fresh load forces it through that path again. Verified with a standalone HTML file, no framework or adapter code involved at all, that this is the importer's own behavior, not something any adapter package causes or can intercept (it happens inside a cross-origin iframe).

If you're wiring a new consumer against this module: call markReady() from the iframe's onload, call requestOpen() whenever you want to open (showing the modal only if it returns true), and call markClosed() plus destroy the iframe/holder whenever a close signal comes in — mainModalHidden / csvbox-modal-hidden via the classifiers above.