@smileid/web-components 1.0.1-beta → 1.4.3

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.
Files changed (36) hide show
  1. package/components/camera-permission/CameraPermission.js +6 -2
  2. package/components/camera-permission/CameraPermission.stories.js +10 -4
  3. package/components/document/src/DocumentCaptureScreens.js +15 -9
  4. package/components/document/src/DocumentCaptureScreens.stories.js +16 -12
  5. package/components/document/src/document-capture/DocumentCapture.js +295 -217
  6. package/components/document/src/document-capture/DocumentCapture.stories.js +9 -2
  7. package/components/document/src/document-capture-instructions/DocumentCaptureInstructions.js +33 -33
  8. package/components/document/src/document-capture-instructions/DocumentCaptureInstructions.stories.js +8 -1
  9. package/components/document/src/document-capture-review/DocumentCaptureReview.js +15 -31
  10. package/components/document/src/document-capture-review/DocumentCaptureReview.stories.js +12 -2
  11. package/components/end-user-consent/src/EndUserConsent.js +14 -31
  12. package/components/end-user-consent/src/EndUserConsent.stories.js +8 -2
  13. package/components/navigation/src/Navigation.js +10 -2
  14. package/components/selfie/src/SelfieCaptureScreens.js +36 -10
  15. package/components/selfie/src/SelfieCaptureScreens.stories.js +13 -4
  16. package/components/selfie/src/selfie-capture/SelfieCapture.js +94 -23
  17. package/components/selfie/src/selfie-capture/SelfieCapture.stories.js +14 -1
  18. package/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.js +50 -44
  19. package/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.stories.js +8 -1
  20. package/components/selfie/src/selfie-capture-review/SelfieCaptureReview.js +3 -4
  21. package/components/selfie/src/selfie-capture-review/SelfieCaptureReview.stories.js +8 -1
  22. package/components/signature-pad/package-lock.json +3009 -0
  23. package/components/signature-pad/package.json +6 -6
  24. package/components/signature-pad/src/SignaturePad.js +5 -1
  25. package/components/signature-pad/src/SignaturePad.stories.js +10 -2
  26. package/components/smart-camera-web/src/SmartCameraWeb.js +53 -8
  27. package/components/smart-camera-web/src/SmartCameraWeb.stories.js +22 -9
  28. package/components/totp-consent/src/TotpConsent.js +19 -5
  29. package/cypress/e2e/smart-camera-web-agent-mode.cy.js +144 -0
  30. package/cypress/e2e/smart-camera-web-complete-flow.cy.js +221 -0
  31. package/cypress/e2e/smart-camera-web.cy.js +1 -1
  32. package/cypress/pages/smart-camera-web-agent-mode.html +36 -0
  33. package/cypress/pages/smart-camera-web-complete-flow.html +42 -0
  34. package/domain/camera/src/SmartCamera.js +28 -0
  35. package/package.json +8 -8
  36. package/styles/src/styles.js +14 -3
@@ -271,7 +271,7 @@ context('SmartCameraWeb', () => {
271
271
  .should('not.be.visible');
272
272
  });
273
273
 
