@capturebridge/sdk 0.26.0 → 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
@@ -2,6 +2,6 @@
2
2
 
3
3
  <!--
4
4
  Not until: CPTR-38 is complete:
5
- [SDK Documentation for v0.26.0](https://docs.capturebridge.net/client/sdk/javascript/0.26.0/index.html)
6
- [SDK CHANGELOG](https://docs.capturebridge.net/client/sdk/javascript/0.26.0/CHANGELOG.html)
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
  -->
@@ -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 () {
@@ -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.26.0'
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.26.0",
3
+ "version": "0.26.1",
4
4
  "description": "Capture Bridge JavaScript client SDK",
5
5
  "type": "module",
6
6
  "types": "types.d.ts",