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

@celcomdigi/miniapp-sdk

v1.0.5

Published

Celcom Digi Super App SDK

Downloads

9

Readme

SDK

This is an SDK that is available in the Celcomdigi Super App. It can be imported and used by Mini App developers to provide a seamless experience for the users.

Public Interface

SDK exposes a set of React hooks and components that can be used by Mini App developers. These helpers are nothing more but a tiny wrapper on top of useContext to make experience working with the SDK nicer for end developers.

The actual context is provided by the SDK Runtime, which is further explained in the next section.

There are three APIs available out of the box, in the POC:

  • permissions: managing and requesting permissions by mini apps to read sensitive data
  • user: user module that demonstrates use of permissions, together with reading the data
  • payments: user module that initiates the payment flow

You can learn more about them here.

The SDK also comes with a UI components that can be used by mini apps to provide a seamless experience for the users. You can learn more about them here.

SDK Runtime

SDK requires runtime to be provided by the host app. It is a set of functions that SDK expects to be available in the React context. These functions are used to retrieve data requested by the SDK, and perform actions accordingly.

![NOTE] In order to create sandbox environment that is safe from production, provide alterative version of the SDK runtime that does not rely on the actual data. Check the next section for more information on how to provide the runtime.

Example Implementation

Here is a step-by-step guide on how to implement a new API in the SDK, as well as to provide its runtime implementation inside the host app.

Step 1. Create a new SDK api

Navigate to api and create a dedicated file for your new API. For example, if you want to add payments capability, consider using payments.ts as a name.

Step 2. Define shape of the API

export type Permissions = {
  granted: (permission: string) => boolean
  request: (permission: string | string[]) => Promise<boolean>
  revoke: (permission: string) => void
}

Step 3. Create React Context

export const Permissions = createContext<Permissions>({
  granted: () => {
    throw new Error('PermissionContext not provided')
  },
  request: () => {
    throw new Error('PermissionContext not provided')
  },
  revoke: () => {
    throw new Error('PermissionContext not provided')
  },
})

Create and export a new React Context.

![NOTE] It is a good practice to provide default implementation and throw an Error. In that case, developers will get an early feedback that something is wrong, as actual context (as provided by the host) is missing in the React tree. Typically, this should never happen, provided all steps in this guide were completed.

Step 4. Provide a higher-order hook for developers

export const usePermissions = () => {
  return useContext(Permissions)
}

This step is optional, but we decided to abstract away this implementation detail as a part of the POC.

Step 5. Extend SDKRuntime with your new API

export function SDKRuntimeProvider({
  children,
  permissions,
  user,
}: PropsWithChildren<{ permissions: Permissions; user: User }>) {
  return (
    <Permissions.Provider value={permissions}>
      <User.Provider value={user}>{children}</User.Provider>
    </Permissions.Provider>
  )
}

Make sure to include your Provider component (in case of this example, it is Permissions.Provider) in the SDKRuntimeProvider. The SDKRuntimeProvider is rendered by the host, or any environment that is compatible with your mini apps (e.g. your sandbox, if you have one).

Step 6. Create actual implementation in the Host

Depending on your business requirements, implement Permissions module according to the interface defined earlier.

Step 7. Include your implementation in the SDKRuntimeProvider

 <SDKRuntimeProvider permissions={permissions} user={user}>
  {children}
</SDKRuntimeProvider>

If you have followed the guide, TypeScript will tell you right away that new API must be provided in the runtime. If you have implemented all the APIs correctly, there should be no errors and everything should work just fine.

Available modules

Permissions

  • Ask for permission
  • Check if permission is granted
  • Revoke permission

User

  • Login
  • Logout

Billing

  • Charge

Available components

  • Button
  • Heading
  • Container

FAQs

Why there is SDK (a separate package) and Runtime (defined in the host), instead of just a single package?

There are a few reasons for this decision decision:

Decoupling: By putting runtime in the host, there can be different versions of the runtime, depending on the host (e.g. production. sandbox). This makes it easy to open your codebase to the public (there can be a fake runtime that does not depend on any of your internal services and business logic), as well as perform tests in isolation.

Security: Mini-apps don't have access to actual code responsible for loading, managing sensitive data and interacting with your application. It is similar to a precompiled code, where headers (public interface) are readable, but actual implementation is a hidden detail. That split makes it much easier to control the communication and enforce that only approved actions can be performed.