@microblink/blinkid-ux-manager 7.4.3 → 7.6.0

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 (145) hide show
  1. package/README.md +142 -0
  2. package/dist/blinkid-ux-manager.js +1874 -1270
  3. package/package.json +3 -3
  4. package/types/core/BlinkIdProcessingError.d.ts +1 -1
  5. package/types/core/BlinkIdProcessingError.d.ts.map +1 -1
  6. package/types/core/BlinkIdUxManager.d.ts +29 -2
  7. package/types/core/BlinkIdUxManager.d.ts.map +1 -1
  8. package/types/core/HapticFeedback.d.ts +57 -0
  9. package/types/core/HapticFeedback.d.ts.map +1 -0
  10. package/types/core/HapticFeedback.test.d.ts +5 -0
  11. package/types/core/HapticFeedback.test.d.ts.map +1 -0
  12. package/types/core/blinkid-ui-state.d.ts +7 -5
  13. package/types/core/blinkid-ui-state.d.ts.map +1 -1
  14. package/types/core/ping-camera-utils.d.ts +16 -0
  15. package/types/core/ping-camera-utils.d.ts.map +1 -0
  16. package/types/index.d.ts +1 -0
  17. package/types/index.d.ts.map +1 -1
  18. package/types/index.rollup.d.ts +139 -44
  19. package/types/shared/ping-implementations.d.ts +60 -0
  20. package/types/shared/ping-implementations.d.ts.map +1 -0
  21. package/types/shared/uiEventFeedbackMapper.d.ts +7 -0
  22. package/types/shared/uiEventFeedbackMapper.d.ts.map +1 -0
  23. package/types/ui/BlinkIdFeedbackUi.d.ts.map +1 -1
  24. package/types/ui/BlinkIdUiStoreContext.d.ts +6 -6
  25. package/types/ui/BlinkIdUiStoreContext.d.ts.map +1 -1
  26. package/types/ui/UiFeedbackOverlay.d.ts.map +1 -1
  27. package/types/ui/createBlinkIdFeedbackUi.d.ts +7 -1
  28. package/types/ui/createBlinkIdFeedbackUi.d.ts.map +1 -1
  29. package/types/ui/dialogs/HelpModal.d.ts.map +1 -1
  30. package/types/ui/dialogs/OnboardingGuideModal.d.ts.map +1 -1
  31. package/types/ui/feedbackMessages.d.ts.map +1 -1
  32. package/types/ui/locales/ak.d.ts +55 -0
  33. package/types/ui/locales/ak.d.ts.map +1 -0
  34. package/types/ui/locales/am.d.ts +55 -0
  35. package/types/ui/locales/am.d.ts.map +1 -0
  36. package/types/ui/locales/ar.d.ts +55 -0
  37. package/types/ui/locales/ar.d.ts.map +1 -0
  38. package/types/ui/locales/bn.d.ts +55 -0
  39. package/types/ui/locales/bn.d.ts.map +1 -0
  40. package/types/ui/locales/cs.d.ts +55 -0
  41. package/types/ui/locales/cs.d.ts.map +1 -0
  42. package/types/ui/locales/da.d.ts +55 -0
  43. package/types/ui/locales/da.d.ts.map +1 -0
  44. package/types/ui/locales/de.d.ts +55 -0
  45. package/types/ui/locales/de.d.ts.map +1 -0
  46. package/types/ui/locales/el.d.ts +55 -0
  47. package/types/ui/locales/el.d.ts.map +1 -0
  48. package/types/ui/locales/en.d.ts +40 -39
  49. package/types/ui/locales/en.d.ts.map +1 -1
  50. package/types/ui/locales/en_GB.d.ts +55 -0
  51. package/types/ui/locales/en_GB.d.ts.map +1 -0
  52. package/types/ui/locales/es.d.ts +55 -0
  53. package/types/ui/locales/es.d.ts.map +1 -0
  54. package/types/ui/locales/es_MX.d.ts +55 -0
  55. package/types/ui/locales/es_MX.d.ts.map +1 -0
  56. package/types/ui/locales/fa-latn.d.ts +55 -0
  57. package/types/ui/locales/fa-latn.d.ts.map +1 -0
  58. package/types/ui/locales/fi.d.ts +55 -0
  59. package/types/ui/locales/fi.d.ts.map +1 -0
  60. package/types/ui/locales/fil.d.ts +55 -0
  61. package/types/ui/locales/fil.d.ts.map +1 -0
  62. package/types/ui/locales/fr.d.ts +55 -0
  63. package/types/ui/locales/fr.d.ts.map +1 -0
  64. package/types/ui/locales/fr_CA.d.ts +55 -0
  65. package/types/ui/locales/fr_CA.d.ts.map +1 -0
  66. package/types/ui/locales/ha.d.ts +55 -0
  67. package/types/ui/locales/ha.d.ts.map +1 -0
  68. package/types/ui/locales/he.d.ts +55 -0
  69. package/types/ui/locales/he.d.ts.map +1 -0
  70. package/types/ui/locales/hi.d.ts +55 -0
  71. package/types/ui/locales/hi.d.ts.map +1 -0
  72. package/types/ui/locales/hr.d.ts +55 -0
  73. package/types/ui/locales/hr.d.ts.map +1 -0
  74. package/types/ui/locales/hu.d.ts +55 -0
  75. package/types/ui/locales/hu.d.ts.map +1 -0
  76. package/types/ui/locales/id.d.ts +55 -0
  77. package/types/ui/locales/id.d.ts.map +1 -0
  78. package/types/ui/locales/index.d.ts +60 -0
  79. package/types/ui/locales/index.d.ts.map +1 -0
  80. package/types/ui/locales/is.d.ts +55 -0
  81. package/types/ui/locales/is.d.ts.map +1 -0
  82. package/types/ui/locales/it.d.ts +55 -0
  83. package/types/ui/locales/it.d.ts.map +1 -0
  84. package/types/ui/locales/ja.d.ts +55 -0
  85. package/types/ui/locales/ja.d.ts.map +1 -0
  86. package/types/ui/locales/ka_GE.d.ts +55 -0
  87. package/types/ui/locales/ka_GE.d.ts.map +1 -0
  88. package/types/ui/locales/kk.d.ts +55 -0
  89. package/types/ui/locales/kk.d.ts.map +1 -0
  90. package/types/ui/locales/km_KH.d.ts +55 -0
  91. package/types/ui/locales/km_KH.d.ts.map +1 -0
  92. package/types/ui/locales/ko.d.ts +55 -0
  93. package/types/ui/locales/ko.d.ts.map +1 -0
  94. package/types/ui/locales/lv.d.ts +55 -0
  95. package/types/ui/locales/lv.d.ts.map +1 -0
  96. package/types/ui/locales/ms.d.ts +55 -0
  97. package/types/ui/locales/ms.d.ts.map +1 -0
  98. package/types/ui/locales/ne.d.ts +55 -0
  99. package/types/ui/locales/ne.d.ts.map +1 -0
  100. package/types/ui/locales/nl.d.ts +55 -0
  101. package/types/ui/locales/nl.d.ts.map +1 -0
  102. package/types/ui/locales/no.d.ts +55 -0
  103. package/types/ui/locales/no.d.ts.map +1 -0
  104. package/types/ui/locales/pl.d.ts +55 -0
  105. package/types/ui/locales/pl.d.ts.map +1 -0
  106. package/types/ui/locales/ps_AF.d.ts +55 -0
  107. package/types/ui/locales/ps_AF.d.ts.map +1 -0
  108. package/types/ui/locales/pt.d.ts +55 -0
  109. package/types/ui/locales/pt.d.ts.map +1 -0
  110. package/types/ui/locales/pt_BR.d.ts +55 -0
  111. package/types/ui/locales/pt_BR.d.ts.map +1 -0
  112. package/types/ui/locales/ro.d.ts +55 -0
  113. package/types/ui/locales/ro.d.ts.map +1 -0
  114. package/types/ui/locales/ru.d.ts +55 -0
  115. package/types/ui/locales/ru.d.ts.map +1 -0
  116. package/types/ui/locales/si.d.ts +55 -0
  117. package/types/ui/locales/si.d.ts.map +1 -0
  118. package/types/ui/locales/sk.d.ts +55 -0
  119. package/types/ui/locales/sk.d.ts.map +1 -0
  120. package/types/ui/locales/sl.d.ts +55 -0
  121. package/types/ui/locales/sl.d.ts.map +1 -0
  122. package/types/ui/locales/sr.d.ts +55 -0
  123. package/types/ui/locales/sr.d.ts.map +1 -0
  124. package/types/ui/locales/sv.d.ts +55 -0
  125. package/types/ui/locales/sv.d.ts.map +1 -0
  126. package/types/ui/locales/sw.d.ts +55 -0
  127. package/types/ui/locales/sw.d.ts.map +1 -0
  128. package/types/ui/locales/th.d.ts +55 -0
  129. package/types/ui/locales/th.d.ts.map +1 -0
  130. package/types/ui/locales/tr.d.ts +55 -0
  131. package/types/ui/locales/tr.d.ts.map +1 -0
  132. package/types/ui/locales/uk.d.ts +55 -0
  133. package/types/ui/locales/uk.d.ts.map +1 -0
  134. package/types/ui/locales/ur.d.ts +55 -0
  135. package/types/ui/locales/ur.d.ts.map +1 -0
  136. package/types/ui/locales/uz.d.ts +55 -0
  137. package/types/ui/locales/uz.d.ts.map +1 -0
  138. package/types/ui/locales/vi.d.ts +55 -0
  139. package/types/ui/locales/vi.d.ts.map +1 -0
  140. package/types/ui/locales/yo.d.ts +55 -0
  141. package/types/ui/locales/yo.d.ts.map +1 -0
  142. package/types/ui/locales/zh_CN.d.ts +55 -0
  143. package/types/ui/locales/zh_CN.d.ts.map +1 -0
  144. package/types/ui/locales/zh_TW.d.ts +55 -0
  145. package/types/ui/locales/zh_TW.d.ts.map +1 -0
