Skip to content

Elfsquad/showroom-iframe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

27 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏰 Elfsquad showroom iframe

πŸ›  Installation

npm install --save @elfsquad/showroom-iframe
<script type="importmap>
{
  "imports": {
    "@elfsquad/showroom-iframe": "https://cdn.skypack.dev/@elfsquad/[email protected]"
  }
}
</script>

πŸ–₯️ Usage

This package exposes the ElfsquadShowroom class. This class can be used for creating & communicating with the iframe.

Example:

import { ElfsquadShowroom } from "@elfsquad/showroom-iframe";
const container = document.createElement("div");
document.body.appendChild(container);

const elfsquad = new ElfsquadShowroom({
  container: container,
  url: "https://automotive.elfsquad.io/configure/Elfsquad%20carrosserie"
});

πŸ“Έ Trigger a screenshot

elfsquad.screenshot();

πŸ”„ Reset the camera position

elfsquad.home()

πŸ”³ Toggle the footprint visibility

elfsquad.toggleFootprint();

🧭 Navigate to a page within the showroom

elfsquad.navigateTo('relativeUrl');

πŸ“£ Handle screenshot event

import { ScreenshotCallback } from "@elfsquad/showroom-iframe";
const callback: ScreenshotCallback = ({image}) => {
    console.log('image: ', image);
}
elfsquad.onScreenshot(callback);

πŸ“ Handle quotation request event

import { RequestQuoteCallback } from "@elfsquad/showroom-iframe";
const callback: RequestQuoteCallback = ({configurationId}) => {
    console.log('configurationId: ', configurationId);
}
elfsquad.onRequestQuote(callback);

🀝 Contributing

We welcome contributions! Please feel free to fork the repository, make your changes, and submit a pull request.

βš–οΈ License

Licensed under MIT. See the LICENSE file in the repository for full details.

πŸŽ‰ Acknowledgements

A big thank you to everyone who contributes to the ongoing development and maintenance of this package.