Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/v3/src/core/base-embed.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default class BaseEmbed {
#allowed = 'camera;geolocation;fullscreen;gyroscope;accelerometer;magnetometer';
#defaultAllowed = 'camera;geolocation;fullscreen;gyroscope;accelerometer;magnetometer';

#defaultStyles = 'width: 100%; height: 100%;';

Expand Down Expand Up @@ -28,7 +28,7 @@ export default class BaseEmbed {
this.iframe = document.createElement('iframe');
this.iframe.setAttribute('src', this.source);
this.iframe.setAttribute('style', this.#defaultStyles);
this.iframe.setAttribute('allow', this.#allowed);
this.iframe.setAttribute('allow', this.allowed);

window.addEventListener('message', this.boundEventHandler);

Expand Down Expand Up @@ -57,4 +57,8 @@ export default class BaseEmbed {
get source() {
return `${this.endpoint}${this.path}${this.params}`;
}

get allowed() {
return this.#defaultAllowed;
}
}
6 changes: 6 additions & 0 deletions packages/v3/src/signature/embedded.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ describe('Clicksign Embedded', () => {
expect(iframeElement).toHaveProperty('src', signatureUrl);
});

it('should keep default iframe allow permissions', () => {
const iframeElement = document.getElementById(containerElementId).children[0];

expect(iframeElement.getAttribute('allow')).toBe('camera;geolocation;fullscreen;gyroscope;accelerometer;magnetometer');
});

it('should unmount widget on the specified element', () => {
const containerElement = document.getElementById(containerElementId);

Expand Down
4 changes: 4 additions & 0 deletions packages/v3/src/verify/embedded.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
this.custom = options.custom || null;
}

get allowed() {

Check failure on line 10 in packages/v3/src/verify/embedded.js

View workflow job for this annotation

GitHub Actions / Run Linter Package v3

Expected 'this' to be used by class getter 'allowed'
return 'camera;geolocation;fullscreen;gyroscope;accelerometer;magnetometer;encrypted-media';
}

start(id) {
return this.mount(id);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/v3/src/verify/embedded.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('Verify', () => {

const iframeElement = document.getElementById(containerElementId).children[0];

expect(iframeElement.getAttribute('allow')).toBe('camera;geolocation;fullscreen;gyroscope;accelerometer;magnetometer');
expect(iframeElement.getAttribute('allow')).toBe('camera;geolocation;fullscreen;gyroscope;accelerometer;magnetometer;encrypted-media');
});

it('should set style iframe attribute with width and height 100%', () => {
Expand Down
Loading