Socket
Book a DemoInstallSign in
Socket

@ehrocks/react-native-swag-ui-patterns

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@ehrocks/react-native-swag-ui-patterns

Utilities for communication between mini apps or mini app and core EH app

0.0.1-alpha.0
unpublished
latest
npmnpm
Version published
Maintainers
3
Created
Source

@ehrocks/react-native-superapp-communication

Utilities for communication between mini apps or mini app and core EH app

Installation

Open a Terminal in your project's folder and run,

yarn add @ehrocks/react-native-superapp-communication

Usage

  • Identity
  • Notification
  • DeepLink

Identity

User login event

import { Identity } from '@ehrocks/react-native-superapp-communication';

// Listen to login event
const removeLoginListener = Identity.addLoginListener((token) => {
  console.log({ token });
});

// Dispatch login event
Identity.dispatchLoginEvent('token');

// Remove login listener
removeLoginListener();

Token changed event

import { Identity } from '@ehrocks/react-native-superapp-communication';

// Listen to token changed event
const removeTokenChangedListener = Identity.addTokenChangedListener((token) => {
  console.log({ token });
});

// Dispatch token changed event
Identity.dispatchTokenChangedEvent('token');

// Remove the listener
removeTokenChangedListener();

User logout event

import { Identity } from '@ehrocks/react-native-superapp-communication';

// Listen to logout event
const removeLogoutListener = Identity.addLogoutListener(() => {
  console.log('Receive Logout event');
});

// Dispatch logout event
Identity.dispatchLogoutEvent({});

// Remove logout listener
removeLogoutListener();

Notification

Open event

import { NotificationEvent } from '@ehrocks/react-native-superapp-communication';

// Listen to open notification event
const removeOpenNotificationListener = NotificationEvent.addOpenNotificationListener((payload) => {
  console.log(payload);
});

// Dispatch open notification event
const payload = {
  type: 'notification_type',
  organisation_id: '1234',
  meta: {
    appName: 'swagApp'
  }
}
NotificationEvent.dispatchOpenNotificationEvent(payload);

// Remove open notification listener
removeOpenNotificationListener()

Open event

import { DeepLinkEvent  } from '@ehrocks/react-native-superapp-communication';

// Listen to open deep link event
const removeOpenDeelinkListener = DeepLinkEvent.addOpenDeepLinkListener((payload) => {
  console.log(payload);
});

// Dispatch open deep link event
const payload = {
  url: 'employmenthero://test',
}
DeepLinkEvent.dispatchOpenDeepLinkEvent(payload);

// Remove open deeplink listener
removeOpenDeeplinkListener();

FAQs

Package last updated on 17 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.