UNPKG

@scandit/web-datacapture-barcode

Version:

Scandit Data Capture SDK for the Web

1 lines • 1.59 kB
import{defaultSparkScan as e}from"../defaults/DefaultsSparkScan.js";import{sparkScanErrorSound as t,sparkScanSuccessSound as n}from"./sounds.js";import{Brush as r,Color as i,Feedback as a,Vibration as o}from"@scandit/web-datacapture-core";import{scanditBlue as s}from"@scandit/web-datacapture-core/build/js/private/ui/colors.js";var c=class{constructor(e,t){this.visualFeedbackColor=e,this.feedback=t}static defaultSuccessFeedback(){return new a(o.withPattern([300]),n)}static defaultErrorFeedback(){return new a(o.withPattern(e.SparkScanFeedback.errorVibrationPattern),t)}static defaultSuccessBrush(){return new r(s(.4),s(.4),3)}static defaultErrorBrush(){return new r(i.fromRGBA(0,0,0,0),i.fromRGBA(250,68,70,1),1)}static success(){return new u}},l=class extends c{constructor(e,t,n,r,a){super(n??i.fromRGBA(250,68,70,1),a??c.defaultErrorFeedback()),this.message=e,this.resumeCapturingDelay=t,this.brush=r??c.defaultErrorBrush()}toJSONObject(){return{type:`error`,barcodeFeedback:{feedback:this.feedback.toJSONObject(),message:this.message,resumeCapturingDelay:this.resumeCapturingDelay,visualFeedbackColor:this.visualFeedbackColor.toJSON(),brush:this.brush.toJSONObject()}}}},u=class extends c{constructor(e,t,n){super(e??s(),n??c.defaultSuccessFeedback()),this.brush=t??c.defaultSuccessBrush()}toJSONObject(){return{type:`success`,barcodeFeedback:{visualFeedbackColor:this.visualFeedbackColor.toJSON(),feedback:this.feedback.toJSONObject(),brush:this.brush.toJSONObject()}}}};export{l as SparkScanBarcodeErrorFeedback,c as SparkScanBarcodeFeedback,u as SparkScanBarcodeSuccessFeedback};