feat(core): update session, security system and QR exchange
- Removed session creation and Lightning payment logic - Refactored security system: * no more restrictions * all systems enabled on session creation - Improved QR code exchange for mobile devices
This commit is contained in:
16
node_modules/html5-qrcode/cjs/ui/scanner/base.d.ts
generated
vendored
Normal file
16
node_modules/html5-qrcode/cjs/ui/scanner/base.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export declare class PublicUiElementIdAndClasses {
|
||||
static ALL_ELEMENT_CLASS: string;
|
||||
static CAMERA_PERMISSION_BUTTON_ID: string;
|
||||
static CAMERA_START_BUTTON_ID: string;
|
||||
static CAMERA_STOP_BUTTON_ID: string;
|
||||
static TORCH_BUTTON_ID: string;
|
||||
static CAMERA_SELECTION_SELECT_ID: string;
|
||||
static FILE_SELECTION_BUTTON_ID: string;
|
||||
static ZOOM_SLIDER_ID: string;
|
||||
static SCAN_TYPE_CHANGE_ANCHOR_ID: string;
|
||||
static TORCH_BUTTON_CLASS_TORCH_ON: string;
|
||||
static TORCH_BUTTON_CLASS_TORCH_OFF: string;
|
||||
}
|
||||
export declare class BaseUiElementFactory {
|
||||
static createElement<Type extends HTMLElement>(elementType: string, elementId: string): Type;
|
||||
}
|
||||
36
node_modules/html5-qrcode/cjs/ui/scanner/base.js
generated
vendored
Normal file
36
node_modules/html5-qrcode/cjs/ui/scanner/base.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BaseUiElementFactory = exports.PublicUiElementIdAndClasses = void 0;
|
||||
var PublicUiElementIdAndClasses = (function () {
|
||||
function PublicUiElementIdAndClasses() {
|
||||
}
|
||||
PublicUiElementIdAndClasses.ALL_ELEMENT_CLASS = "html5-qrcode-element";
|
||||
PublicUiElementIdAndClasses.CAMERA_PERMISSION_BUTTON_ID = "html5-qrcode-button-camera-permission";
|
||||
PublicUiElementIdAndClasses.CAMERA_START_BUTTON_ID = "html5-qrcode-button-camera-start";
|
||||
PublicUiElementIdAndClasses.CAMERA_STOP_BUTTON_ID = "html5-qrcode-button-camera-stop";
|
||||
PublicUiElementIdAndClasses.TORCH_BUTTON_ID = "html5-qrcode-button-torch";
|
||||
PublicUiElementIdAndClasses.CAMERA_SELECTION_SELECT_ID = "html5-qrcode-select-camera";
|
||||
PublicUiElementIdAndClasses.FILE_SELECTION_BUTTON_ID = "html5-qrcode-button-file-selection";
|
||||
PublicUiElementIdAndClasses.ZOOM_SLIDER_ID = "html5-qrcode-input-range-zoom";
|
||||
PublicUiElementIdAndClasses.SCAN_TYPE_CHANGE_ANCHOR_ID = "html5-qrcode-anchor-scan-type-change";
|
||||
PublicUiElementIdAndClasses.TORCH_BUTTON_CLASS_TORCH_ON = "html5-qrcode-button-torch-on";
|
||||
PublicUiElementIdAndClasses.TORCH_BUTTON_CLASS_TORCH_OFF = "html5-qrcode-button-torch-off";
|
||||
return PublicUiElementIdAndClasses;
|
||||
}());
|
||||
exports.PublicUiElementIdAndClasses = PublicUiElementIdAndClasses;
|
||||
var BaseUiElementFactory = (function () {
|
||||
function BaseUiElementFactory() {
|
||||
}
|
||||
BaseUiElementFactory.createElement = function (elementType, elementId) {
|
||||
var element = (document.createElement(elementType));
|
||||
element.id = elementId;
|
||||
element.classList.add(PublicUiElementIdAndClasses.ALL_ELEMENT_CLASS);
|
||||
if (elementType === "button") {
|
||||
element.setAttribute("type", "button");
|
||||
}
|
||||
return element;
|
||||
};
|
||||
return BaseUiElementFactory;
|
||||
}());
|
||||
exports.BaseUiElementFactory = BaseUiElementFactory;
|
||||
//# sourceMappingURL=base.js.map
|
||||
1
node_modules/html5-qrcode/cjs/ui/scanner/base.js.map
generated
vendored
Normal file
1
node_modules/html5-qrcode/cjs/ui/scanner/base.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/ui/scanner/base.ts"],"names":[],"mappings":";;;AAcA;IAAA;IA4CA,CAAC;IAxCU,6CAAiB,GAAG,sBAAsB,CAAC;IAG3C,uDAA2B,GAAG,uCAAuC,CAAC;IAGtE,kDAAsB,GAAG,kCAAkC,CAAC;IAG5D,iDAAqB,GAAG,iCAAiC,CAAC;IAG1D,2CAAe,GAAG,2BAA2B,CAAC;IAG9C,sDAA0B,GAAG,4BAA4B,CAAC;IAG1D,oDAAwB,GAAG,oCAAoC,CAAC;IAGhE,0CAAc,GAAG,+BAA+B,CAAC;IAMjD,sDAA0B,GAAG,sCAAsC,CAAC;IAOpE,uDAA2B,GAAG,8BAA8B,CAAC;IAG7D,wDAA4B,GAAG,+BAA+B,CAAC;IAG1E,kCAAC;CAAA,AA5CD,IA4CC;AA5CY,kEAA2B;AAiDxC;IAAA;IAiBA,CAAC;IAXiB,kCAAa,GAA3B,UACI,WAAmB,EAAE,SAAiB;QAEtC,IAAI,OAAO,GAAe,CAAC,QAAQ,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC;QAChE,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC;QACvB,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,2BAA2B,CAAC,iBAAiB,CAAC,CAAC;QACrE,IAAI,WAAW,KAAK,QAAQ,EAAE;YAC1B,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;SAC1C;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IACL,2BAAC;AAAD,CAAC,AAjBD,IAiBC;AAjBY,oDAAoB"}
|
||||
17
node_modules/html5-qrcode/cjs/ui/scanner/camera-selection-ui.d.ts
generated
vendored
Normal file
17
node_modules/html5-qrcode/cjs/ui/scanner/camera-selection-ui.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { CameraDevice } from "../../camera/core";
|
||||
export declare class CameraSelectionUi {
|
||||
private readonly selectElement;
|
||||
private readonly options;
|
||||
private readonly cameras;
|
||||
private constructor();
|
||||
private render;
|
||||
disable(): void;
|
||||
isDisabled(): boolean;
|
||||
enable(): void;
|
||||
getValue(): string;
|
||||
hasValue(value: string): boolean;
|
||||
setValue(value: string): void;
|
||||
hasSingleItem(): boolean;
|
||||
numCameras(): number;
|
||||
static create(parentElement: HTMLElement, cameras: Array<CameraDevice>): CameraSelectionUi;
|
||||
}
|
||||
89
node_modules/html5-qrcode/cjs/ui/scanner/camera-selection-ui.js
generated
vendored
Normal file
89
node_modules/html5-qrcode/cjs/ui/scanner/camera-selection-ui.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CameraSelectionUi = void 0;
|
||||
var base_1 = require("./base");
|
||||
var strings_1 = require("../../strings");
|
||||
var CameraSelectionUi = (function () {
|
||||
function CameraSelectionUi(cameras) {
|
||||
this.selectElement = base_1.BaseUiElementFactory
|
||||
.createElement("select", base_1.PublicUiElementIdAndClasses.CAMERA_SELECTION_SELECT_ID);
|
||||
this.cameras = cameras;
|
||||
this.options = [];
|
||||
}
|
||||
CameraSelectionUi.prototype.render = function (parentElement) {
|
||||
var cameraSelectionContainer = document.createElement("span");
|
||||
cameraSelectionContainer.style.marginRight = "10px";
|
||||
var numCameras = this.cameras.length;
|
||||
if (numCameras === 0) {
|
||||
throw new Error("No cameras found");
|
||||
}
|
||||
if (numCameras === 1) {
|
||||
cameraSelectionContainer.style.display = "none";
|
||||
}
|
||||
else {
|
||||
var selectCameraString = strings_1.Html5QrcodeScannerStrings.selectCamera();
|
||||
cameraSelectionContainer.innerText
|
||||
= "".concat(selectCameraString, " (").concat(this.cameras.length, ") ");
|
||||
}
|
||||
var anonymousCameraId = 1;
|
||||
for (var _i = 0, _a = this.cameras; _i < _a.length; _i++) {
|
||||
var camera = _a[_i];
|
||||
var value = camera.id;
|
||||
var name_1 = camera.label == null ? value : camera.label;
|
||||
if (!name_1 || name_1 === "") {
|
||||
name_1 = [
|
||||
strings_1.Html5QrcodeScannerStrings.anonymousCameraPrefix(),
|
||||
anonymousCameraId++
|
||||
].join(" ");
|
||||
}
|
||||
var option = document.createElement("option");
|
||||
option.value = value;
|
||||
option.innerText = name_1;
|
||||
this.options.push(option);
|
||||
this.selectElement.appendChild(option);
|
||||
}
|
||||
cameraSelectionContainer.appendChild(this.selectElement);
|
||||
parentElement.appendChild(cameraSelectionContainer);
|
||||
};
|
||||
CameraSelectionUi.prototype.disable = function () {
|
||||
this.selectElement.disabled = true;
|
||||
};
|
||||
CameraSelectionUi.prototype.isDisabled = function () {
|
||||
return this.selectElement.disabled === true;
|
||||
};
|
||||
CameraSelectionUi.prototype.enable = function () {
|
||||
this.selectElement.disabled = false;
|
||||
};
|
||||
CameraSelectionUi.prototype.getValue = function () {
|
||||
return this.selectElement.value;
|
||||
};
|
||||
CameraSelectionUi.prototype.hasValue = function (value) {
|
||||
for (var _i = 0, _a = this.options; _i < _a.length; _i++) {
|
||||
var option = _a[_i];
|
||||
if (option.value === value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
CameraSelectionUi.prototype.setValue = function (value) {
|
||||
if (!this.hasValue(value)) {
|
||||
throw new Error("".concat(value, " is not present in the camera list."));
|
||||
}
|
||||
this.selectElement.value = value;
|
||||
};
|
||||
CameraSelectionUi.prototype.hasSingleItem = function () {
|
||||
return this.cameras.length === 1;
|
||||
};
|
||||
CameraSelectionUi.prototype.numCameras = function () {
|
||||
return this.cameras.length;
|
||||
};
|
||||
CameraSelectionUi.create = function (parentElement, cameras) {
|
||||
var cameraSelectUi = new CameraSelectionUi(cameras);
|
||||
cameraSelectUi.render(parentElement);
|
||||
return cameraSelectUi;
|
||||
};
|
||||
return CameraSelectionUi;
|
||||
}());
|
||||
exports.CameraSelectionUi = CameraSelectionUi;
|
||||
//# sourceMappingURL=camera-selection-ui.js.map
|
||||
1
node_modules/html5-qrcode/cjs/ui/scanner/camera-selection-ui.js.map
generated
vendored
Normal file
1
node_modules/html5-qrcode/cjs/ui/scanner/camera-selection-ui.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{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,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,UAAG,KAAK,wCAAqC,CAAC,CAAC;SAClE;QACD,IAAI,CAAC,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC;IACrC,CAAC;IAEM,yCAAa,GAApB;QACI,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC;IACrC,CAAC;IAEM,sCAAU,GAAjB;QACI,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC/B,CAAC;IAIa,wBAAM,GAApB,UACI,aAA0B,EAC1B,OAA4B;QAC5B,IAAI,cAAc,GAAG,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACpD,cAAc,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACrC,OAAO,cAAc,CAAC;IAC1B,CAAC;IACL,wBAAC;AAAD,CAAC,AA5GD,IA4GC;AA5GY,8CAAiB"}
|
||||
16
node_modules/html5-qrcode/cjs/ui/scanner/camera-zoom-ui.d.ts
generated
vendored
Normal file
16
node_modules/html5-qrcode/cjs/ui/scanner/camera-zoom-ui.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export type OnCameraZoomValueChangeCallback = (zoomValue: number) => void;
|
||||
export declare class CameraZoomUi {
|
||||
private zoomElementContainer;
|
||||
private rangeInput;
|
||||
private rangeText;
|
||||
private onChangeCallback;
|
||||
private constructor();
|
||||
private render;
|
||||
private onValueChange;
|
||||
setValues(minValue: number, maxValue: number, defaultValue: number, step: number): void;
|
||||
show(): void;
|
||||
hide(): void;
|
||||
setOnCameraZoomValueChangeCallback(onChangeCallback: OnCameraZoomValueChangeCallback): void;
|
||||
removeOnCameraZoomValueChangeCallback(): void;
|
||||
static create(parentElement: HTMLElement, renderOnCreate: boolean): CameraZoomUi;
|
||||
}
|
||||
73
node_modules/html5-qrcode/cjs/ui/scanner/camera-zoom-ui.js
generated
vendored
Normal file
73
node_modules/html5-qrcode/cjs/ui/scanner/camera-zoom-ui.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CameraZoomUi = void 0;
|
||||
var base_1 = require("./base");
|
||||
var strings_1 = require("../../strings");
|
||||
var CameraZoomUi = (function () {
|
||||
function CameraZoomUi() {
|
||||
this.onChangeCallback = null;
|
||||
this.zoomElementContainer = document.createElement("div");
|
||||
this.rangeInput = base_1.BaseUiElementFactory.createElement("input", base_1.PublicUiElementIdAndClasses.ZOOM_SLIDER_ID);
|
||||
this.rangeInput.type = "range";
|
||||
this.rangeText = document.createElement("span");
|
||||
this.rangeInput.min = "1";
|
||||
this.rangeInput.max = "5";
|
||||
this.rangeInput.value = "1";
|
||||
this.rangeInput.step = "0.1";
|
||||
}
|
||||
CameraZoomUi.prototype.render = function (parentElement, renderOnCreate) {
|
||||
this.zoomElementContainer.style.display
|
||||
= renderOnCreate ? "block" : "none";
|
||||
this.zoomElementContainer.style.padding = "5px 10px";
|
||||
this.zoomElementContainer.style.textAlign = "center";
|
||||
parentElement.appendChild(this.zoomElementContainer);
|
||||
this.rangeInput.style.display = "inline-block";
|
||||
this.rangeInput.style.width = "50%";
|
||||
this.rangeInput.style.height = "5px";
|
||||
this.rangeInput.style.background = "#d3d3d3";
|
||||
this.rangeInput.style.outline = "none";
|
||||
this.rangeInput.style.opacity = "0.7";
|
||||
var zoomString = strings_1.Html5QrcodeScannerStrings.zoom();
|
||||
this.rangeText.innerText = "".concat(this.rangeInput.value, "x ").concat(zoomString);
|
||||
this.rangeText.style.marginRight = "10px";
|
||||
var $this = this;
|
||||
this.rangeInput.addEventListener("input", function () { return $this.onValueChange(); });
|
||||
this.rangeInput.addEventListener("change", function () { return $this.onValueChange(); });
|
||||
this.zoomElementContainer.appendChild(this.rangeInput);
|
||||
this.zoomElementContainer.appendChild(this.rangeText);
|
||||
};
|
||||
CameraZoomUi.prototype.onValueChange = function () {
|
||||
var zoomString = strings_1.Html5QrcodeScannerStrings.zoom();
|
||||
this.rangeText.innerText = "".concat(this.rangeInput.value, "x ").concat(zoomString);
|
||||
if (this.onChangeCallback) {
|
||||
this.onChangeCallback(parseFloat(this.rangeInput.value));
|
||||
}
|
||||
};
|
||||
CameraZoomUi.prototype.setValues = function (minValue, maxValue, defaultValue, step) {
|
||||
this.rangeInput.min = minValue.toString();
|
||||
this.rangeInput.max = maxValue.toString();
|
||||
this.rangeInput.step = step.toString();
|
||||
this.rangeInput.value = defaultValue.toString();
|
||||
this.onValueChange();
|
||||
};
|
||||
CameraZoomUi.prototype.show = function () {
|
||||
this.zoomElementContainer.style.display = "block";
|
||||
};
|
||||
CameraZoomUi.prototype.hide = function () {
|
||||
this.zoomElementContainer.style.display = "none";
|
||||
};
|
||||
CameraZoomUi.prototype.setOnCameraZoomValueChangeCallback = function (onChangeCallback) {
|
||||
this.onChangeCallback = onChangeCallback;
|
||||
};
|
||||
CameraZoomUi.prototype.removeOnCameraZoomValueChangeCallback = function () {
|
||||
this.onChangeCallback = null;
|
||||
};
|
||||
CameraZoomUi.create = function (parentElement, renderOnCreate) {
|
||||
var cameraZoomUi = new CameraZoomUi();
|
||||
cameraZoomUi.render(parentElement, renderOnCreate);
|
||||
return cameraZoomUi;
|
||||
};
|
||||
return CameraZoomUi;
|
||||
}());
|
||||
exports.CameraZoomUi = CameraZoomUi;
|
||||
//# sourceMappingURL=camera-zoom-ui.js.map
|
||||
1
node_modules/html5-qrcode/cjs/ui/scanner/camera-zoom-ui.js.map
generated
vendored
Normal file
1
node_modules/html5-qrcode/cjs/ui/scanner/camera-zoom-ui.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"camera-zoom-ui.js","sourceRoot":"","sources":["../../../../src/ui/scanner/camera-zoom-ui.ts"],"names":[],"mappings":";;;AAUC,+BAGe;AAEhB,yCAA0D;AAM1D;IAQI;QAFQ,qBAAgB,GAA2C,IAAI,CAAC;QA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AAC,GAAG,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC1C,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QACvC,IAAI,CAAC,UAAU,CAAC,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;QAEhD,IAAI,CAAC,aAAa,EAAE,CAAC;IACzB,CAAC;IAEM,2BAAI,GAAX;QACI,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IACtD,CAAC;IAEM,2BAAI,GAAX;QACI,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;IACrD,CAAC;IAEM,yDAAkC,GAAzC,UACI,gBAAiD;QACjD,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC7C,CAAC;IAEM,4DAAqC,GAA5C;QACI,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IACjC,CAAC;IAOa,mBAAM,GAApB,UACI,aAA0B,EAC1B,cAAuB;QACvB,IAAI,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;QACtC,YAAY,CAAC,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;QACnD,OAAO,YAAY,CAAC;IACxB,CAAC;IACL,mBAAC;AAAD,CAAC,AAxGD,IAwGC;AAxGY,oCAAY"}
|
||||
19
node_modules/html5-qrcode/cjs/ui/scanner/file-selection-ui.d.ts
generated
vendored
Normal file
19
node_modules/html5-qrcode/cjs/ui/scanner/file-selection-ui.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
export type OnFileSelected = (file: File) => void;
|
||||
export declare class FileSelectionUi {
|
||||
private readonly fileBasedScanRegion;
|
||||
private readonly fileScanInput;
|
||||
private readonly fileSelectionButton;
|
||||
private constructor();
|
||||
hide(): void;
|
||||
show(): void;
|
||||
isShowing(): boolean;
|
||||
resetValue(): void;
|
||||
private createFileBasedScanRegion;
|
||||
private fileBasedScanRegionDefaultBorder;
|
||||
private fileBasedScanRegionActiveBorder;
|
||||
private createDragAndDropMessage;
|
||||
private setImageNameToButton;
|
||||
private setInitialValueToButton;
|
||||
private getFileScanInputId;
|
||||
static create(parentElement: HTMLDivElement, showOnRender: boolean, onFileSelected: OnFileSelected): FileSelectionUi;
|
||||
}
|
||||
170
node_modules/html5-qrcode/cjs/ui/scanner/file-selection-ui.js
generated
vendored
Normal file
170
node_modules/html5-qrcode/cjs/ui/scanner/file-selection-ui.js
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FileSelectionUi = void 0;
|
||||
var strings_1 = require("../../strings");
|
||||
var base_1 = require("./base");
|
||||
var FileSelectionUi = (function () {
|
||||
function FileSelectionUi(parentElement, showOnRender, onFileSelected) {
|
||||
this.fileBasedScanRegion = this.createFileBasedScanRegion();
|
||||
this.fileBasedScanRegion.style.display
|
||||
= showOnRender ? "block" : "none";
|
||||
parentElement.appendChild(this.fileBasedScanRegion);
|
||||
var fileScanLabel = document.createElement("label");
|
||||
fileScanLabel.setAttribute("for", this.getFileScanInputId());
|
||||
fileScanLabel.style.display = "inline-block";
|
||||
this.fileBasedScanRegion.appendChild(fileScanLabel);
|
||||
this.fileSelectionButton
|
||||
= base_1.BaseUiElementFactory.createElement("button", base_1.PublicUiElementIdAndClasses.FILE_SELECTION_BUTTON_ID);
|
||||
this.setInitialValueToButton();
|
||||
this.fileSelectionButton.addEventListener("click", function (_) {
|
||||
fileScanLabel.click();
|
||||
});
|
||||
fileScanLabel.append(this.fileSelectionButton);
|
||||
this.fileScanInput
|
||||
= base_1.BaseUiElementFactory.createElement("input", this.getFileScanInputId());
|
||||
this.fileScanInput.type = "file";
|
||||
this.fileScanInput.accept = "image/*";
|
||||
this.fileScanInput.style.display = "none";
|
||||
fileScanLabel.appendChild(this.fileScanInput);
|
||||
var $this = this;
|
||||
this.fileScanInput.addEventListener("change", function (e) {
|
||||
if (e == null || e.target == null) {
|
||||
return;
|
||||
}
|
||||
var target = e.target;
|
||||
if (target.files && target.files.length === 0) {
|
||||
return;
|
||||
}
|
||||
var fileList = target.files;
|
||||
var file = fileList[0];
|
||||
var fileName = file.name;
|
||||
$this.setImageNameToButton(fileName);
|
||||
onFileSelected(file);
|
||||
});
|
||||
var dragAndDropMessage = this.createDragAndDropMessage();
|
||||
this.fileBasedScanRegion.appendChild(dragAndDropMessage);
|
||||
this.fileBasedScanRegion.addEventListener("dragenter", function (event) {
|
||||
$this.fileBasedScanRegion.style.border
|
||||
= $this.fileBasedScanRegionActiveBorder();
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
});
|
||||
this.fileBasedScanRegion.addEventListener("dragleave", function (event) {
|
||||
$this.fileBasedScanRegion.style.border
|
||||
= $this.fileBasedScanRegionDefaultBorder();
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
});
|
||||
this.fileBasedScanRegion.addEventListener("dragover", function (event) {
|
||||
$this.fileBasedScanRegion.style.border
|
||||
= $this.fileBasedScanRegionActiveBorder();
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
});
|
||||
this.fileBasedScanRegion.addEventListener("drop", function (event) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
$this.fileBasedScanRegion.style.border
|
||||
= $this.fileBasedScanRegionDefaultBorder();
|
||||
var dataTransfer = event.dataTransfer;
|
||||
if (dataTransfer) {
|
||||
var files = dataTransfer.files;
|
||||
if (!files || files.length === 0) {
|
||||
return;
|
||||
}
|
||||
var isAnyFileImage = false;
|
||||
for (var i = 0; i < files.length; ++i) {
|
||||
var file = files.item(i);
|
||||
if (!file) {
|
||||
continue;
|
||||
}
|
||||
var imageType = /image.*/;
|
||||
if (!file.type.match(imageType)) {
|
||||
continue;
|
||||
}
|
||||
isAnyFileImage = true;
|
||||
var fileName = file.name;
|
||||
$this.setImageNameToButton(fileName);
|
||||
onFileSelected(file);
|
||||
dragAndDropMessage.innerText
|
||||
= strings_1.Html5QrcodeScannerStrings.dragAndDropMessage();
|
||||
break;
|
||||
}
|
||||
if (!isAnyFileImage) {
|
||||
dragAndDropMessage.innerText
|
||||
= strings_1.Html5QrcodeScannerStrings
|
||||
.dragAndDropMessageOnlyImages();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
FileSelectionUi.prototype.hide = function () {
|
||||
this.fileBasedScanRegion.style.display = "none";
|
||||
this.fileScanInput.disabled = true;
|
||||
};
|
||||
FileSelectionUi.prototype.show = function () {
|
||||
this.fileBasedScanRegion.style.display = "block";
|
||||
this.fileScanInput.disabled = false;
|
||||
};
|
||||
FileSelectionUi.prototype.isShowing = function () {
|
||||
return this.fileBasedScanRegion.style.display === "block";
|
||||
};
|
||||
FileSelectionUi.prototype.resetValue = function () {
|
||||
this.fileScanInput.value = "";
|
||||
this.setInitialValueToButton();
|
||||
};
|
||||
FileSelectionUi.prototype.createFileBasedScanRegion = function () {
|
||||
var fileBasedScanRegion = document.createElement("div");
|
||||
fileBasedScanRegion.style.textAlign = "center";
|
||||
fileBasedScanRegion.style.margin = "auto";
|
||||
fileBasedScanRegion.style.width = "80%";
|
||||
fileBasedScanRegion.style.maxWidth = "600px";
|
||||
fileBasedScanRegion.style.border
|
||||
= this.fileBasedScanRegionDefaultBorder();
|
||||
fileBasedScanRegion.style.padding = "10px";
|
||||
fileBasedScanRegion.style.marginBottom = "10px";
|
||||
return fileBasedScanRegion;
|
||||
};
|
||||
FileSelectionUi.prototype.fileBasedScanRegionDefaultBorder = function () {
|
||||
return "6px dashed #ebebeb";
|
||||
};
|
||||
FileSelectionUi.prototype.fileBasedScanRegionActiveBorder = function () {
|
||||
return "6px dashed rgb(153 151 151)";
|
||||
};
|
||||
FileSelectionUi.prototype.createDragAndDropMessage = function () {
|
||||
var dragAndDropMessage = document.createElement("div");
|
||||
dragAndDropMessage.innerText
|
||||
= strings_1.Html5QrcodeScannerStrings.dragAndDropMessage();
|
||||
dragAndDropMessage.style.fontWeight = "400";
|
||||
return dragAndDropMessage;
|
||||
};
|
||||
FileSelectionUi.prototype.setImageNameToButton = function (imageFileName) {
|
||||
var MAX_CHARS = 20;
|
||||
if (imageFileName.length > MAX_CHARS) {
|
||||
var start8Chars = imageFileName.substring(0, 8);
|
||||
var length_1 = imageFileName.length;
|
||||
var last8Chars = imageFileName.substring(length_1 - 8, length_1);
|
||||
imageFileName = "".concat(start8Chars, "....").concat(last8Chars);
|
||||
}
|
||||
var newText = strings_1.Html5QrcodeScannerStrings.fileSelectionChooseAnother()
|
||||
+ " - "
|
||||
+ imageFileName;
|
||||
this.fileSelectionButton.innerText = newText;
|
||||
};
|
||||
FileSelectionUi.prototype.setInitialValueToButton = function () {
|
||||
var initialText = strings_1.Html5QrcodeScannerStrings.fileSelectionChooseImage()
|
||||
+ " - "
|
||||
+ strings_1.Html5QrcodeScannerStrings.fileSelectionNoImageSelected();
|
||||
this.fileSelectionButton.innerText = initialText;
|
||||
};
|
||||
FileSelectionUi.prototype.getFileScanInputId = function () {
|
||||
return "html5-qrcode-private-filescan-input";
|
||||
};
|
||||
FileSelectionUi.create = function (parentElement, showOnRender, onFileSelected) {
|
||||
var button = new FileSelectionUi(parentElement, showOnRender, onFileSelected);
|
||||
return button;
|
||||
};
|
||||
return FileSelectionUi;
|
||||
}());
|
||||
exports.FileSelectionUi = FileSelectionUi;
|
||||
//# sourceMappingURL=file-selection-ui.js.map
|
||||
1
node_modules/html5-qrcode/cjs/ui/scanner/file-selection-ui.js.map
generated
vendored
Normal file
1
node_modules/html5-qrcode/cjs/ui/scanner/file-selection-ui.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
11
node_modules/html5-qrcode/cjs/ui/scanner/scan-type-selector.d.ts
generated
vendored
Normal file
11
node_modules/html5-qrcode/cjs/ui/scanner/scan-type-selector.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Html5QrcodeScanType } from "../../core";
|
||||
export declare class ScanTypeSelector {
|
||||
private supportedScanTypes;
|
||||
constructor(supportedScanTypes?: Array<Html5QrcodeScanType> | []);
|
||||
getDefaultScanType(): Html5QrcodeScanType;
|
||||
hasMoreThanOneScanType(): boolean;
|
||||
isCameraScanRequired(): boolean;
|
||||
static isCameraScanType(scanType: Html5QrcodeScanType): boolean;
|
||||
static isFileScanType(scanType: Html5QrcodeScanType): boolean;
|
||||
private validateAndReturnScanTypes;
|
||||
}
|
||||
51
node_modules/html5-qrcode/cjs/ui/scanner/scan-type-selector.js
generated
vendored
Normal file
51
node_modules/html5-qrcode/cjs/ui/scanner/scan-type-selector.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ScanTypeSelector = void 0;
|
||||
var core_1 = require("../../core");
|
||||
var ScanTypeSelector = (function () {
|
||||
function ScanTypeSelector(supportedScanTypes) {
|
||||
this.supportedScanTypes = this.validateAndReturnScanTypes(supportedScanTypes);
|
||||
}
|
||||
ScanTypeSelector.prototype.getDefaultScanType = function () {
|
||||
return this.supportedScanTypes[0];
|
||||
};
|
||||
ScanTypeSelector.prototype.hasMoreThanOneScanType = function () {
|
||||
return this.supportedScanTypes.length > 1;
|
||||
};
|
||||
ScanTypeSelector.prototype.isCameraScanRequired = function () {
|
||||
for (var _i = 0, _a = this.supportedScanTypes; _i < _a.length; _i++) {
|
||||
var scanType = _a[_i];
|
||||
if (ScanTypeSelector.isCameraScanType(scanType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
ScanTypeSelector.isCameraScanType = function (scanType) {
|
||||
return scanType === core_1.Html5QrcodeScanType.SCAN_TYPE_CAMERA;
|
||||
};
|
||||
ScanTypeSelector.isFileScanType = function (scanType) {
|
||||
return scanType === core_1.Html5QrcodeScanType.SCAN_TYPE_FILE;
|
||||
};
|
||||
ScanTypeSelector.prototype.validateAndReturnScanTypes = function (supportedScanTypes) {
|
||||
if (!supportedScanTypes || supportedScanTypes.length === 0) {
|
||||
return core_1.Html5QrcodeConstants.DEFAULT_SUPPORTED_SCAN_TYPE;
|
||||
}
|
||||
var maxExpectedValues = core_1.Html5QrcodeConstants.DEFAULT_SUPPORTED_SCAN_TYPE.length;
|
||||
if (supportedScanTypes.length > maxExpectedValues) {
|
||||
throw "Max ".concat(maxExpectedValues, " values expected for ")
|
||||
+ "supportedScanTypes";
|
||||
}
|
||||
for (var _i = 0, supportedScanTypes_1 = supportedScanTypes; _i < supportedScanTypes_1.length; _i++) {
|
||||
var scanType = supportedScanTypes_1[_i];
|
||||
if (!core_1.Html5QrcodeConstants.DEFAULT_SUPPORTED_SCAN_TYPE
|
||||
.includes(scanType)) {
|
||||
throw "Unsupported scan type ".concat(scanType);
|
||||
}
|
||||
}
|
||||
return supportedScanTypes;
|
||||
};
|
||||
return ScanTypeSelector;
|
||||
}());
|
||||
exports.ScanTypeSelector = ScanTypeSelector;
|
||||
//# sourceMappingURL=scan-type-selector.js.map
|
||||
1
node_modules/html5-qrcode/cjs/ui/scanner/scan-type-selector.js.map
generated
vendored
Normal file
1
node_modules/html5-qrcode/cjs/ui/scanner/scan-type-selector.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"scan-type-selector.js","sourceRoot":"","sources":["../../../../src/ui/scanner/scan-type-selector.ts"],"names":[],"mappings":";;;AAUA,mCAGoB;AAGpB;IAGI,0BAAY,kBAAoD;QAC5D,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,0BAA0B,CACrD,kBAAkB,CAAC,CAAC;IAC5B,CAAC;IAMM,6CAAkB,GAAzB;QACI,OAAO,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC;IAMM,iDAAsB,GAA7B;QACI,OAAO,IAAI,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9C,CAAC;IAGM,+CAAoB,GAA3B;QACI,KAAuB,UAAuB,EAAvB,KAAA,IAAI,CAAC,kBAAkB,EAAvB,cAAuB,EAAvB,IAAuB,EAAE;YAA3C,IAAM,QAAQ,SAAA;YACf,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE;gBAC7C,OAAO,IAAI,CAAC;aACf;SACJ;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAGa,iCAAgB,GAA9B,UAA+B,QAA6B;QACxD,OAAO,QAAQ,KAAK,0BAAmB,CAAC,gBAAgB,CAAC;IAC7D,CAAC;IAGa,+BAAc,GAA5B,UAA6B,QAA6B;QACtD,OAAO,QAAQ,KAAK,0BAAmB,CAAC,cAAc,CAAC;IAC3D,CAAC;IAQO,qDAA0B,GAAlC,UACI,kBAA8C;QAG9C,IAAI,CAAC,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE;YACxD,OAAO,2BAAoB,CAAC,2BAA2B,CAAC;SAC3D;QAGD,IAAI,iBAAiB,GACf,2BAAoB,CAAC,2BAA2B,CAAC,MAAM,CAAC;QAC9D,IAAI,kBAAkB,CAAC,MAAM,GAAG,iBAAiB,EAAE;YAC/C,MAAM,cAAO,iBAAiB,0BAAuB;kBAC/C,oBAAoB,CAAC;SAC9B;QAGD,KAAuB,UAAkB,EAAlB,yCAAkB,EAAlB,gCAAkB,EAAlB,IAAkB,EAAE;YAAtC,IAAM,QAAQ,2BAAA;YACf,IAAI,CAAC,2BAAoB,CAAC,2BAA2B;iBAC5C,QAAQ,CAAC,QAAQ,CAAC,EAAE;gBACzB,MAAM,gCAAyB,QAAQ,CAAE,CAAC;aAC7C;SACJ;QAED,OAAO,kBAAkB,CAAC;IAC9B,CAAC;IAEL,uBAAC;AAAD,CAAC,AA7ED,IA6EC;AA7EY,4CAAgB"}
|
||||
28
node_modules/html5-qrcode/cjs/ui/scanner/torch-button.d.ts
generated
vendored
Normal file
28
node_modules/html5-qrcode/cjs/ui/scanner/torch-button.d.ts
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import { BooleanCameraCapability } from "../../camera/core";
|
||||
export type OnTorchActionFailureCallback = (failureMessage: string) => void;
|
||||
interface TorchButtonController {
|
||||
disable(): void;
|
||||
enable(): void;
|
||||
setText(text: string): void;
|
||||
}
|
||||
export interface TorchButtonOptions {
|
||||
display: string;
|
||||
marginLeft: string;
|
||||
}
|
||||
export declare class TorchButton implements TorchButtonController {
|
||||
private readonly torchButton;
|
||||
private readonly onTorchActionFailureCallback;
|
||||
private torchController;
|
||||
private constructor();
|
||||
private render;
|
||||
updateTorchCapability(torchCapability: BooleanCameraCapability): void;
|
||||
getTorchButton(): HTMLButtonElement;
|
||||
hide(): void;
|
||||
show(): void;
|
||||
disable(): void;
|
||||
enable(): void;
|
||||
setText(text: string): void;
|
||||
reset(): void;
|
||||
static create(parentElement: HTMLElement, torchCapability: BooleanCameraCapability, torchButtonOptions: TorchButtonOptions, onTorchActionFailureCallback: OnTorchActionFailureCallback): TorchButton;
|
||||
}
|
||||
export {};
|
||||
171
node_modules/html5-qrcode/cjs/ui/scanner/torch-button.js
generated
vendored
Normal file
171
node_modules/html5-qrcode/cjs/ui/scanner/torch-button.js
generated
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TorchButton = void 0;
|
||||
var strings_1 = require("../../strings");
|
||||
var base_1 = require("./base");
|
||||
var TorchController = (function () {
|
||||
function TorchController(torchCapability, buttonController, onTorchActionFailureCallback) {
|
||||
this.isTorchOn = false;
|
||||
this.torchCapability = torchCapability;
|
||||
this.buttonController = buttonController;
|
||||
this.onTorchActionFailureCallback = onTorchActionFailureCallback;
|
||||
}
|
||||
TorchController.prototype.isTorchEnabled = function () {
|
||||
return this.isTorchOn;
|
||||
};
|
||||
TorchController.prototype.flipState = function () {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var isTorchOnExpected, error_1;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
this.buttonController.disable();
|
||||
isTorchOnExpected = !this.isTorchOn;
|
||||
_a.label = 1;
|
||||
case 1:
|
||||
_a.trys.push([1, 3, , 4]);
|
||||
return [4, this.torchCapability.apply(isTorchOnExpected)];
|
||||
case 2:
|
||||
_a.sent();
|
||||
this.updateUiBasedOnLatestSettings(this.torchCapability.value(), isTorchOnExpected);
|
||||
return [3, 4];
|
||||
case 3:
|
||||
error_1 = _a.sent();
|
||||
this.propagateFailure(isTorchOnExpected, error_1);
|
||||
this.buttonController.enable();
|
||||
return [3, 4];
|
||||
case 4: return [2];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
TorchController.prototype.updateUiBasedOnLatestSettings = function (isTorchOn, isTorchOnExpected) {
|
||||
if (isTorchOn === isTorchOnExpected) {
|
||||
this.buttonController.setText(isTorchOnExpected
|
||||
? strings_1.Html5QrcodeScannerStrings.torchOffButton()
|
||||
: strings_1.Html5QrcodeScannerStrings.torchOnButton());
|
||||
this.isTorchOn = isTorchOnExpected;
|
||||
}
|
||||
else {
|
||||
this.propagateFailure(isTorchOnExpected);
|
||||
}
|
||||
this.buttonController.enable();
|
||||
};
|
||||
TorchController.prototype.propagateFailure = function (isTorchOnExpected, error) {
|
||||
var errorMessage = isTorchOnExpected
|
||||
? strings_1.Html5QrcodeScannerStrings.torchOnFailedMessage()
|
||||
: strings_1.Html5QrcodeScannerStrings.torchOffFailedMessage();
|
||||
if (error) {
|
||||
errorMessage += "; Error = " + error;
|
||||
}
|
||||
this.onTorchActionFailureCallback(errorMessage);
|
||||
};
|
||||
TorchController.prototype.reset = function () {
|
||||
this.isTorchOn = false;
|
||||
};
|
||||
return TorchController;
|
||||
}());
|
||||
var TorchButton = (function () {
|
||||
function TorchButton(torchCapability, onTorchActionFailureCallback) {
|
||||
this.onTorchActionFailureCallback = onTorchActionFailureCallback;
|
||||
this.torchButton
|
||||
= base_1.BaseUiElementFactory.createElement("button", base_1.PublicUiElementIdAndClasses.TORCH_BUTTON_ID);
|
||||
this.torchController = new TorchController(torchCapability, this, onTorchActionFailureCallback);
|
||||
}
|
||||
TorchButton.prototype.render = function (parentElement, torchButtonOptions) {
|
||||
var _this = this;
|
||||
this.torchButton.innerText
|
||||
= strings_1.Html5QrcodeScannerStrings.torchOnButton();
|
||||
this.torchButton.style.display = torchButtonOptions.display;
|
||||
this.torchButton.style.marginLeft = torchButtonOptions.marginLeft;
|
||||
var $this = this;
|
||||
this.torchButton.addEventListener("click", function (_) { return __awaiter(_this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4, $this.torchController.flipState()];
|
||||
case 1:
|
||||
_a.sent();
|
||||
if ($this.torchController.isTorchEnabled()) {
|
||||
$this.torchButton.classList.remove(base_1.PublicUiElementIdAndClasses.TORCH_BUTTON_CLASS_TORCH_OFF);
|
||||
$this.torchButton.classList.add(base_1.PublicUiElementIdAndClasses.TORCH_BUTTON_CLASS_TORCH_ON);
|
||||
}
|
||||
else {
|
||||
$this.torchButton.classList.remove(base_1.PublicUiElementIdAndClasses.TORCH_BUTTON_CLASS_TORCH_ON);
|
||||
$this.torchButton.classList.add(base_1.PublicUiElementIdAndClasses.TORCH_BUTTON_CLASS_TORCH_OFF);
|
||||
}
|
||||
return [2];
|
||||
}
|
||||
});
|
||||
}); });
|
||||
parentElement.appendChild(this.torchButton);
|
||||
};
|
||||
TorchButton.prototype.updateTorchCapability = function (torchCapability) {
|
||||
this.torchController = new TorchController(torchCapability, this, this.onTorchActionFailureCallback);
|
||||
};
|
||||
TorchButton.prototype.getTorchButton = function () {
|
||||
return this.torchButton;
|
||||
};
|
||||
TorchButton.prototype.hide = function () {
|
||||
this.torchButton.style.display = "none";
|
||||
};
|
||||
TorchButton.prototype.show = function () {
|
||||
this.torchButton.style.display = "inline-block";
|
||||
};
|
||||
TorchButton.prototype.disable = function () {
|
||||
this.torchButton.disabled = true;
|
||||
};
|
||||
TorchButton.prototype.enable = function () {
|
||||
this.torchButton.disabled = false;
|
||||
};
|
||||
TorchButton.prototype.setText = function (text) {
|
||||
this.torchButton.innerText = text;
|
||||
};
|
||||
TorchButton.prototype.reset = function () {
|
||||
this.torchButton.innerText = strings_1.Html5QrcodeScannerStrings.torchOnButton();
|
||||
this.torchController.reset();
|
||||
};
|
||||
TorchButton.create = function (parentElement, torchCapability, torchButtonOptions, onTorchActionFailureCallback) {
|
||||
var button = new TorchButton(torchCapability, onTorchActionFailureCallback);
|
||||
button.render(parentElement, torchButtonOptions);
|
||||
return button;
|
||||
};
|
||||
return TorchButton;
|
||||
}());
|
||||
exports.TorchButton = TorchButton;
|
||||
//# sourceMappingURL=torch-button.js.map
|
||||
1
node_modules/html5-qrcode/cjs/ui/scanner/torch-button.js.map
generated
vendored
Normal file
1
node_modules/html5-qrcode/cjs/ui/scanner/torch-button.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"torch-button.js","sourceRoot":"","sources":["../../../../src/ui/scanner/torch-button.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,yCAA0D;AAC1D,+BAGgB;AAehB;IAQI,yBACI,eAAwC,EACxC,gBAAuC,EACvC,4BAA0D;QALtD,cAAS,GAAY,KAAK,CAAC;QAM/B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,4BAA4B,GAAG,4BAA4B,CAAC;IACrE,CAAC;IAGM,wCAAc,GAArB;QACI,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAUY,mCAAS,GAAtB;;;;;;wBAC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