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

@volenday/check-app-via-client-id-next

v2.0.8

Published

## ES Modules Version (v2.0.3) ✨

Readme

@volenday/check-app-via-client-id-next

ES Modules Version (v2.0.3) ✨

AHA Check app via client id for Next.js app - Now with ES Modules support!

This library has been completely converted to ES Modules to resolve compatibility errors with jquery-param and other modern dependencies.

🔧 Main Changes in v2.0.3

  • Converted to ES Modules - Resolves "require() of ES Module not supported" error
  • Native Node.js tests - Uses native test runner instead of Jest
  • Compatible with Node.js 14+ - Full ES Modules support
  • Better maintainability - Cleaner and more modular code
  • 47 tests passing - Complete functionality coverage

🐛 Resolved Issue

Original error:

Error: require() of ES Module /path/to/jquery-param.js not supported.
jquery-param.js is treated as an ES module file as it is a .js file whose nearest 
parent package.json contains "type": "module"

Solution: Complete package conversion to ES Modules with "type": "module" in package.json.

📦 Installation

npm install @volenday/check-app-via-client-id-next
# or
yarn add @volenday/check-app-via-client-id-next

🚀 Usage

Import as ES Module

import CheckAppViaClientIdNext from '@volenday/check-app-via-client-id-next';

// In your Next.js page
export const getServerSideProps = async (ctx) => {
  try {
    const response = await CheckAppViaClientIdNext({
      context: ctx,
      Module: 'abenaDataLookUp',
      Type: 'website',
      eu: true
    });
    
    // This fetches app information and gets the ahaPortal redirect
    console.log('CheckAppViaClientIdNext response:', response);
    
    if (response.redirect) return response;
    
    return { props: { error: null, ...response } };
  } catch (error) {
    console.log(error);
    return { props: { error: error.message } };
  }
};

With Redux Wrapper

import React from 'react';
import CheckAppViaClientIdNext from '@volenday/check-app-via-client-id-next';
import ErrorPage from 'next/error';
import { wrapper } from '../../redux/store';

const Index = error => (error ? <ErrorPage statusCode={404} /> : null);

export const getServerSideProps = wrapper.getServerSideProps(async ctx => {
  try {
    const response = await CheckAppViaClientIdNext({
      context: ctx,
      Module: 'abenaDataLookUp',
      Type: 'website',
      eu: true
    });
    
    if (response.redirect) return response;
    return { props: { error: null } };
  } catch (error) {
    console.log(error);
    return { props: { error: error.message } };
  }
});

export default Index;

🔑 Parameters

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | context | Object | required | Next.js context (req, res, query) | | Type | String | 'auth' | Type: 'auth', 'portal', 'website', 'callback', etc. | | environment | String | process.env.CUSTOM_ENV | Environment: 'local', 'development', 'sandbox', 'staging', 'preprod', 'production' | | eu | Boolean | false | Use Europe region | | logout | Boolean | false | Enable logout flow | | Module | String | '' | Specific module to use | | cidaas | Object | { authority: '', client_id: '' } | Cidaas configuration |

📊 Response

For Type: 'auth' or 'portal'

{
  application: Object,        // Application data
  appUrl: String,            // Application URL
  facebookPixel: Object,     // Facebook Pixel configuration
  googleAnalytics: Object,   // Google Analytics configuration
  ico: String,               // Icon URL
  portalAuthentication: Object, // Authentication configuration
  module: String,            // Module used
  title: String,             // Page title
  cidaas: Object            // Cidaas configuration
}

For other types (redirect)

{
  redirect: {
    permanent: false,
    destination: String      // Portal redirect URL
  }
}

🧪 Testing

This library uses the native Node.js test runner (available from Node.js 16+).

Requirements

  • Node.js 14+ (recommended 18+ or 22+)
  • For full ES Modules support, Node.js 18+ or 22+ is recommended

Running tests

# With Node.js 18+ or 22+ (recommended)
npm test

# If you have Node.js < 18, use nvm to change version:
nvm use 22
npm test

# For development with watch mode
npm run test:watch

# Validate that modules import correctly
npm run validate

Test Coverage