274
- it('should switch to request screen when "Rest"', () => {
274
+ it('should switch to request screen when "Reset"', () => {
275
275
  cy.get('smart-camera-web').then((element) => {
276
276
  element[0].reset();
277
277
  });
@@ -0,0 +1,36 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
5
+ <style>
6
+ *,
7
+ *::before,
8
+ *::after {
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ body {
13
+ max-width: 100%;
14
+ min-height: 100%;
15
+ }
16
+
17
+ smart-camera-web {
18
+ margin-left: auto;
19
+ margin-right: auto;
20
+ max-width: 40ch;
21
+ padding: 1rem;
22
+ width: auto;
23
+ }
24
+ </style>
25
+ </head>
26
+
27
+ <body>
28
+ <smart-camera-web></smart-camera-web>
29
+
30
+ <script src="./js/components/smart-camera-web/src/SmartCameraWeb.js"></script>
31
+ <script>
32
+ const app = document.querySelector('smart-camera-web');
33
+ app.addEventListener('smart-camera-web.published', async (e) => {});
34
+ </script>
35
+ </body>
36
+ </html>
@@ -0,0 +1,42 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
5
+ <style>
6
+ *,
7
+ *::before,
8
+ *::after {
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ body {
13
+ max-width: 100%;
14
+ min-height: 100%;
15
+ }
16
+
17
+ smart-camera-web {
18
+ margin-left: auto;
19
+ margin-right: auto;
20
+ max-width: 40ch;
21
+ padding: 1rem;
22
+ width: auto;
23
+ }
24
+ </style>
25
+ </head>
26
+
27
+ <body>
28
+ <smart-camera-web
29
+ capture-id
30
+ disable-image-tests
31
+ theme-color="#001093"
32
+ ></smart-camera-web>
33
+
34
+ <script src="./js/components/smart-camera-web/src/SmartCameraWeb.js"></script>
35
+ <script>
36
+ const app = document.querySelector('smart-camera-web');
37
+ app.addEventListener('smart-camera-web.published', async (e) => {
38
+ console.log(e.detail);
39
+ });
40
+ </script>
41
+ </body>
42
+ </html>
@@ -31,6 +31,34 @@ class SmartCamera {
31
31
  }
32
32
  }
33
33
 
34
+ static async supportsAgentMode() {
35
+ try {
36
+ const devices = await navigator.mediaDevices.enumerateDevices();
37
+ const videoDevices = devices.filter(
38
+ (device) => device.kind === 'videoinput',
39
+ );
40
+
41
+ let hasBackCamera = false;
42
+
43
+ videoDevices.forEach((device) => {
44
+ // Check if the device label or device ID indicates a back camera
45
+ if (
46
+ device.label.toLowerCase().includes('back') ||
47
+ device.label.toLowerCase().includes('rear')
48
+ ) {
49
+ hasBackCamera = true;
50
+ return true;
51
+ }
52
+ return false;
53
+ });
54
+
55
+ return hasBackCamera;
56
+ } catch (error) {
57
+ console.warn('Error accessing media devices: ', error);
58
+ return false;
59
+ }
60
+ }
61
+
34
62
  static isSamsungMultiCameraDevice() {
35
63
  const matchedModelNumber = navigator.userAgent.match(/SM-[N|G]\d{3}/);
36
64
  if (!matchedModelNumber) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smileid/web-components",
3
- "version": "1.0.1-beta",
3
+ "version": "1.4.3",
4
4
  "exports": {
5
5
  ".": "./index.js",
6
6
  "./combobox": "./components/combobox/src/index.js",
@@ -28,19 +28,19 @@
28
28
  "type": "module",
29
29
  "author": "SmileID <support@usesmileid.com> (https://usesmileid.com)",
30
30
  "dependencies": {
31
- "signature_pad": "^4.1.7",
31
+ "signature_pad": "^5.0.2",
32
32
  "validate.js": "^0.13.1"
33
33
  },
34
34
  "devDependencies": {
35
- "cypress": "^13.10.0",
36
- "esbuild": "^0.21.4",
35
+ "cypress": "^13.14.1",
36
+ "esbuild": "^0.21.5",
37
37
  "eslint": "^8.57.0",
38
38
  "eslint-config-airbnb-base": "^15.0.0",
39
39
  "eslint-config-prettier": "^9.1.0",
40
- "eslint-plugin-cypress": "^3.0.2",
40
+ "eslint-plugin-cypress": "^3.3.0",
41
41
  "eslint-plugin-import": "^2.29.1",
42
- "eslint-plugin-jest": "^28.5.0",
43
- "eslint-plugin-prettier": "^5.1.3",
44
- "prettier": "^3.2.2"
42
+ "eslint-plugin-jest": "^28.6.0",
43
+ "eslint-plugin-prettier": "^5.2.1",
44
+ "prettier": "^3.3.3"
45
45
  }
46
46
  }
@@ -1,6 +1,8 @@
1
1
  import typography from './typography';
2
2
 
3
- const styles = `<link rel="preconnect" href="https://fonts.gstatic.com" />
3
+ const styles = (
4
+ themeColor,
5
+ ) => `<link rel="preconnect" href="https://fonts.gstatic.com" />
4
6
  <link
5
7
  href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap"
6
8
  rel="stylesheet"
@@ -9,6 +11,7 @@ const styles = `<link rel="preconnect" href="https://fonts.gstatic.com" />
9
11
  <style>
10
12
  ${typography}
11
13
  :host {
14
+ --theme-color: ${themeColor || '#001096'};
12
15
  --color-active: #001096;
13
16
  --color-default: #2d2b2a;
14
17
  --color-disabled: #848282;
@@ -83,6 +86,14 @@ ${typography}
83
86
  color: #001096;
84
87
  }
85
88
 
89
+ .title-color {
90
+ color: ${themeColor || '#001096'};
91
+ }
92
+
93
+ .theme-color {
94
+ color: ${themeColor || '#001096'};
95
+ }
96
+
86
97
  .center {
87
98
  text-align: center;
88
99
  margin-left: auto;
@@ -114,7 +125,7 @@ ${typography}
114
125
  }
115
126
 
116
127
  .button {
117
- --button-color: var(--color-active);
128
+ --button-color: ${themeColor || 'var(--active-color)'};
118
129
  -webkit-appearance: none;
119
130
  appearance: none;
120
131
  border-radius: 2.5rem;
@@ -310,7 +321,7 @@ ${typography}
310
321
  }
311
322
 
312
323
  .instruction-header {
313
- color: var(--web-digital-blue, #001096);
324
+ color: ${themeColor};
314
325
  }
315
326
 
316
327
  .flex-column {