Skip to content

Commit 1afd438

Browse files
committed
fix, refactor index file
1 parent f45889d commit 1afd438

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

packages/core/src/index.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,15 @@ import { createIframe } from "./elements/iframe";
33
import { verificationUrl } from "./helpers/defaultConfig";
44
import { loadingDiv } from "./helpers/elements";
55
import { OrbaOneConfig } from "./helpers/types";
6-
import { loader } from "./styles/templates";
6+
import { iframeLoader } from "./styles/templates";
77
import { getSessionUrl, isValidConfig } from "./helpers/utils";
88

99
function initializeVerification(config: OrbaOneConfig, button: ReturnType<typeof createButton>): void {
1010
const { apiKey, applicantId, onSuccess, onCancelled, onError, steps } = config;
1111

1212
//Set Loading state
1313
button.setState("loading");
14-
loadingDiv.innerHTML = `
15-
<div
16-
style="
17-
position:absolute;
18-
top:0;
19-
bottom:0;
20-
left:0;
21-
right:0;
22-
display:flex;
23-
align-items:center;
24-
justify-content:center;
25-
background-color: rgba(255, 255, 255, 0.8);
26-
">
27-
${loader}
28-
</div>
29-
`;
14+
loadingDiv.innerHTML = iframeLoader;
3015

3116
document.body.appendChild(loadingDiv);
3217
const url = getSessionUrl(verificationUrl, apiKey, applicantId, steps);

packages/core/src/styles/templates.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,20 @@ export const loader = `
119119
</rect>
120120
</svg>
121121
`;
122+
123+
export const iframeLoader = `
124+
<div
125+
style="
126+
position:absolute;
127+
top:0;
128+
bottom:0;
129+
left:0;
130+
right:0;
131+
display:flex;
132+
align-items:center;
133+
justify-content:center;
134+
background-color: rgba(255, 255, 255, 0.8);
135+
">
136+
${loader}
137+
</div>
138+
`;

0 commit comments

Comments
 (0)