0.1.18 • Published 8 months ago
@aplazame/browser v0.1.18
browser-sdk
npm i @aplazame/browser
import { AplazameIFrame } from '@aplazame/browser'
const apzIframe = new AplazameIFrame({
url: 'https://checkout.aplazame.com',
searchParams: {
order: 'checkout_id',
public_key: 'merchant_public_key',
},
})
.on('close', ({ details: { status, statusReason } }) => {
console.log('checkout has being closed with:', {
status,
statusReason,
})
apzIframe.unmount()
})
.mount(document.querySelector('#iframe_container'))
AplazameIFrame object
constructor
const apzIframe = new AplazameIFrame({
url,
searchParams,
})
methods
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
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',
},
}
0.1.18
8 months ago
0.1.12
11 months ago
0.1.13
11 months ago
0.1.14
11 months ago
0.1.15
11 months ago
0.1.16
11 months ago
0.1.17
11 months ago
0.1.11
1 year ago
0.1.10
1 year ago
0.1.8
1 year ago
0.1.9
1 year ago
0.1.0
2 years ago
0.1.2
2 years ago
0.1.1
2 years ago
0.1.7
2 years ago
0.1.4
2 years ago
0.1.3
2 years ago
0.1.5
2 years ago
0.0.10
2 years ago
0.0.9
2 years ago
0.0.8
2 years ago
0.0.7
2 years ago
0.0.6
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago