veryfi-lens-wasm 2.0.4 → 2.0.5
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/components/blurModal.js +10 -4
- package/components/documentModal.js +13 -4
- package/package.json +1 -1
- package/veryfi-lens.js +14 -0
package/components/blurModal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const createBlurModal = (container, croppedImage, onRetake, onSubmit) => {
|
|
1
|
+
export const createBlurModal = (container, croppedImage, onRetake, onSubmit, options = {}) => {
|
|
2
2
|
const modal = document.createElement('div');
|
|
3
3
|
modal.id = 'veryfi-blur-modal';
|
|
4
4
|
modal.style.display = 'none';
|
|
@@ -31,6 +31,12 @@ export const createBlurModal = (container, croppedImage, onRetake, onSubmit) =>
|
|
|
31
31
|
secondaryButtonColor: '#1e293b'
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
const defaultOptions = {
|
|
35
|
+
blurModalMessage: 'Oops, The image is too blurry to process'
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Merge provided options with defaults
|
|
39
|
+
const modalOptions = { ...defaultOptions, ...options };
|
|
34
40
|
// Apply styles with fallback to default values
|
|
35
41
|
Object.entries(defaultStyles).forEach(([key, value]) => {
|
|
36
42
|
const cssVar = `--blur-modal-${key.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`)}`;
|
|
@@ -50,7 +56,7 @@ export const createBlurModal = (container, croppedImage, onRetake, onSubmit) =>
|
|
|
50
56
|
font-size: var(--blur-modal-text-font-size, ${defaultStyles.textFontSize});
|
|
51
57
|
font-family: var(--blur-modal-text-font-family, ${defaultStyles.textFontFamily});
|
|
52
58
|
">
|
|
53
|
-
|
|
59
|
+
${modalOptions.blurModalMessage.replace(/</g, '<').replace(/>/g, '>')}
|
|
54
60
|
</p>
|
|
55
61
|
<div style="display: flex; flex-direction: column; align-items: center; gap: 8px;">
|
|
56
62
|
<button id="veryfi-retake-blur" style="
|
|
@@ -69,7 +75,7 @@ export const createBlurModal = (container, croppedImage, onRetake, onSubmit) =>
|
|
|
69
75
|
font-family: var(--blur-modal-button-font-family, ${defaultStyles.buttonFontFamily});
|
|
70
76
|
text-transform: var(--blur-modal-button-text-transform, ${defaultStyles.buttonTextTransform});
|
|
71
77
|
">
|
|
72
|
-
|
|
78
|
+
${modalOptions.retakeButtonText.replace(/</g, '<').replace(/>/g, '>')}
|
|
73
79
|
</p>
|
|
74
80
|
</button>
|
|
75
81
|
<button id="veryfi-submit-blur" style="
|
|
@@ -88,7 +94,7 @@ export const createBlurModal = (container, croppedImage, onRetake, onSubmit) =>
|
|
|
88
94
|
font-family: var(--blur-modal-button-font-family, ${defaultStyles.buttonFontFamily});
|
|
89
95
|
text-transform: var(--blur-modal-button-text-transform, ${defaultStyles.buttonTextTransform});
|
|
90
96
|
">
|
|
91
|
-
|
|
97
|
+
${modalOptions.submitButtonText.replace(/</g, '<').replace(/>/g, '>')}
|
|
92
98
|
</p>
|
|
93
99
|
</button>
|
|
94
100
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const createDocumentModal = (container, croppedImage, onRetake, onSubmit) => {
|
|
1
|
+
export const createDocumentModal = (container, croppedImage, onRetake, onSubmit, options = {}) => {
|
|
2
2
|
const modal = document.createElement('div');
|
|
3
3
|
modal.id = 'veryfi-document-modal';
|
|
4
4
|
modal.style.display = 'none';
|
|
@@ -32,6 +32,15 @@ export const createDocumentModal = (container, croppedImage, onRetake, onSubmit)
|
|
|
32
32
|
secondaryButtonColor: '#1e293b'
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
const defaultOptions = {
|
|
36
|
+
noDocumentMessage: 'Oops, There appears to be no document on your image',
|
|
37
|
+
retakeButtonText: 'Retake a picture',
|
|
38
|
+
submitButtonText: 'Submit Anyway'
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Merge provided options with defaults
|
|
42
|
+
const modalOptions = { ...defaultOptions, ...options };
|
|
43
|
+
|
|
35
44
|
// Apply styles with fallback to default values
|
|
36
45
|
Object.entries(defaultStyles).forEach(([key, value]) => {
|
|
37
46
|
const cssVar = `--modal-${key.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`)}`;
|
|
@@ -52,7 +61,7 @@ export const createDocumentModal = (container, croppedImage, onRetake, onSubmit)
|
|
|
52
61
|
font-size: var(--modal-text-font-size, ${defaultStyles.textFontSize});
|
|
53
62
|
font-family: var(--modal-text-font-family, ${defaultStyles.textFontFamily});
|
|
54
63
|
">
|
|
55
|
-
|
|
64
|
+
${modalOptions.noDocumentMessage.replace(/</g, '<').replace(/>/g, '>')}
|
|
56
65
|
</p>
|
|
57
66
|
<div style="display: flex; flex-direction: column; align-items: center; gap: 8px;">
|
|
58
67
|
<button id="veryfi-retake-document" style="
|
|
@@ -71,7 +80,7 @@ export const createDocumentModal = (container, croppedImage, onRetake, onSubmit)
|
|
|
71
80
|
font-family: var(--modal-button-font-family, ${defaultStyles.buttonFontFamily});
|
|
72
81
|
text-transform: var(--modal-button-text-transform, ${defaultStyles.buttonTextTransform});
|
|
73
82
|
">
|
|
74
|
-
|
|
83
|
+
${modalOptions.retakeButtonText.replace(/</g, '<').replace(/>/g, '>')}
|
|
75
84
|
</p>
|
|
76
85
|
</button>
|
|
77
86
|
<button id="veryfi-submit-document" style="
|
|
@@ -90,7 +99,7 @@ export const createDocumentModal = (container, croppedImage, onRetake, onSubmit)
|
|
|
90
99
|
font-family: var(--modal-button-font-family, ${defaultStyles.buttonFontFamily});
|
|
91
100
|
text-transform: var(--modal-button-text-transform, ${defaultStyles.buttonTextTransform});
|
|
92
101
|
">
|
|
93
|
-
|
|
102
|
+
${modalOptions.submitButtonText.replace(/</g, '<').replace(/>/g, '>')}
|
|
94
103
|
</p>
|
|
95
104
|
</button>
|
|
96
105
|
</div>
|
package/package.json
CHANGED
package/veryfi-lens.js
CHANGED
|
@@ -138,6 +138,10 @@ const VeryfiLens = (function () {
|
|
|
138
138
|
submitButtonShown: false,
|
|
139
139
|
backScanningStartTime: null,
|
|
140
140
|
sdkVersion: "2.0.0",
|
|
141
|
+
documentModalMessage: 'Oops, There appears to be no document on your image',
|
|
142
|
+
blurModalMessage: 'Oops, The image is too blurry to process',
|
|
143
|
+
submitButtonText: 'Submit Anyway',
|
|
144
|
+
retakeButtonText: 'Retake a picture',
|
|
141
145
|
};
|
|
142
146
|
|
|
143
147
|
|
|
@@ -933,6 +937,11 @@ const VeryfiLens = (function () {
|
|
|
933
937
|
state.debug_mode && console.log("Submitting anyway");
|
|
934
938
|
hideVideoOverlay();
|
|
935
939
|
state.submitHandler && state.submitHandler(state.finalImage);
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
blurModalMessage: state.blurModalMessage,
|
|
943
|
+
retakeButtonText: state.retakeButtonText,
|
|
944
|
+
submitButtonText: state.submitButtonText
|
|
936
945
|
}
|
|
937
946
|
);
|
|
938
947
|
}
|
|
@@ -950,6 +959,11 @@ const VeryfiLens = (function () {
|
|
|
950
959
|
state.debug_mode && console.log("Submitting anyway");
|
|
951
960
|
hideVideoOverlay();
|
|
952
961
|
state.submitHandler && state.submitHandler(state.finalImage);
|
|
962
|
+
},
|
|
963
|
+
{
|
|
964
|
+
noDocumentMessage: state.documentModalMessage,
|
|
965
|
+
retakeButtonText: state.retakeButtonText,
|
|
966
|
+
submitButtonText: state.submitButtonText
|
|
953
967
|
}
|
|
954
968
|
);
|
|
955
969
|
}
|