@smileid/web-components 10.0.6 → 11.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -15
- package/dist/README.md +15 -0
- package/dist/components/README.md +14 -0
- package/dist/components/document/src/README.md +111 -0
- package/dist/components/document/src/document-capture/README.md +90 -0
- package/dist/components/document/src/document-capture-instructions/README.md +56 -0
- package/dist/components/document/src/document-capture-review/README.md +79 -0
- package/dist/components/selfie/README.md +225 -0
- package/dist/components/smart-camera-web/src/README.md +207 -0
- package/dist/domain/camera/src/README.md +38 -0
- package/dist/domain/file-upload/README.md +35 -0
- package/dist/esm/{DocumentCaptureScreens-BjATTDqu.js → DocumentCaptureScreens-DmH2JZDA.js} +3 -3
- package/dist/esm/DocumentCaptureScreens-DmH2JZDA.js.map +1 -0
- package/dist/esm/EndUserConsent-D4fd1ovG.js.map +1 -1
- package/dist/esm/Navigation-CTjK6tLU.js.map +1 -1
- package/dist/esm/PoweredBySmileId-CxbaihMu.js.map +1 -1
- package/dist/esm/SelfieCaptureScreens-DbdN2zNk.js +7901 -0
- package/dist/esm/SelfieCaptureScreens-DbdN2zNk.js.map +1 -0
- package/dist/esm/SignaturePad-C7MtmT8m.js.map +1 -1
- package/dist/esm/TotpConsent-CQU5jQi4.js.map +1 -1
- package/dist/esm/combobox.js.map +1 -1
- package/dist/esm/document.js +1 -1
- package/dist/esm/main.js +2 -2
- package/dist/esm/{package-CZlW6BZn.js → package-bgeQiff6.js} +2 -2
- package/dist/esm/package-bgeQiff6.js.map +1 -0
- package/dist/esm/selfie.js +1 -1
- package/dist/esm/smart-camera-web.js +3 -3
- package/dist/esm/smart-camera-web.js.map +1 -1
- package/dist/esm/styles-BOEZtbuc.js.map +1 -1
- package/dist/package-lock.json +4948 -0
- package/dist/package.json +59 -0
- package/dist/smart-camera-web.js +72 -98
- package/dist/smart-camera-web.js.gz +0 -0
- package/dist/smart-camera-web.js.map +1 -1
- package/dist/src/components/combobox/src/index.js +2 -0
- package/dist/src/components/combobox/src/index.js.map +7 -0
- package/dist/src/components/document/src/index.js +2 -0
- package/dist/src/components/document/src/index.js.map +7 -0
- package/dist/src/components/end-user-consent/src/index.js +14 -0
- package/dist/src/components/end-user-consent/src/index.js.map +7 -0
- package/dist/src/components/selfie/src/index.js +2 -0
- package/dist/src/components/selfie/src/index.js.map +7 -0
- package/dist/src/components/signature-pad/src/index.js +10 -0
- package/dist/src/components/signature-pad/src/index.js.map +7 -0
- package/dist/src/components/smart-camera-web/src/SmartCameraWeb.js +2 -0
- package/dist/src/components/smart-camera-web/src/SmartCameraWeb.js.map +7 -0
- package/dist/src/components/totp-consent/src/index.js +14 -0
- package/dist/src/components/totp-consent/src/index.js.map +7 -0
- package/dist/src/index.js.map +7 -0
- package/dist/styles/README.md +3 -0
- package/dist/types/combobox.d.ts +19 -19
- package/dist/types/document.d.ts +19 -19
- package/dist/types/end-user-consent.d.ts +19 -19
- package/dist/types/main.d.ts +24 -20
- package/dist/types/navigation.d.ts +19 -19
- package/dist/types/selfie.d.ts +19 -19
- package/dist/types/signature-pad.d.ts +19 -19
- package/dist/types/smart-camera-web.d.ts +19 -19
- package/dist/types/totp-consent.d.ts +19 -19
- package/lib/components/README.md +14 -14
- package/lib/components/attribution/PoweredBySmileId.js +42 -42
- package/lib/components/camera-permission/CameraPermission.js +139 -139
- package/lib/components/camera-permission/CameraPermission.stories.js +27 -27
- package/lib/components/combobox/src/Combobox.js +589 -589
- package/lib/components/combobox/src/index.js +1 -1
- package/lib/components/document/src/DocumentCaptureScreens.js +410 -409
- package/lib/components/document/src/DocumentCaptureScreens.stories.js +57 -57
- package/lib/components/document/src/README.md +111 -111
- package/lib/components/document/src/document-capture/DocumentCapture.js +760 -760
- package/lib/components/document/src/document-capture/DocumentCapture.stories.js +78 -78
- package/lib/components/document/src/document-capture/README.md +90 -90
- package/lib/components/document/src/document-capture/index.js +3 -3
- package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.js +545 -545
- package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.stories.js +24 -24
- package/lib/components/document/src/document-capture-instructions/README.md +56 -56
- package/lib/components/document/src/document-capture-instructions/index.js +3 -3
- package/lib/components/document/src/document-capture-review/DocumentCaptureReview.js +360 -360
- package/lib/components/document/src/document-capture-review/DocumentCaptureReview.stories.js +24 -24
- package/lib/components/document/src/document-capture-review/README.md +79 -79
- package/lib/components/document/src/document-capture-review/index.js +3 -3
- package/lib/components/document/src/index.js +3 -3
- package/lib/components/end-user-consent/src/EndUserConsent.js +795 -795
- package/lib/components/end-user-consent/src/EndUserConsent.stories.js +29 -29
- package/lib/components/end-user-consent/src/index.js +4 -4
- package/lib/components/navigation/src/Navigation.js +171 -171
- package/lib/components/navigation/src/Navigation.stories.js +24 -24
- package/lib/components/navigation/src/index.js +3 -3
- package/lib/components/selfie/README.md +225 -225
- package/lib/components/selfie/src/SelfieCaptureScreens.js +420 -431
- package/lib/components/selfie/src/SelfieCaptureScreens.stories.js +29 -29
- package/lib/components/selfie/src/index.js +3 -3
- package/lib/components/selfie/src/selfie-capture/SelfieCapture.js +1099 -1084
- package/lib/components/selfie/src/selfie-capture/SelfieCapture.stories.js +36 -36
- package/lib/components/selfie/src/selfie-capture/index.js +3 -3
- package/lib/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.js +689 -689
- package/lib/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.stories.js +23 -23
- package/lib/components/selfie/src/selfie-capture-instructions/index.js +3 -3
- package/lib/components/selfie/src/selfie-capture-review/SelfieCaptureReview.js +209 -209
- package/lib/components/selfie/src/selfie-capture-review/SelfieCaptureReview.stories.js +24 -24
- package/lib/components/selfie/src/selfie-capture-review/index.js +3 -3
- package/lib/components/selfie/src/selfie-capture-wrapper/SelfieCaptureWrapper.tsx +256 -239
- package/lib/components/selfie/src/selfie-capture-wrapper/index.ts +1 -1
- package/lib/components/selfie/src/smartselfie-capture/OvalProgress.tsx +81 -81
- package/lib/components/selfie/src/smartselfie-capture/SmartSelfieCapture.tsx +265 -283
- package/lib/components/selfie/src/smartselfie-capture/components/AlertDisplay.tsx +34 -34
- package/lib/components/selfie/src/smartselfie-capture/components/CameraPreview.tsx +97 -97
- package/lib/components/selfie/src/smartselfie-capture/components/CaptureControls.tsx +78 -76
- package/lib/components/selfie/src/smartselfie-capture/components/index.ts +3 -3
- package/lib/components/selfie/src/smartselfie-capture/constants.ts +23 -23
- package/lib/components/selfie/src/smartselfie-capture/hooks/index.ts +2 -2
- package/lib/components/selfie/src/smartselfie-capture/hooks/useCamera.ts +238 -238
- package/lib/components/selfie/src/smartselfie-capture/hooks/useFaceCapture.ts +618 -617
- package/lib/components/selfie/src/smartselfie-capture/index.ts +1 -1
- package/lib/components/selfie/src/smartselfie-capture/utils/alertMessages.ts +13 -13
- package/lib/components/selfie/src/smartselfie-capture/utils/canvas.ts +105 -105
- package/lib/components/selfie/src/smartselfie-capture/utils/faceDetection.ts +129 -129
- package/lib/components/selfie/src/smartselfie-capture/utils/imageCapture.ts +64 -64
- package/lib/components/selfie/src/smartselfie-capture/utils/index.ts +4 -4
- package/lib/components/selfie/src/smartselfie-capture/utils/mediapipeManager.ts +77 -77
- package/lib/components/signature-pad/package-lock.json +3009 -3009
- package/lib/components/signature-pad/package.json +30 -30
- package/lib/components/signature-pad/src/SignaturePad.js +484 -484
- package/lib/components/signature-pad/src/SignaturePad.stories.js +32 -32
- package/lib/components/signature-pad/src/index.js +3 -3
- package/lib/components/smart-camera-web/src/README.md +206 -206
- package/lib/components/smart-camera-web/src/SmartCameraWeb.js +305 -305
- package/lib/components/smart-camera-web/src/SmartCameraWeb.stories.js +57 -57
- package/lib/components/totp-consent/src/TotpConsent.js +949 -949
- package/lib/components/totp-consent/src/index.js +4 -4
- package/lib/domain/camera/src/README.md +38 -38
- package/lib/domain/camera/src/SmartCamera.js +109 -109
- package/lib/domain/constants/src/Constants.js +27 -27
- package/lib/domain/file-upload/README.md +35 -35
- package/lib/domain/file-upload/src/SmartFileUpload.js +65 -65
- package/lib/styles/README.md +3 -3
- package/lib/styles/src/styles.js +372 -372
- package/lib/styles/src/typography.js +52 -52
- package/package.json +111 -112
- package/dist/esm/DocumentCaptureScreens-BjATTDqu.js.map +0 -1
- package/dist/esm/SelfieCaptureScreens-UUzZzl1A.js +0 -11361
- package/dist/esm/SelfieCaptureScreens-UUzZzl1A.js.map +0 -1
- package/dist/esm/package-CZlW6BZn.js.map +0 -1
package/lib/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.stories.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import './index';
|
|
2
|
-
|
|
3
|
-
const meta = {
|
|
4
|
-
argTypes: {
|
|
5
|
-
'theme-color': { control: 'color' },
|
|
6
|
-
},
|
|
7
|
-
component: 'selfie-capture-instructions',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default meta;
|
|
11
|
-
|
|
12
|
-
export const SelfieInstruction = {
|
|
13
|
-
args: {
|
|
14
|
-
'theme-color': '#001096',
|
|
15
|
-
},
|
|
16
|
-
render: (args) => `
|
|
17
|
-
<selfie-capture-instructions
|
|
18
|
-
show-navigation
|
|
19
|
-
theme-color='${args['theme-color']}'
|
|
20
|
-
>
|
|
21
|
-
</selfie-capture-instructions>
|
|
22
|
-
`,
|
|
23
|
-
};
|
|
1
|
+
import './index';
|
|
2
|
+
|
|
3
|
+
const meta = {
|
|
4
|
+
argTypes: {
|
|
5
|
+
'theme-color': { control: 'color' },
|
|
6
|
+
},
|
|
7
|
+
component: 'selfie-capture-instructions',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
|
|
12
|
+
export const SelfieInstruction = {
|
|
13
|
+
args: {
|
|
14
|
+
'theme-color': '#001096',
|
|
15
|
+
},
|
|
16
|
+
render: (args) => `
|
|
17
|
+
<selfie-capture-instructions
|
|
18
|
+
show-navigation
|
|
19
|
+
theme-color='${args['theme-color']}'
|
|
20
|
+
>
|
|
21
|
+
</selfie-capture-instructions>
|
|
22
|
+
`,
|
|
23
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import SelfieInstructions from './SelfieCaptureInstructions';
|
|
2
|
-
|
|
3
|
-
export default SelfieInstructions;
|
|
1
|
+
import SelfieInstructions from './SelfieCaptureInstructions';
|
|
2
|
+
|
|
3
|
+
export default SelfieInstructions;
|
|
@@ -1,209 +1,209 @@
|
|
|
1
|
-
import styles from '../../../../styles/src/styles';
|
|
2
|
-
import '../../../navigation/src';
|
|
3
|
-
|
|
4
|
-
function templateString() {
|
|
5
|
-
return `
|
|
6
|
-
<style>
|
|
7
|
-
.retake-photo.button[data-variant~="ghost"] {
|
|
8
|
-
color: #FF5805;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
#selfie-capture-review-screen {
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
padding: 1rem;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
#selfie-capture-review-screen .selfie-review-container.landscape {
|
|
18
|
-
height: auto;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
#selfie-capture-review-screen header p {
|
|
22
|
-
margin-block: 0 !important;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.selfie-review-container.portrait {
|
|
26
|
-
width: 100%;
|
|
27
|
-
position: relative;
|
|
28
|
-
height: calc(200px * 1.4);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.selfie-review-container.portrait img {
|
|
32
|
-
width: calc(213px + 0.9rem);
|
|
33
|
-
height: 100%;
|
|
34
|
-
position: absolute;
|
|
35
|
-
top: 239px;
|
|
36
|
-
left: 161px;
|
|
37
|
-
padding-bottom: calc((214px * 1.4) / 3);
|
|
38
|
-
padding-top: calc((191px * 1.4) / 3);
|
|
39
|
-
object-fit: cover;
|
|
40
|
-
|
|
41
|
-
transform: translateX(-50%) translateY(-50%);
|
|
42
|
-
z-index: 1;
|
|
43
|
-
block-size: 100%;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
h1 {
|
|
47
|
-
color: var(--web-digital-blue, #001096);
|
|
48
|
-
text-align: center;
|
|
49
|
-
/* h1 */
|
|
50
|
-
font-size: 1.25rem;
|
|
51
|
-
font-style: normal;
|
|
52
|
-
font-weight: 700;
|
|
53
|
-
line-height: 36px; /* 150% */
|
|
54
|
-
margin-top: 0;
|
|
55
|
-
}
|
|
56
|
-
</style>
|
|
57
|
-
${styles(this.themeColor)}
|
|
58
|
-
<div id='selfie-capture-review-screen' class='center'>
|
|
59
|
-
<smileid-navigation ${this.showNavigation ? 'show-navigation' : ''} hide-back></smileid-navigation>
|
|
60
|
-
<h1 class="header-title title-color font-bold">
|
|
61
|
-
Is your whole face clear?
|
|
62
|
-
</h1>
|
|
63
|
-
<div class='section | flow'>
|
|
64
|
-
<div class='selfie-review-container ${this.isPortraitCaptureView ? 'portrait' : 'landscape'}'>
|
|
65
|
-
${
|
|
66
|
-
this.imageSrc
|
|
67
|
-
? `<img
|
|
68
|
-
alt='your ID card'
|
|
69
|
-
id='document-capture-review-image'
|
|
70
|
-
src='${this.imageSrc}'
|
|
71
|
-
width='396'
|
|
72
|
-
style='max-width: 90%;${this.shouldMirror ? ' transform: scaleX(-1);' : ''}'
|
|
73
|
-
/>`
|
|
74
|
-
: ''
|
|
75
|
-
}
|
|
76
|
-
</div>
|
|
77
|
-
<div class='flow action-buttons'>
|
|
78
|
-
<button data-variant='solid full-width' class='button' type='button' id='select-id-image'>
|
|
79
|
-
Yes, use this
|
|
80
|
-
</button>
|
|
81
|
-
<button data-variant='ghost full-width' class='button retake-photo' type='button' id='re-capture-image'>
|
|
82
|
-
No, Retake Selfie
|
|
83
|
-
</button>
|
|
84
|
-
</div>
|
|
85
|
-
${
|
|
86
|
-
this.hideAttribution
|
|
87
|
-
? ''
|
|
88
|
-
: `
|
|
89
|
-
<powered-by-smile-id></powered-by-smile-id>
|
|
90
|
-
`
|
|
91
|
-
}
|
|
92
|
-
</div>
|
|
93
|
-
</div>
|
|
94
|
-
`;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
class SelfieCaptureReview extends HTMLElement {
|
|
98
|
-
constructor() {
|
|
99
|
-
super();
|
|
100
|
-
this.templateString = templateString.bind(this);
|
|
101
|
-
this.render = () => this.templateString();
|
|
102
|
-
|
|
103
|
-
this.attachShadow({ mode: 'open' });
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
connectedCallback() {
|
|
107
|
-
const template = document.createElement('template');
|
|
108
|
-
template.innerHTML = this.render();
|
|
109
|
-
this.shadowRoot.innerHTML = '';
|
|
110
|
-
this.shadowRoot.appendChild(template.content.cloneNode(true));
|
|
111
|
-
this.setUpEventListeners();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
static get observedAttributes() {
|
|
115
|
-
return [
|
|
116
|
-
'hide-back-to-host',
|
|
117
|
-
'show-navigation',
|
|
118
|
-
'data-image',
|
|
119
|
-
'mirror-image',
|
|
120
|
-
];
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
get hideBack() {
|
|
124
|
-
return this.hasAttribute('hide-back-to-host');
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
get showNavigation() {
|
|
128
|
-
return this.hasAttribute('show-navigation');
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
get themeColor() {
|
|
132
|
-
return this.getAttribute('theme-color') || '#001096';
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
get hideAttribution() {
|
|
136
|
-
return this.hasAttribute('hide-attribution');
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
get imageSrc() {
|
|
140
|
-
return this.getAttribute('data-image');
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
get shouldMirror() {
|
|
144
|
-
return this.getAttribute('mirror-image') !== 'false';
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
get title() {
|
|
148
|
-
return this.getAttribute('title') || 'Submit Front of ID';
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
handleBackEvents() {
|
|
152
|
-
this.dispatchEvent(new CustomEvent('selfie-capture-review.cancelled'));
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
handleCloseEvents() {
|
|
156
|
-
this.dispatchEvent(new CustomEvent('selfie-capture-review.close'));
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
attributeChangedCallback(name) {
|
|
160
|
-
switch (name) {
|
|
161
|
-
case 'data-image':
|
|
162
|
-
case 'hide-back-to-host':
|
|
163
|
-
case 'show-navigation':
|
|
164
|
-
case 'mirror-image':
|
|
165
|
-
this.shadowRoot.innerHTML = this.render();
|
|
166
|
-
this.setUpEventListeners();
|
|
167
|
-
break;
|
|
168
|
-
default:
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
setUpEventListeners() {
|
|
174
|
-
this.selectImage = this.shadowRoot.querySelector('#select-id-image');
|
|
175
|
-
this.reCaptureImage = this.shadowRoot.querySelector('#re-capture-image');
|
|
176
|
-
this.navigation = this.shadowRoot.querySelector('smileid-navigation');
|
|
177
|
-
|
|
178
|
-
this.navigation.addEventListener('navigation.back', () => {
|
|
179
|
-
this.handleBackEvents();
|
|
180
|
-
});
|
|
181
|
-
this.navigation.addEventListener('navigation.close', () => {
|
|
182
|
-
this.handleCloseEvents();
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
this.selectImage.addEventListener('click', () => {
|
|
186
|
-
this.dispatchEvent(
|
|
187
|
-
new CustomEvent('selfie-capture-review.accepted', {
|
|
188
|
-
detail: {},
|
|
189
|
-
}),
|
|
190
|
-
);
|
|
191
|
-
});
|
|
192
|
-
this.reCaptureImage.addEventListener('click', () => {
|
|
193
|
-
this.dispatchEvent(
|
|
194
|
-
new CustomEvent('selfie-capture-review.rejected', {
|
|
195
|
-
detail: {},
|
|
196
|
-
}),
|
|
197
|
-
);
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (
|
|
203
|
-
'customElements' in window &&
|
|
204
|
-
!customElements.get('selfie-capture-review')
|
|
205
|
-
) {
|
|
206
|
-
window.customElements.define('selfie-capture-review', SelfieCaptureReview);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export default SelfieCaptureReview;
|
|
1
|
+
import styles from '../../../../styles/src/styles';
|
|
2
|
+
import '../../../navigation/src';
|
|
3
|
+
|
|
4
|
+
function templateString() {
|
|
5
|
+
return `
|
|
6
|
+
<style>
|
|
7
|
+
.retake-photo.button[data-variant~="ghost"] {
|
|
8
|
+
color: #FF5805;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
#selfie-capture-review-screen {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
padding: 1rem;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#selfie-capture-review-screen .selfie-review-container.landscape {
|
|
18
|
+
height: auto;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#selfie-capture-review-screen header p {
|
|
22
|
+
margin-block: 0 !important;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.selfie-review-container.portrait {
|
|
26
|
+
width: 100%;
|
|
27
|
+
position: relative;
|
|
28
|
+
height: calc(200px * 1.4);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.selfie-review-container.portrait img {
|
|
32
|
+
width: calc(213px + 0.9rem);
|
|
33
|
+
height: 100%;
|
|
34
|
+
position: absolute;
|
|
35
|
+
top: 239px;
|
|
36
|
+
left: 161px;
|
|
37
|
+
padding-bottom: calc((214px * 1.4) / 3);
|
|
38
|
+
padding-top: calc((191px * 1.4) / 3);
|
|
39
|
+
object-fit: cover;
|
|
40
|
+
|
|
41
|
+
transform: translateX(-50%) translateY(-50%);
|
|
42
|
+
z-index: 1;
|
|
43
|
+
block-size: 100%;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
h1 {
|
|
47
|
+
color: var(--web-digital-blue, #001096);
|
|
48
|
+
text-align: center;
|
|
49
|
+
/* h1 */
|
|
50
|
+
font-size: 1.25rem;
|
|
51
|
+
font-style: normal;
|
|
52
|
+
font-weight: 700;
|
|
53
|
+
line-height: 36px; /* 150% */
|
|
54
|
+
margin-top: 0;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
57
|
+
${styles(this.themeColor)}
|
|
58
|
+
<div id='selfie-capture-review-screen' class='center'>
|
|
59
|
+
<smileid-navigation ${this.showNavigation ? 'show-navigation' : ''} hide-back></smileid-navigation>
|
|
60
|
+
<h1 class="header-title title-color font-bold">
|
|
61
|
+
Is your whole face clear?
|
|
62
|
+
</h1>
|
|
63
|
+
<div class='section | flow'>
|
|
64
|
+
<div class='selfie-review-container ${this.isPortraitCaptureView ? 'portrait' : 'landscape'}'>
|
|
65
|
+
${
|
|
66
|
+
this.imageSrc
|
|
67
|
+
? `<img
|
|
68
|
+
alt='your ID card'
|
|
69
|
+
id='document-capture-review-image'
|
|
70
|
+
src='${this.imageSrc}'
|
|
71
|
+
width='396'
|
|
72
|
+
style='max-width: 90%;${this.shouldMirror ? ' transform: scaleX(-1);' : ''}'
|
|
73
|
+
/>`
|
|
74
|
+
: ''
|
|
75
|
+
}
|
|
76
|
+
</div>
|
|
77
|
+
<div class='flow action-buttons'>
|
|
78
|
+
<button data-variant='solid full-width' class='button' type='button' id='select-id-image'>
|
|
79
|
+
Yes, use this
|
|
80
|
+
</button>
|
|
81
|
+
<button data-variant='ghost full-width' class='button retake-photo' type='button' id='re-capture-image'>
|
|
82
|
+
No, Retake Selfie
|
|
83
|
+
</button>
|
|
84
|
+
</div>
|
|
85
|
+
${
|
|
86
|
+
this.hideAttribution
|
|
87
|
+
? ''
|
|
88
|
+
: `
|
|
89
|
+
<powered-by-smile-id></powered-by-smile-id>
|
|
90
|
+
`
|
|
91
|
+
}
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
class SelfieCaptureReview extends HTMLElement {
|
|
98
|
+
constructor() {
|
|
99
|
+
super();
|
|
100
|
+
this.templateString = templateString.bind(this);
|
|
101
|
+
this.render = () => this.templateString();
|
|
102
|
+
|
|
103
|
+
this.attachShadow({ mode: 'open' });
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
connectedCallback() {
|
|
107
|
+
const template = document.createElement('template');
|
|
108
|
+
template.innerHTML = this.render();
|
|
109
|
+
this.shadowRoot.innerHTML = '';
|
|
110
|
+
this.shadowRoot.appendChild(template.content.cloneNode(true));
|
|
111
|
+
this.setUpEventListeners();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
static get observedAttributes() {
|
|
115
|
+
return [
|
|
116
|
+
'hide-back-to-host',
|
|
117
|
+
'show-navigation',
|
|
118
|
+
'data-image',
|
|
119
|
+
'mirror-image',
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
get hideBack() {
|
|
124
|
+
return this.hasAttribute('hide-back-to-host');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
get showNavigation() {
|
|
128
|
+
return this.hasAttribute('show-navigation');
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
get themeColor() {
|
|
132
|
+
return this.getAttribute('theme-color') || '#001096';
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
get hideAttribution() {
|
|
136
|
+
return this.hasAttribute('hide-attribution');
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
get imageSrc() {
|
|
140
|
+
return this.getAttribute('data-image');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
get shouldMirror() {
|
|
144
|
+
return this.getAttribute('mirror-image') !== 'false';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
get title() {
|
|
148
|
+
return this.getAttribute('title') || 'Submit Front of ID';
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
handleBackEvents() {
|
|
152
|
+
this.dispatchEvent(new CustomEvent('selfie-capture-review.cancelled'));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
handleCloseEvents() {
|
|
156
|
+
this.dispatchEvent(new CustomEvent('selfie-capture-review.close'));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
attributeChangedCallback(name) {
|
|
160
|
+
switch (name) {
|
|
161
|
+
case 'data-image':
|
|
162
|
+
case 'hide-back-to-host':
|
|
163
|
+
case 'show-navigation':
|
|
164
|
+
case 'mirror-image':
|
|
165
|
+
this.shadowRoot.innerHTML = this.render();
|
|
166
|
+
this.setUpEventListeners();
|
|
167
|
+
break;
|
|
168
|
+
default:
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
setUpEventListeners() {
|
|
174
|
+
this.selectImage = this.shadowRoot.querySelector('#select-id-image');
|
|
175
|
+
this.reCaptureImage = this.shadowRoot.querySelector('#re-capture-image');
|
|
176
|
+
this.navigation = this.shadowRoot.querySelector('smileid-navigation');
|
|
177
|
+
|
|
178
|
+
this.navigation.addEventListener('navigation.back', () => {
|
|
179
|
+
this.handleBackEvents();
|
|
180
|
+
});
|
|
181
|
+
this.navigation.addEventListener('navigation.close', () => {
|
|
182
|
+
this.handleCloseEvents();
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
this.selectImage.addEventListener('click', () => {
|
|
186
|
+
this.dispatchEvent(
|
|
187
|
+
new CustomEvent('selfie-capture-review.accepted', {
|
|
188
|
+
detail: {},
|
|
189
|
+
}),
|
|
190
|
+
);
|
|
191
|
+
});
|
|
192
|
+
this.reCaptureImage.addEventListener('click', () => {
|
|
193
|
+
this.dispatchEvent(
|
|
194
|
+
new CustomEvent('selfie-capture-review.rejected', {
|
|
195
|
+
detail: {},
|
|
196
|
+
}),
|
|
197
|
+
);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (
|
|
203
|
+
'customElements' in window &&
|
|
204
|
+
!customElements.get('selfie-capture-review')
|
|
205
|
+
) {
|
|
206
|
+
window.customElements.define('selfie-capture-review', SelfieCaptureReview);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export default SelfieCaptureReview;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import './SelfieCaptureReview';
|
|
2
|
-
|
|
3
|
-
const meta = {
|
|
4
|
-
argTypes: {
|
|
5
|
-
'theme-color': { control: 'color' },
|
|
6
|
-
},
|
|
7
|
-
component: 'selfie-capture-review',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default meta;
|
|
11
|
-
|
|
12
|
-
export const SelfieCaptureReview = {
|
|
13
|
-
args: {
|
|
14
|
-
'theme-color': '#001096',
|
|
15
|
-
},
|
|
16
|
-
render: (args) => `
|
|
17
|
-
<selfie-capture-review
|
|
18
|
-
show-navigation
|
|
19
|
-
data-image="https://placehold.co/600x400"
|
|
20
|
-
theme-color='${args['theme-color']}'
|
|
21
|
-
>
|
|
22
|
-
</selfie-capture-review>
|
|
23
|
-
`,
|
|
24
|
-
};
|
|
1
|
+
import './SelfieCaptureReview';
|
|
2
|
+
|
|
3
|
+
const meta = {
|
|
4
|
+
argTypes: {
|
|
5
|
+
'theme-color': { control: 'color' },
|
|
6
|
+
},
|
|
7
|
+
component: 'selfie-capture-review',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
|
|
12
|
+
export const SelfieCaptureReview = {
|
|
13
|
+
args: {
|
|
14
|
+
'theme-color': '#001096',
|
|
15
|
+
},
|
|
16
|
+
render: (args) => `
|
|
17
|
+
<selfie-capture-review
|
|
18
|
+
show-navigation
|
|
19
|
+
data-image="https://placehold.co/600x400"
|
|
20
|
+
theme-color='${args['theme-color']}'
|
|
21
|
+
>
|
|
22
|
+
</selfie-capture-review>
|
|
23
|
+
`,
|
|
24
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import SelfieCaptureReview from './SelfieCaptureReview';
|
|
2
|
-
|
|
3
|
-
export default SelfieCaptureReview;
|
|
1
|
+
import SelfieCaptureReview from './SelfieCaptureReview';
|
|
2
|
+
|
|
3
|
+
export default SelfieCaptureReview;
|