Skip to content

Commit

Permalink
refactor: extract totp-consent to components package
Browse files Browse the repository at this point in the history
  • Loading branch information
tams sokari committed Nov 26, 2023
1 parent ff50661 commit 7622f69
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 14 deletions.
5 changes: 4 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@
"exports": {
".": "./index.js",
"./combobox": "./combobox/src/index.js",
"./end-user-consent": "./end-user-consent/src/index.js"
"./end-user-consent": "./end-user-consent/src/index.js",
"./totp-consent": "./totp-consent/src/index.js"
},
"description": "A collection of Web Components used by SmileID",
"keywords": [ "Web Components" ],
"author": "SmileID <[email protected]> (https://usesmileid.com)"
"keywords": [
"Web Components"
],
"author": "SmileID <[email protected]> (https://usesmileid.com)",
"dependencies": {
"validate.js": "^0.13.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ function markup() {
`;
}

class TotpBasedConsent extends HTMLElement {
class TotpConsent extends HTMLElement {
constructor() {
super();

Expand Down Expand Up @@ -923,4 +923,10 @@ class TotpBasedConsent extends HTMLElement {
}
}

export default TotpBasedConsent;
if ("customElements" in window) {
window.customElements.define('totp-consent', TotpConsent);
}

export {
TotpConsent,
};
3 changes: 3 additions & 0 deletions packages/components/totp-consent/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export {
TotpConsent
} from './TotpConsent';
4 changes: 1 addition & 3 deletions packages/embed/src/js/basic-kyc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import validate from "validate.js";
import "@smileid/components/combobox";
import "@smileid/components/end-user-consent";
import TotpBasedConsent from "./components/TotpConsentApp";
import "@smileid/components/totp-consent";
import { version as sdkVersion } from "../../package.json";

(function basicKyc() {
Expand All @@ -19,8 +19,6 @@ import { version as sdkVersion } from "../../package.json";
const referenceWindow = window.parent;
referenceWindow.postMessage("SmileIdentity::ChildPageReady", "*");

window.customElements.define("totp-consent-app", TotpBasedConsent);

const pages = [];
let activeScreen;
let config;
Expand Down
4 changes: 1 addition & 3 deletions packages/embed/src/js/biometric-kyc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import JSZip from "jszip";
import validate from "validate.js";
import "@smile_identity/smart-camera-web";
import "@smileid/components/end-user-consent";
import TotpBasedConsent from "./components/TotpConsentApp";
import "@smileid/components/totp-consent";
import { version as sdkVersion } from "../../package.json";

(function biometricKyc() {
Expand All @@ -20,8 +20,6 @@ import { version as sdkVersion } from "../../package.json";
const referenceWindow = window.parent;
referenceWindow.postMessage("SmileIdentity::ChildPageReady", "*");

window.customElements.define("totp-consent-app", TotpBasedConsent);

const pages = [];
let activeScreen;
let config;
Expand Down
3 changes: 1 addition & 2 deletions packages/embed/src/js/ekyc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import validate from "validate.js";
import "@smileid/components/combobox";
import "@smileid/components/end-user-consent";
import TotpBasedConsent from "./components/TotpConsentApp";
import "@smileid/components/totp-consent";
import { version as sdkVersion } from "../../package.json";

(function eKYC() {
Expand All @@ -18,7 +18,6 @@ import { version as sdkVersion } from "../../package.json";

const referenceWindow = window.parent;
referenceWindow.postMessage("SmileIdentity::ChildPageReady", "*");
window.customElements.define("totp-consent-app", TotpBasedConsent);

const pages = [];
let activeScreen;
Expand Down

0 comments on commit 7622f69

Please sign in to comment.