package/README.md CHANGED
@@ -2,10 +2,20 @@
2
2
 
3
3
  This package provides user experience management and feedback UI for the BlinkID browser SDK. It parses results from [`@microblink/blinkid-core`](https://www.npmjs.com/package/@microblink/blinkid-core) and guides the user through the scanning process, controlling [`@microblink/camera-manager`](https://www.npmjs.com/package/@microblink/camera-manager) as needed.
4
4
 
5
+ ## Features
6
+
7
+ - **Smart UI State Management:** Provides both headless and UI components for user feedback during scanning
8
+ - **Camera Integration:** Integrates with BlinkID Core and Camera Manager
9
+ - **Haptic Feedback:** Built-in haptic feedback support for enhanced user experience on mobile devices
10
+ - **Document Filtering:** Advanced document class filtering capabilities
11
+ - **Timeout Management:** Configurable scanning timeouts with automatic state management
12
+ - **Localization Support:** Multi-language support with customizable strings
13
+
5
14
  ## Overview
6
15
 
7
16
  - Provides both headless and UI components for user feedback during scanning.
8
17
  - Integrates with BlinkID Core and Camera Manager.
18
+ - Includes haptic feedback system for mobile devices.
9
19
  - Used by [`@microblink/blinkid`](https://www.npmjs.com/package/@microblink/blinkid) and can be used directly for custom UI integrations.
10
20
 
11
21
  ## Installation
@@ -20,6 +30,52 @@ yarn add @microblink/blinkid-ux-manager
20
30
  pnpm add @microblink/blinkid-ux-manager
21
31
  ```
22
32
 
33
+ ## Haptic Feedback
34
+
35
+ The UX Manager includes a comprehensive haptic feedback system that provides tactile responses during the document scanning process. **This feature is primarily designed for Android devices using Chrome browser**, where it works reliably to enhance the scanning experience.
36
+
37
+ ### Haptic Feedback Types
38
+
39
+ | Event | Duration | Type | Description |
40
+ | ------------------ | -------- | ----- | --------------------------------------------- |
41
+ | First Side Success | 100ms | Short | When the first side of an ID card is captured |
42
+ | Final Success | 300ms | Long | When document scanning is completed |
43
+ | Error States | 100ms | Short | Quality issues (blur, glare, positioning) |
44
+ | Error Dialogs | 300ms | Long | Timeout or critical errors |
45
+ | Flashlight Toggle | 100ms | Short | When camera flashlight is activated |
46
+ | Warning States | 100ms | Short | During sensing phases (with 1s cooldown) |
47
+
48
+ ### Haptic Feedback Usage
49
+
50
+ ```javascript
51
+ import {
52
+ BlinkIdUxManager,
53
+ HapticFeedbackManager,
54
+ } from "@microblink/blinkid-ux-manager";
55
+
56
+ // Create UX Manager (haptic feedback enabled by default)
57
+ const uxManager = new BlinkIdUxManager(cameraManager, scanningSession);
58
+
59
+ // Check if haptic feedback is supported
60
+ if (uxManager.isHapticFeedbackSupported()) {
61
+ console.log("Device supports haptic feedback");
62
+ }
63
+
64
+ // Enable/disable haptic feedback
65
+ uxManager.setHapticFeedbackEnabled(true); // Enable
66
+ uxManager.setHapticFeedbackEnabled(false); // Disable
67
+
68
+ // Access haptic manager directly for manual control
69
+ const hapticManager = uxManager.getHapticFeedbackManager();
70
+ hapticManager.triggerShort(); // 100ms vibration for short feedback
71
+ hapticManager.triggerLong(); // 300ms vibration for long feedback
72
+ hapticManager.stop(); // Stop all vibration
73
+ ```
74
+
75
+ ### Browser Compatibility
76
+
77
+ **⚠️ Important:** Haptic feedback uses the [Web Vibration API](https://developer.mozilla.org/en-US/docs/Web/API/Vibration_API), which has **limited browser support**:
78
+
23
79
  ## Usage
24
80
 
25
81
  You can use `@microblink/blinkid-ux-manager` directly in your project for advanced or custom integrations. For most use cases, use [`@microblink/blinkid`](https://www.npmjs.com/package/@microblink/blinkid) for a simpler setup.
@@ -42,4 +98,90 @@ To build the package locally:
42
98
  pnpm build
43
99
  ```
44
100
 
101
+ 3. Run tests:
102
+
103
+ ```sh
104
+ pnpm test
105
+ ```
106
+
45
107
  The output files will be available in the `dist/` and `types/` directories.
108
+
109
+ ### Internationalization
110
+
111
+ You can customize UI strings when creating the feedback UI:
112
+
113
+ ```
114
+ createBlinkIdFeedbackUi(uxManager, cameraUi, {
115
+ localizationStrings: {
116
+ scan_the_barcode: "Please scan the barcode"
117
+ }
118
+ });
119
+ ```
120
+
121
+ #### Provided Translations
122
+
123
+ <details>
124
+ <summary>Click to see all available translation files</summary>
125
+
126
+ - [ak.ts](src/ui/locales/ak.ts)
127
+ - [am.ts](src/ui/locales/am.ts)
128
+ - [ar.ts](src/ui/locales/ar.ts)
129
+ - [bn.ts](src/ui/locales/bn.ts)
130
+ - [cs.ts](src/ui/locales/cs.ts)
131
+ - [da.ts](src/ui/locales/da.ts)
132
+ - [de.ts](src/ui/locales/de.ts)
133
+ - [el.ts](src/ui/locales/el.ts)
134
+ - [en.ts](src/ui/locales/en.ts)
135
+ - [en_GB.ts](src/ui/locales/en_GB.ts)
136
+ - [es.ts](src/ui/locales/es.ts)
137
+ - [es_MX.ts](src/ui/locales/es_MX.ts)
138
+ - [fa-latn.ts](src/ui/locales/fa-latn.ts)
139
+ - [fi.ts](src/ui/locales/fi.ts)
140
+ - [fil.ts](src/ui/locales/fil.ts)
141
+ - [fr.ts](src/ui/locales/fr.ts)
142
+ - [fr_CA.ts](src/ui/locales/fr_CA.ts)
143
+ - [ha.ts](src/ui/locales/ha.ts)
144
+ - [he.ts](src/ui/locales/he.ts)
145
+ - [hi.ts](src/ui/locales/hi.ts)
146
+ - [hr.ts](src/ui/locales/hr.ts)
147
+ - [hu.ts](src/ui/locales/hu.ts)
148
+ - [id.ts](src/ui/locales/id.ts)
149
+ - [is.ts](src/ui/locales/is.ts)
150
+ - [it.ts](src/ui/locales/it.ts)
151
+ - [ja.ts](src/ui/locales/ja.ts)
152
+ - [ka_GE.ts](src/ui/locales/ka_GE.ts)
153
+ - [kk.ts](src/ui/locales/kk.ts)
154
+ - [km_KH.ts](src/ui/locales/km_KH.ts)
155
+ - [ko.ts](src/ui/locales/ko.ts)
156
+ - [lv.ts](src/ui/locales/lv.ts)
157
+ - [ms.ts](src/ui/locales/ms.ts)
158
+ - [ne.ts](src/ui/locales/ne.ts)
159
+ - [nl.ts](src/ui/locales/nl.ts)
160
+ - [no.ts](src/ui/locales/no.ts)
161
+ - [pl.ts](src/ui/locales/pl.ts)
162
+ - [ps_AF.ts](src/ui/locales/ps_AF.ts)
163
+ - [pt.ts](src/ui/locales/pt.ts)
164
+ - [pt_BR.ts](src/ui/locales/pt_BR.ts)
165
+ - [ro.ts](src/ui/locales/ro.ts)
166
+ - [ru.ts](src/ui/locales/ru.ts)
167
+ - [si.ts](src/ui/locales/si.ts)
168
+ - [sk.ts](src/ui/locales/sk.ts)
169
+ - [sl.ts](src/ui/locales/sl.ts)
170
+ - [sr.ts](src/ui/locales/sr.ts)
171
+ - [sv.ts](src/ui/locales/sv.ts)
172
+ - [sw.ts](src/ui/locales/sw.ts)
173
+ - [th.ts](src/ui/locales/th.ts)
174
+ - [tr.ts](src/ui/locales/tr.ts)
175
+ - [uk.ts](src/ui/locales/uk.ts)
176
+ - [ur.ts](src/ui/locales/ur.ts)
177
+ - [uz.ts](src/ui/locales/uz.ts)
178
+ - [vi.ts](src/ui/locales/vi.ts)
179
+ - [yo.ts](src/ui/locales/yo.ts)
180
+ - [zh_CN.ts](src/ui/locales/zh_CN.ts)
181
+ - [zh_TW.ts](src/ui/locales/zh_TW.ts)
182
+
183
+ </details>
184
+
185
+ ---
186
+
187
+ You can import any of these files directly or use them as a starting point for your own localization.