Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aplazame/browser

Package Overview
Dependencies
Maintainers
5
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aplazame/browser - npm Package Compare versions

Comparing version 0.1.10 to 0.1.11

dist/PostMessageHandler.d.ts

4

dist/AplazameIFrame.d.ts

@@ -10,2 +10,3 @@ import { EventEmitter, DetailsEvent } from './EventEmitter.js';

requestTimeout: number;
iframeStylesPresets: any;
url: URL;

@@ -34,2 +35,5 @@ mount_el?: HTMLElement;

mount(el: HTMLElement): this;
addStylesPreset(name: string, styles: {
[key: string]: string;
}): this;
setStyles(styles: string | {

@@ -36,0 +40,0 @@ [key: string]: string;

9

dist/AplazameIFrame.js

@@ -18,3 +18,3 @@ "use strict";

exports.AplazameEvent = AplazameEvent;
const iframeStylesPresets = {
const defaulsIframeStylesPresets = {
fill_fixed: {

@@ -43,2 +43,3 @@ position: 'fixed',

this.requestTimeout = 60000;
this.iframeStylesPresets = copyObject(defaulsIframeStylesPresets);
this.currentStyles = {};

@@ -102,6 +103,10 @@ if (!url)

}
addStylesPreset(name, styles) {
this.iframeStylesPresets[name] = styles;
return this;
}
setStyles(styles) {
var _a;
const newSytles = typeof styles === 'string'
? ((_a = iframeStylesPresets[styles]) !== null && _a !== void 0 ? _a : {})
? ((_a = this.iframeStylesPresets[styles]) !== null && _a !== void 0 ? _a : {})
: styles;

@@ -108,0 +113,0 @@ this.currentStyles = Object.assign(Object.assign({}, this.currentStyles), newSytles);

import { EventEmitter, DetailsEvent } from './EventEmitter';
import { AplazameIFrame } from './AplazameIFrame';
export { DetailsEvent, EventEmitter, AplazameIFrame, };
import { PostMessageHandler } from './PostMessageHandler';
export { DetailsEvent, EventEmitter, AplazameIFrame, PostMessageHandler, };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AplazameIFrame = exports.EventEmitter = exports.DetailsEvent = void 0;
exports.PostMessageHandler = exports.AplazameIFrame = exports.EventEmitter = exports.DetailsEvent = void 0;
const EventEmitter_1 = require("./EventEmitter");

@@ -9,1 +9,3 @@ Object.defineProperty(exports, "EventEmitter", { enumerable: true, get: function () { return EventEmitter_1.EventEmitter; } });

Object.defineProperty(exports, "AplazameIFrame", { enumerable: true, get: function () { return AplazameIFrame_1.AplazameIFrame; } });
const PostMessageHandler_1 = require("./PostMessageHandler");
Object.defineProperty(exports, "PostMessageHandler", { enumerable: true, get: function () { return PostMessageHandler_1.PostMessageHandler; } });
{
"name": "@aplazame/browser",
"version": "0.1.10",
"version": "0.1.11",
"description": "Aplazame SDK for browser",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -29,2 +29,63 @@ # browser-sdk

}
```
### AplazameIFrame object
> constructor
``` js
const apzIframe = new AplazameIFrame({
url,
searchParams,
})
```
> methods
``` ts
apzIframe.send(event: string, payload: unknown)
// received by the iframe as MessageEvent<{ data: { event, payload } }>
apzIframe.request(request: string, payload: unknown)
// received by the iframe as MessageEvent<{ data: { request, payload } }>
apzIframe.mount(el: HTMLElement)
// iframe is created and attached to el when calling this method
apzIframe.setStyles(styles: string | { [key: string]: string })
// applies styles to iframe DOM Element
// when styles is a string, it refers to a preset
// otherwise applies styles key by key
apzIframe.addStylesPreset(name: string, styles: { [key: string]: string })
// Adds a new preset to presets
apzIframe.resetStyles()
// clears all styles applied to the iframe
apzIframe.unmount()
// removes iframe from DOM tree and emits 'unmount' event
```
> default styles presets
``` js
const defaulsIframeStylesPresets: {
fill_fixed: {
position: 'fixed',
top: '0',
left: '0',
width: '100%',
height: '100%',
border: 'none',
},
fill_absolute: {
position: 'absolute',
top: '0',
left: '0',
width: '100%',
height: '100%',
border: 'none',
},
}
```
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