@capturebridge/sdk 0.25.4 → 0.26.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/Device.js CHANGED
@@ -374,7 +374,7 @@ class Device {
374
374
  const url = `${this.baseUrl}/plugin/${this.plugin.id}/device/${this.id}/display`
375
375
 
376
376
  const asyncOperations = objects.map(async obj => {
377
- if (obj.constructor.name === 'Image') {
377
+ if (typeof obj.data === 'function') {
378
378
  await obj.data()
379
379
  }
380
380
  })
package/ICAO.js CHANGED
@@ -55,7 +55,7 @@ class ICAO extends Plugin {
55
55
  let imageData
56
56
 
57
57
  // If this is an ImageSource object fetch it's image data
58
- if (typeof image === 'object' && image.constructor.name === 'ImageSource') {
58
+ if (typeof image === 'object' && typeof image.data === 'function') {
59
59
  imageData = await image.data()
60
60
  } else if (typeof image === 'string') {
61
61
  imageData = image
package/IFace.js CHANGED
@@ -196,14 +196,14 @@ export class IFace extends ICAO {
196
196
  }
197
197
 
198
198
  // If this is a Probe object fetch it's image data
199
- if (typeof probe === 'object' && probe.constructor.name === 'Probe') {
199
+ if (typeof probe === 'object' && typeof probe.data === 'function') {
200
200
  await probe.data()
201
201
  }
202
202
 
203
203
  // And fetch data for candidates
204
204
  const asyncOperations = candidates.map(async candidate => {
205
205
  if (typeof candidate === 'object' &&
206
- candidate.constructor.name === 'Candidate') {
206
+ typeof candidate.data === 'function') {
207
207
  await candidate.data()
208
208
  }
209
209
  })
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # Capture Bridge JavaScript SDK
1
+ # Capture Bridge JavaScript Client SDK
2
2
 
3
3
  <!--
4
- Not until: INF-3147
5
- [SDK Documentation for v0.25.4](https://docs.capturebridge.net/client/sdk/javascript/0.25.4)
6
- [CHANGELOG](https://docs.capturebridge.net/client/sdk/javascript/0.25.4/CHANGELOG.html)
4
+ Not until: CPTR-38 is complete:
5
+ [SDK Documentation for v0.26.1](https://docs.capturebridge.net/client/sdk/javascript/0.26.1/index.html)
6
+ [SDK CHANGELOG](https://docs.capturebridge.net/client/sdk/javascript/0.26.1/CHANGELOG.html)
7
7
  -->
package/README.md.in CHANGED
@@ -1,7 +1,7 @@
1
- # Capture Bridge JavaScript SDK
1
+ # Capture Bridge JavaScript Client SDK
2
2
 
3
3
  <!--
4
- Not until: INF-3147
5
- [SDK Documentation for v0.0.0](https://docs.capturebridge.net/client/sdk/javascript/0.0.0)
6
- [CHANGELOG](https://docs.capturebridge.net/client/sdk/javascript/0.0.0/CHANGELOG.html)
4
+ Not until: CPTR-38 is complete:
5
+ [SDK Documentation for v0.0.0](https://docs.capturebridge.net/client/sdk/javascript/0.0.0/index.html)
6
+ [SDK CHANGELOG](https://docs.capturebridge.net/client/sdk/javascript/0.0.0/CHANGELOG.html)
7
7
  -->
@@ -2,7 +2,7 @@
2
2
  * @module SignatureTabletWidgets
3
3
  */
4
4
 
5
- import { blobToBase64 } from './Common.js'
5
+ import { blobToBase64, checkResponse } from './Common.js'
6
6
 
7
7
  /**
8
8
  * DisplayWidget
@@ -143,13 +143,15 @@ export class Image extends DisplayWidget {
143
143
  /**
144
144
  * Fetch the image data and base64 encode it
145
145
  * @async
146
- * @example
147
- * const new Image("/img/logo.tif", 20, 200)
148
146
  */
149
147
  async data () {
150
- const response = await fetch(this.url)
151
- const blob = await response.blob()
152
- this.imageData = await blobToBase64(blob)
148
+ if (!this.imageData && this.url) {
149
+ const response = await fetch(this.url)
150
+ await checkResponse(response)
151
+ const blob = await response.blob()
152
+ this.imageData = await blobToBase64(blob)
153
+ }
154
+ return this.imageData
153
155
  }
154
156
 
155
157
  toJSON () {
package/TopazSigGem.js CHANGED
@@ -63,6 +63,22 @@ class TopazSigGem extends SignatureTablet {
63
63
  const { clicked } = await device.displayObjects(objects, sceneOpt)
64
64
  return clicked
65
65
  }
66
+
67
+ /**
68
+ * Get detailed information about a specific tablet
69
+ *
70
+ * @description Returns detailed information about a tablet.
71
+ *
72
+ * @async
73
+ * @method
74
+ * @returns {object} Device info
75
+ * @example
76
+ * const info = await device.info()
77
+ */
78
+ async info (deviceOpt) {
79
+ const device = await this.setupDevice(deviceOpt)
80
+ return device.info()
81
+ }
66
82
  }
67
83
 
68
84
  export default TopazSigGem
@@ -2,7 +2,7 @@
2
2
  * @module VerifoneControls
3
3
  */
4
4
 
5
- import { blobToBase64 } from './Common.js'
5
+ import { blobToBase64, checkResponse } from './Common.js'
6
6
  import { DisplayWidget } from './SignatureTabletWidgets.js'
7
7
 
8
8
  /**
@@ -205,11 +205,13 @@ export class Image extends DisplayWidget {
205
205
  * @async
206
206
  */
207
207
  async data () {
208
- if (!this.imageData) {
208
+ if (!this.imageData && this.url) {
209
209
  const response = await fetch(this.url)
210
+ await checkResponse(response)
210
211
  const blob = await response.blob()
211
212
  this.imageData = await blobToBase64(blob)
212
213
  }
214
+ return this.imageData
213
215
  }
214
216
 
215
217
  toJSON () {
package/Version.js CHANGED
@@ -4,5 +4,5 @@
4
4
  * @constant
5
5
  * @type {string}
6
6
  */
7
- const VERSION = '0.25.4'
7
+ const VERSION = '0.26.1'
8
8
  export default VERSION
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capturebridge/sdk",
3
- "version": "0.25.4",
3
+ "version": "0.26.1",
4
4
  "description": "Capture Bridge JavaScript client SDK",
5
5
  "type": "module",
6
6
  "types": "types.d.ts",
package/CHANGELOG.html DELETED
@@ -1,231 +0,0 @@
1
- <html>
2
- <head>
3
- <title>CaptureBridge JavaScript SDK v0.25.4 Changelog</title>
4
- <style>
5
- body {
6
- font-family: sans-serif;
7
- background: #fff;
8
- color: #111;
9
- padding: 1em;
10
- margin:auto;
11
- max-width:720px;
12
- }
13
- pre {
14
- border: 1px solid #fff;
15
- padding: 1em;
16
- background:#333;
17
- color:#fff;
18
- }
19
- code {
20
- font-family: "Courier New", monospace;
21
- }
22
- @media (prefers-color-scheme: dark) {
23
- body {
24
- background: #111;
25
- color: #eee;
26
- }
27
- a {
28
- color: #5959F4;
29
- }
30
- a:visited {
31
- color: #916AB4;
32
- }
33
- a:active {
34
- color: #FF5959;
35
- }
36
- }
37
- </style>
38
- </head>
39
- <body>
40
- <h1>Changelog</h1>
41
- <p>All notable changes to this project will be documented in this file.</p>
42
- <p>The format is based on <a href="https://keepachangelog.com/en/1.1.0/">Keep a Changelog</a>,
43
- and this project adheres to <a href="https://semver.org/spec/v2.0.0.html">Semantic Versioning</a>.</p>
44
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.25.0">0.25.0</a> - 2025-04-30</h2>
45
- <h3>Changed</h3>
46
- <ul>
47
- <li>The SDK no longer sends a <code>rotate=0</code> parameter to capture and stream endpoints
48
- by default. Therefore you should no longer set a <code>rotate</code> parameter for
49
- capture and stream related methods unless the user has explicitly requested
50
- rotation (ensuring their site-specific configuration, if any, is honored.)</li>
51
- <li>You can inspect an instance&#39;s site-specific configuration at runtime via the
52
- <code>CaptureBridge.config()</code> method. The <code>defaultPluginRotation</code> config entry will
53
- list any rotation configurations.</li>
54
- </ul>
55
- <h3>Added</h3>
56
- <ul>
57
- <li>Added <code>info</code> method to the <code>CanonCamera</code> class.</li>
58
- <li>Added <code>config</code> method to the <code>CaptureBridge</code> class.</li>
59
- </ul>
60
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.22.7">0.22.7</a> - 2025-03-13</h2>
61
- <h3>Added</h3>
62
- <ul>
63
- <li>Updated documentation for the <code>CaptureResponseFormat</code> type to note support for
64
- <code>png</code> file types.</li>
65
- </ul>
66
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.21.1">0.21.1</a> - 2025-01-06</h2>
67
- <h3>Added</h3>
68
- <ul>
69
- <li>Added <code>escape</code> and <code>style</code> properties to Verifone <code>Text</code> objects and a text
70
- formatting example.</li>
71
- </ul>
72
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.20.0">0.20.0</a> - 2024-11-20</h2>
73
- <h3>Fixed</h3>
74
- <ul>
75
- <li>Tracks returned from <code>Verifone.readMagstripe()</code> are now in the correct order.</li>
76
- </ul>
77
- <h3>Changed</h3>
78
- <ul>
79
- <li><code>Verifone.readMagstripe()</code> was previously returning a base64 encoded <code>NULL</code>
80
- byte (e.g. the string <code>&quot;AA==&quot;</code>) for empty tracks, it is now returning <code>null</code>
81
- for empty tracks.</li>
82
- </ul>
83
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.19.2">0.19.2</a> - 2024-11-18</h2>
84
- <h3>Changed</h3>
85
- <ul>
86
- <li><code>ICAO.check()</code>, <code>IFace.icao()</code>, and <code>IFace.match()</code> will now throw an
87
- exception if the response from the server is an error (e.g. if an IFace
88
- license is not present.)</li>
89
- </ul>
90
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.19.0">0.19.0</a> - 2024-11-13</h2>
91
- <h3>Added</h3>
92
- <ul>
93
- <li>Added <code>Verifone.info()</code> method and device info SDK examples.</li>
94
- </ul>
95
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.18.3">0.18.3</a> - 2024-10-25</h2>
96
- <h3>Fixed</h3>
97
- <ul>
98
- <li>Fixed some bugs in error handling for the Verifone SDK examples.</li>
99
- <li>Now checking for a valid API response when invoking <code>Device.clear()</code></li>
100
- </ul>
101
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.18.2">0.18.2</a> - 2024-10-23</h2>
102
- <h3>Added</h3>
103
- <ul>
104
- <li>Added installation and Base URL information to SDK docs.</li>
105
- </ul>
106
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.18.1">0.18.1</a> - 2024-10-22</h2>
107
- <h3>Added</h3>
108
- <ul>
109
- <li>Added Topaz and IFace SDK examples</li>
110
- </ul>
111
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.18.0">0.18.0</a> - 2024-10-18</h2>
112
- <h3>Added</h3>
113
- <ul>
114
- <li>When running in a web browser, the value for <code>BASE_URL</code> will first be checked
115
- in a <code>capturebridge:url</code> meta tag, followed by <code>window.CAPTURE_BRIDGE_URL</code>,
116
- and finally <code>window.location.origin</code>. When running the SDK in Node.js a
117
- <code>CAPTURE_BRIDGE_URL</code> environment variable will be checked.</li>
118
- <li>Added the <code>Verifone.cancel()</code> method to gracefully cancel long-running
119
- operations such as the <code>Verifone.displayObjects()</code> and
120
- <code>Verifone.readMagstripe()</code> requests.</li>
121
- <li>Added the <code>Verifone.reset()</code> method to reset a device&#39;s state.</li>
122
- <li>Several Verifone SDK examples now contain a &quot;Cancel Request&quot; button.</li>
123
- <li>Added a Reset demo to the Verifone SDK examples allowing the SDK to reset the
124
- device state, forms processor app, and reboot the device.</li>
125
- <li>Added a Live ICAO demo containing face detection auto capture to the ICAO
126
- examples.</li>
127
- </ul>
128
- <h3>Changed</h3>
129
- <ul>
130
- <li><code>Verifone.displayObjects()</code> and <code>Verifone.readMagstripe()</code> now accept an
131
- additional <code>requestOpt</code> argument containing an optional
132
- <a href="https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal">AbortSignal</a> and
133
- <code>readyTimeout</code> parameter. <code>Verifone.cancel()</code> should be typically be used
134
- instead of the <code>AbortSignal</code> as it will block until the device is freed and
135
- available for another request.</li>
136
- </ul>
137
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.16.0">0.16.0</a> - 2024-10-03</h2>
138
- <h3>Changed</h3>
139
- <ul>
140
- <li><code>Plugin.shutdown()</code> now accepts a <code>timeout</code> argument.</li>
141
- </ul>
142
- <h3>Removed</h3>
143
- <ul>
144
- <li>Removed all callback style methods in favor of async/await methods.</li>
145
- </ul>
146
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.15.0">0.15.0</a> - 2024-09-25</h2>
147
- <h3>Added</h3>
148
- <ul>
149
- <li>Add <code>Plugin.hasMethod()</code> method for checking if a plugin has a specific RPC
150
- method.</li>
151
- <li>Add suppport for transcoding captured images to gif.</li>
152
- </ul>
153
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.14.0">0.14.0</a> - 2024-09-17</h2>
154
- <h3>Added</h3>
155
- <ul>
156
- <li>Add <code>Verifone.readMagstripe()</code> method for reading magstripe from Verifone.</li>
157
- </ul>
158
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.13.0">0.13.0</a> - 2024-09-10</h2>
159
- <h3>Added</h3>
160
- <ul>
161
- <li>Add Verifone dynamic form support and examples.</li>
162
- </ul>
163
- <h3>Changed</h3>
164
- <ul>
165
- <li><code>TopazSigGem.displayObjects()</code> previously accepted a boolean parameter for
166
- it&#39;s second argument, which if <code>true</code>, would clear the screen before displaying
167
- the objects. This method now accepts a <code>sceneOpt</code> object which contains
168
- <code>clear</code> and <code>backlight</code> boolean. A deprecation flag has been added to preserve
169
- the original function signature such that, if a boolean is provided, the method
170
- will fallback to the previous behavior of clearing the screen and emit a console
171
- warning. If an object is provided it will utilize any <code>clear</code> or <code>backlight</code>
172
- boolean properties.</li>
173
- </ul>
174
- <pre><code class="language-js">// Previous behavior, still works but will emit deprecation warning
175
- await tablet.displayObjects([
176
- new Text(&#39;My hovercraft is full of eels.&#39;, 100, 400),
177
- ], false)
178
-
179
- // New behavior
180
- const result = await tablet.displayObjects([
181
- new Text(&#39;My hovercraft is full of eels.&#39;, 100, 400),
182
- ], {clear: false, backlight: true})
183
- </code></pre>
184
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.12.0">0.12.0</a> - 2024-08-08</h2>
185
- <h3>Changed</h3>
186
- <ul>
187
- <li><code>BASE_URL</code> will default to <code>window.location.origin</code> if available, else
188
- <a href="https://local.capturebridge.net:9001">https://local.capturebridge.net:9001</a>) will be used.</li>
189
- </ul>
190
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.11.4">0.11.4</a> - 2024-07-29</h2>
191
- <h3>Added</h3>
192
- <ul>
193
- <li>Added <code>background</code> parameter to <code>ICAO.check()</code> and <code>IFace.icao()</code> that will
194
- fill in any part of the cropped image that falls outside the source image.</li>
195
- </ul>
196
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.11.0">0.11.0</a> - 2024-06-21</h2>
197
- <h3>Added</h3>
198
- <ul>
199
- <li>Added <code>DeviceForms</code> and <code>ControlProperty</code> classes for configuring forms for
200
- <code>Verifone</code>.</li>
201
- <li>Added <code>Verifone.renderForm()</code></li>
202
- </ul>
203
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.10.0">0.10.0</a> - 2024-06-17</h2>
204
- <h3>Changed</h3>
205
- <ul>
206
- <li>Introduced breaking changes to the structure of the object returned from
207
- <code>ICAO.check()</code></li>
208
- <li><code>ICAO</code> class will default to use the <code>capture_verify_iface</code> plugin if no
209
- plugin is provided to the constructor.</li>
210
- </ul>
211
- <h3>Added</h3>
212
- <ul>
213
- <li>Coordinates of the cropped photo are now returned from <code>ICAO.check()</code> if a face
214
- was found.</li>
215
- </ul>
216
- <h2><a href="https://www.npmjs.com/package/@capturebridge/sdk/v/0.9.0">0.9.0</a> - 2024-06-06</h2>
217
- <h3>Added</h3>
218
- <ul>
219
- <li>Introduced Changelog.</li>
220
- <li>Add Verifone class and examples (features signature capture support for the M450)</li>
221
- <li>Add <code>format</code> parameter to <code>DEFAULT_CAPTURE_OPT</code> (defaults to <code>null</code> which will
222
- use the plugin&#39;s default image format.)</li>
223
- <li>Add <code>CaptureResponseFormat</code> type definition to documentation.</li>
224
- </ul>
225
- <h3>Fixed</h3>
226
- <ul>
227
- <li>Fix bug where <code>null</code> would be sent for some URL parameters.</li>
228
- </ul>
229
-
230
- </body>
231
- </html>