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 🙏

© 2024 – Pkg Stats / Ryan Hefner

shas-app-controller

v1.2.3

Published

This npm module is the SH Authentication System, designed for managing applications and retrieving data registered on the official website. The module supports fetching application data from the official website, as well as remotely activating, deactivati

Downloads

26

Readme

SH Authentication System App Controller

This npm module is the nextjs app controller, designed for managing applications and retrieving data registered on the official website. The module supports fetching application data from the official website, as well as remotely activating, deactivating, and displaying alert toast messages without the need for rebuilding or modifying the source code.

Installation


npm i --save-dev shas-app-controller

Usage

1. Register application to SH Authentication System application page.

Copy the app id and app secret that is provided into application details page.

2. Creating a Configuration File

Create a shas.config.ts file in the root directory:


import SHAS from "shas-app-controller";

// pass app id and secret provided from our website

const { ContentWrapper, appData, brandData } = await SHAS({

  appId: process.env.SHAS_APP_ID as string,
  appSecret: process.env.SHAS_APP_SECRET as string,

  // ---------- Optional ----------

  // 1. If you wish to modify the Node Fetch caching properties, the default value is set to 'default'.

  cache: "no-cache", // Suggested for quickly updating data from the SH Authentication System server.

  // 2. Toast reminder: By default, it will reappear every 24 hours.

  toastReminder: 86400, // In seconds

  /* 3. Image Optimization: If you wishes to use NextJS image optimization in your error, disabled pages. By default it will use HTML img.

  Note: If you use image optimization you have to include this object in your next config image section.

  {
    protocol: 'https',
    hostname: 'storage.googleapis.com',
    port: '',
    pathname: '/**',
  },
  
  */

  imageOptimaization: false, // Boolean

});

export { ContentWrapper, appData, brandData };

Note: If you have saved environment variables in this format you don't need to manually pass it.


SHAS_APP_ID=
SHAS_APP_SECRET=

3. Using the ContentWrapper in Layout

In your layout.tsx, wrap the children with ContentWrapper:


"use server";
//...other imports
import { ContentWrapper } from "@/shas.config";

...

export  default  async  function  RootLayout({ children }:  Readonly<{ children:  React.ReactNode; }>) {
  return (
    <html  lang="en">
	  <body>
		<ContentWrapper>
		  {children}
		</ContentWrapper>
	  </body>
	</html>
  );
};

4. Accessing appData and brandData

You can now access appData and brandData in any of your project files:


import { appData, brandData } from "@/shas.config";

  
// Do something with the data

console.log(appData);

5. Accessing from client side

Make sure you have initialized SHAS in the shas.config file.


import { getAppData, getBrandData } from "shas-app-controller/client";


const { appData, status } = getAppData();

const { brandData, status } = getBrandData();

// Status can be "loading", "success", "error"

Features

  • Remotely activate and deactivate your application with an eye-catching status page
  • Remotely show alert toasts with actions in your application
  • If you want to use CloudBurst Lab id as a OAuth 2.0 provider into your application. Use next-auth-provider-cloudburst-lab

Requirements

  • Minimum version of Nextjs 13 to use server actions.

Author

Shawkat Hossain Maruf Contact: [email protected]

Version

Current version: 1.0.0

Please use latest version to prevent bugs and errors!

A product of CloudBurst Lab