Socket
Socket
Sign inDemoInstall

@mamba/app

Package Overview
Dependencies
Maintainers
5
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mamba/app - npm Package Compare versions

Comparing version 9.6.0 to 9.7.0

20

CHANGELOG.md

@@ -6,2 +6,22 @@ # Change Log

## [9.7.0](https://github.com/stone-payments/pos-mamba-sdk/compare/v9.6.0...v9.7.0) (2023-06-09)
### ⚠ BREAKING CHANGES
* 🧨 freeze keystroke changed
### Features
* 🎸 extend event data to add telemetryEmitType ([58e5cb5](https://github.com/stone-payments/pos-mamba-sdk/commit/58e5cb5e860eeac9e97a490790b292c07c41b1f2))
### Bug Fixes
* 🐛 add telemetry emit type to the keystroke ([b99d163](https://github.com/stone-payments/pos-mamba-sdk/commit/b99d163d58f03e9acebbe3cd536d3bc1a6432246))
* 🐛 send keyCode through synthetic mouse event ([4ee70ee](https://github.com/stone-payments/pos-mamba-sdk/commit/4ee70eec069a8c512f8b6c1336a16b4607432b7f))
* 🐛 several critial keystroke bugs along with configmation dialog events ([47c78a0](https://github.com/stone-payments/pos-mamba-sdk/commit/47c78a0393a5eaa85dadee46a0d4887da6a3965a))
## [9.6.0](https://github.com/stone-payments/pos-mamba-sdk/compare/v9.5.1...v9.6.0) (2023-06-09)

@@ -8,0 +28,0 @@

31

includes/EventDispatcher.js

@@ -1,2 +0,16 @@

export const dispatchEventOn = (shortcutEl) => {
/**
* @typedef {object} MambaKeyboardInterface
* @property {number} keyCode
* @property {'TOUCH' | 'KEYBOARD'} telemetryEmitType
*/
/**
* @typedef {MambaKeyboardInterface & MouseEvent} MambaKeyboardEvent
*/
/**
* @param {HTMLElement} shortcutEl
* @param {number} keyCode
*/
export const dispatchEventOn = (shortcutEl, keyCode) => {
/**

@@ -25,3 +39,18 @@ * Adapted from:

/**
* Indicates the telemetry event emit action was the type of KEYBOARD, to app consumes.
*/
event.telemetryEmitType = 'KEYBOARD';
try {
// Extends/hacks/fixes the propagation of physical keys to the emulated click
// We need to add multiples properties because the simulator/POS compatibility
event.code = keyCode;
event.keyCode = keyCode;
event.charCode = keyCode;
} catch (error) {
// Do nothing
}
shortcutEl.dispatchEvent(event);
};

@@ -22,3 +22,3 @@ import { KEYBOARD } from '@mamba/core';

export const hasKeystrokeToPrevent = () => {
export const hasKeystrokeToPrevent = (keyName) => {
/**

@@ -31,4 +31,21 @@ * Get the element with focus.

const hasTarget = activeElement !== window.document.body;
const notPrevent = hasTarget ? !(activeElement.dataset.freezeKeystrokes || false) : true;
return { notPrevent, handlerContext: hasTarget ? activeElement : document };
const handlerContext = hasTarget ? activeElement : document;
let prevent = false;
if (hasTarget) {
try {
const keystrokeToFreeze = JSON.parse(activeElement.dataset.freezeKeystrokes);
if (typeof keystrokeToFreeze === 'boolean') {
prevent = keystrokeToFreeze;
}
if (Array.isArray(keystrokeToFreeze) && keystrokeToFreeze.indexOf(keyName)) {
prevent = true;
}
} catch (e) {
// do nothing
}
}
return { prevent, handlerContext };
};

@@ -42,3 +59,3 @@

// handlerContext: Do not execute keystroke handlers for non global(window target) events
const { notPrevent } = hasKeystrokeToPrevent(e);
const { prevent } = hasKeystrokeToPrevent(keyName);

@@ -56,3 +73,6 @@ // Check if we have a editable input with focus

if (inputEventOnClose || (notPrevent && hasActiveHandlerFor(keyName) && !inputEventOnFocus)) {
if (
(isInputOnFocus && inputEventOnClose) ||
(!prevent && hasActiveHandlerFor(keyName) && !inputEventOnFocus)
) {
e.preventDefault();

@@ -63,2 +83,6 @@ e.stopImmediatePropagation();

if (e.type !== 'keydown') {
/**
* Indicates the telemetry event emit action was the type of KEYBOARD, to app consumes.
*/
e.telemetryEmitType = 'KEYBOARD';
handlers(e);

@@ -65,0 +89,0 @@ }

16

package.json
{
"name": "@mamba/app",
"version": "9.6.0",
"version": "9.7.0",
"svelte": "App.html",

@@ -14,10 +14,10 @@ "author": "Stone Payments - Mamba Team",

},
"gitHead": "6c7650728443258b4d454de4aa1e5f92c3ab5fef",
"gitHead": "8e792735bdd6b7a0677eb1a2f68734c8a4608f07",
"dependencies": {
"@mamba/button": "^9.6.0",
"@mamba/core": "^9.6.0",
"@mamba/keyboard": "^9.6.0",
"@mamba/pos": "^9.6.0",
"@mamba/styles": "^9.6.0",
"@mamba/utils": "^9.6.0",
"@mamba/button": "^9.7.0",
"@mamba/core": "^9.7.0",
"@mamba/keyboard": "^9.7.0",
"@mamba/pos": "^9.7.0",
"@mamba/styles": "^9.7.0",
"@mamba/utils": "^9.7.0",
"lodash": "^4.17.21"

@@ -24,0 +24,0 @@ },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc