- ${this.showNavigation ? `
-
-
-
-
- ` : ''}
-
-
- Next, we'll take a quick selfie
-
-
-
-
-
-
-
- Make sure you are in a well-lit environment where your face is
- clear and visible
-
-
-
-
-
-
-
-
- Hold your phone steady so the selfie is clear and sharp. Don't
- take blurry images.
-
-
-
-
-
-
-
-
- Remove anything that covers your face, such glasses, masks, hats
- and scarves
-
-
-
-
-
-
-
-
- ${this.hideAttribution ? '' : `
-
- `}
+
+
+ ${this.showNavigation ? `
+
+
+
+
+ ` : ''}
+
+
+ Next, we'll take a quick selfie
+
+
+
+
+
+
+
+ Make sure you are in a well-lit environment where your face is
+ clear and visible
+
+
+
+
+
+
+
+
+ Hold your phone steady so the selfie is clear and sharp. Don't
+ take blurry images.
+
+
+
+
+
+
+
+
+ Remove anything that covers your face, such glasses, masks, hats
+ and scarves
+
+
+
+
+
+
+
+
+ ${this.hideAttribution ? '' : `
+
+ `}
`;
}
class SelfieInstruction extends HTMLElement {
- constructor() {
- super();
- this.templateString = templateString.bind(this);
- this.render = () => {
- return this.templateString();
- };
-
- this.attachShadow({ mode: "open" });
- }
-
- connectedCallback() {
- this.pages = [];
- const template = document.createElement("template");
- template.innerHTML = this.render();
-
- this.shadowRoot.appendChild(template.content.cloneNode(true));
-
- this.allowButton = this.shadowRoot.querySelector("#allow");
- this.backButton = this.shadowRoot.querySelector("#back-button");
- const CloseIframeButtons =
- this.shadowRoot.querySelectorAll(".close-iframe");
-
- this.backButton && this.backButton.addEventListener("click", (e) => {
- this.handleBackEvents(e);
- });
-
- this.allowButton && this.allowButton.addEventListener("click", () => {
- this.dispatchEvent(new CustomEvent("SelfieInstruction::StartCamera"));
- });
-
-
- CloseIframeButtons.forEach((button) => {
- button.addEventListener(
- "click",
- () => {
- this.closeWindow();
- },
- false,
- );
- });
- }
-
- get hideBack() {
- return this.hasAttribute("hide-back-to-host");
- }
-
- get themeColor() {
- return this.getAttribute("theme-color") || "#043C93";
- }
-
- get hideAttribution() {
- return this.hasAttribute('hide-attribution');
- }
-
- handleBackEvents() {
- this.dispatchEvent(new CustomEvent("SmileIdentity::Exit"));
- }
-
- closeWindow() {
- const referenceWindow = window.parent;
- referenceWindow.postMessage("SmileIdentity::Close", "*");
- }
+ constructor() {
+ super();
+ this.templateString = templateString.bind(this);
+ this.render = () => this.templateString();
+
+ this.attachShadow({ mode: 'open' });
+ }
+
+ connectedCallback() {
+ this.pages = [];
+ const template = document.createElement('template');
+ template.innerHTML = this.render();
+
+ this.shadowRoot.appendChild(template.content.cloneNode(true));
+
+ this.allowButton = this.shadowRoot.querySelector('#allow');
+ this.backButton = this.shadowRoot.querySelector('#back-button');
+ const CloseIframeButtons = this.shadowRoot.querySelectorAll('.close-iframe');
+
+ if (this.backButton) {
+ this.backButton.addEventListener('click', (e) => {
+ this.handleBackEvents(e);
+ });
+ }
+ if (this.allowButton) {
+ this.allowButton.addEventListener('click', () => {
+ this.dispatchEvent(new CustomEvent('SelfieInstruction::StartCamera'));
+ });
+ }
+
+ CloseIframeButtons.forEach((button) => {
+ button.addEventListener(
+ 'click',
+ () => {
+ this.closeWindow();
+ },
+ false,
+ );
+ });
+ }
+
+ get hideBack() {
+ return this.hasAttribute('hide-back-to-host');
+ }
+
+ get themeColor() {
+ return this.getAttribute('theme-color') || '#043C93';
+ }
+
+ get hideAttribution() {
+ return this.hasAttribute('hide-attribution');
+ }
+
+ handleBackEvents() {
+ this.dispatchEvent(new CustomEvent('SmileIdentity::Exit'));
+ }
+
+ closeWindow() {
+ const referenceWindow = window.parent;
+ referenceWindow.postMessage('SmileIdentity::Close', '*');
+ }
}
-if ("customElements" in window) {
- window.customElements.define('selfie-instruction', SelfieInstruction);
+if ('customElements' in window) {
+ window.customElements.define('selfie-instruction', SelfieInstruction);
}
-export {
- SelfieInstruction
-};
+export default SelfieInstruction;
diff --git a/packages/components/selfie-capture/SelfieInstruction.stories.js b/packages/components/selfie-capture/SelfieInstruction.stories.js
index c19cdc09..c77e391d 100644
--- a/packages/components/selfie-capture/SelfieInstruction.stories.js
+++ b/packages/components/selfie-capture/SelfieInstruction.stories.js
@@ -1,17 +1,17 @@
-import "./SelfieInstruction";
+import './SelfieInstruction';
const meta = {
- component: "selfie-instruction",
+ component: 'selfie-instruction',
};
export default meta;
export const SelfieInstruction = {
- render: () => `
+ render: () => `
`,
-}
\ No newline at end of file
+};