Tests cover:

  • ✅ ES modules validation (config.js, index.js)
  • ✅ Structure and data types
  • ✅ Region configuration (Asia/Europe)
  • ✅ Environment configuration
  • ✅ Title generation by origin
  • ✅ Authentication configuration
  • ✅ Cookie configuration
  • ✅ Redirect URL parsing
  • ✅ Cidaas configuration

Result: 47 tests passing

🔄 Migration from v1.x to v2.x

Required changes in your code:

Before (v1.x - CommonJS):

const checkApp = require('@volenday/check-app-via-client-id-next');

After (v2.x - ES Modules):

import checkApp from '@volenday/check-app-via-client-id-next';

Note: Next.js supports ES Modules natively, so you don't need to make additional configuration changes.

CommonJS dependencies imports

If you use this library and encounter issues with CommonJS dependencies (like lodash), the library already handles these cases internally:

// ✅ The library does this internally
import lodash from 'lodash';
const { keyBy } = lodash;

// ❌ Don't do this (doesn't work with CommonJS modules)
import { keyBy } from 'lodash';

🌍 Regions and Environments

Asia (default: eu: false)

  • Local: http://localhost:3501/
  • Development: https://dev.api.ahamatic.com/
  • Sandbox/Staging: https://test.api.ahamatic.com/
  • Preprod: https://preprod-api-eu.ahamatic.com/
  • Production: https://api.ahamatic.com/

Europe (eu: true)

  • Local: http://localhost:3501/
  • Development: https://dev.api.ahamatic.com/
  • Sandbox/Staging: https://test.api.ahamatic.com/
  • Preprod: https://preprod-api-eu.ahamatic.com/
  • Production: https://api-eu.ahamatic.com/

📝 Usage Examples

Basic authentication

export async function getServerSideProps(context) {
  return await CheckAppViaClientIdNext({
    context,
    Type: 'auth'
  });
}

With specific module

export async function getServerSideProps(context) {
  return await CheckAppViaClientIdNext({
    context,
    Type: 'auth',
    Module: 'admin'
  });
}

Logout

export async function getServerSideProps(context) {
  return await CheckAppViaClientIdNext({
    context,
    Type: 'auth',
    logout: true
  });
}

With Europe region and production

export async function getServerSideProps(context) {
  return await CheckAppViaClientIdNext({
    context,
    Type: 'website',
    eu: true,
    environment: 'production'
  });
}

With Cidaas

export async function getServerSideProps(context) {
  return await CheckAppViaClientIdNext({
    context,
    Type: 'auth',
    cidaas: {
      authority: 'https://your-cidaas-domain.com',
      client_id: 'your-client-id'
    }
  });
}

🔒 Managed Cookies

The library automatically manages the following cookies:

| Cookie | Description | |--------|-------------| | token | Ahamatic authentication token | | refreshToken | Ahamatic refresh token | | openiamtoken | OpenIAM token | | openiamrefreshtoken | OpenIAM refresh token | | redirectUrl | Redirect URL | | originUrl | Origin URL | | logOutUrl | Logout URL | | portalUrl | Portal URL |

Cookie configuration: { httpOnly: false, sameSite: 'lax' }

🛠️ Development

Clone and setup

git clone <repo-url>
cd check-app-via-client-id-next
npm install

Run tests

# Make sure to use Node.js 18+ or 22+
nvm use 22  # or nvm use 18

# Run tests
npm test

# Validate imports
npm run validate

Project structure

check-app-via-client-id-next/
├── config.js           # URLs and environments configuration
├── index.js            # Main function
├── tests/
│   ├── config.test.js  # Configuration tests
│   ├── index.test.js   # Functionality tests
│   └── integration.test.js  # Integration tests
├── validate.js         # Import validation script
├── package.json
└── README.md

⚙️ System Requirements

  • Node.js: >= 14.0.0 (recommended 18+ or 22+)
  • Next.js: Compatible with all modern versions
  • npm/yarn: Any recent version

📄 License

MIT

👥 Author

Volenday [email protected]


🆘 Support

If you encounter any issues or have questions:

  1. Verify you're using Node.js 14+
  2. Make sure to import with import and not with require()
  3. Review the usage examples in this README
  4. Run npm run validate to verify modules import correctly

🎉 Thank you for using this library!