@capacitor/barcode-scanner 2.2.3 → 2.2.5
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/Package.swift +1 -1
- package/README.md +1 -1
- package/dist/esm/web.js +12 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +12 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +12 -1
- package/dist/plugin.js.map +1 -1
- package/package.json +2 -2
package/Package.swift
CHANGED
|
@@ -11,7 +11,7 @@ let package = Package(
|
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
13
|
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"),
|
|
14
|
-
.package(url: "https://github.com/OutSystems/OSBarcodeLib-iOS.git", exact: "2.1.
|
|
14
|
+
.package(url: "https://github.com/OutSystems/OSBarcodeLib-iOS.git", exact: "2.1.1")
|
|
15
15
|
],
|
|
16
16
|
targets: [
|
|
17
17
|
.target(
|
package/README.md
CHANGED
package/dist/esm/web.js
CHANGED
|
@@ -41,6 +41,7 @@ export class CapacitorBarcodeScannerWeb extends WebPlugin {
|
|
|
41
41
|
const caposbarcodescannercontainerdialoginner = document.createElement('div');
|
|
42
42
|
caposbarcodescannercontainerdialoginner.className = 'scanner-dialog-inner';
|
|
43
43
|
const caposbarcodescannercontainerdialoginnerclose = document.createElement('span');
|
|
44
|
+
caposbarcodescannercontainerdialoginnerclose.id = 'cap-os-barcode-scanner-close-button';
|
|
44
45
|
caposbarcodescannercontainerdialoginnerclose.className = 'close-button';
|
|
45
46
|
caposbarcodescannercontainerdialoginnerclose.innerHTML = '×';
|
|
46
47
|
caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnerclose);
|
|
@@ -53,7 +54,6 @@ export class CapacitorBarcodeScannerWeb extends WebPlugin {
|
|
|
53
54
|
caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainer);
|
|
54
55
|
caposbarcodescannercontainerdialog.appendChild(caposbarcodescannercontainerdialoginner);
|
|
55
56
|
caposbarcodescannercontainer.appendChild(caposbarcodescannercontainerdialog);
|
|
56
|
-
caposbarcodescannercontainerdialoginnerclose.onclick = this.stopAndHideScanner;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* Initiates a barcode scan using the user's camera and HTML5 QR code scanner.
|
|
@@ -80,6 +80,17 @@ export class CapacitorBarcodeScannerWeb extends WebPlugin {
|
|
|
80
80
|
typeHint: options.hint === 17 ? undefined : options.hint,
|
|
81
81
|
scannerFPS: ((_b = options.web) === null || _b === void 0 ? void 0 : _b.scannerFPS) ? options.web.scannerFPS : 50,
|
|
82
82
|
};
|
|
83
|
+
let alreadyCancelled = false;
|
|
84
|
+
const closeButton = document.getElementById('cap-os-barcode-scanner-close-button');
|
|
85
|
+
if (closeButton) {
|
|
86
|
+
closeButton.onclick = async () => {
|
|
87
|
+
if (alreadyCancelled)
|
|
88
|
+
return;
|
|
89
|
+
alreadyCancelled = true;
|
|
90
|
+
await this.stopAndHideScanner();
|
|
91
|
+
reject(new Error('Couldn’t scan because the process was cancelled.'));
|
|
92
|
+
};
|
|
93
|
+
}
|
|
83
94
|
// Set up and start the scanner
|
|
84
95
|
const scannerElement = document.getElementById('cap-os-barcode-scanner-container-scanner');
|
|
85
96
|
if (!scannerElement) {
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAO3C,OAAO,EAAE,sCAAsC,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAExG;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,SAAS;IACvD;;;;OAIG;IACK,KAAK,CAAC,kBAAkB;QAC9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AK,EAAE,IAAI,EAAE;oBACjC,QAAQ,EAAE,SAAS;oBACnB,UAAU,EAAE,KAAK,CAAC,UAAU;iBAC7B;aACF,CAAC;YAEF,8CAA8C;YAC9C,MAAM,kCAAkC,GAAG,CAAC,WAAmB,EAAE,aAAgC,EAAE,EAAE;;gBACnG,IAAI,CAAC,kBAAkB,EAAE,CAAC;gBAC1B,OAAO,CAAC;oBACN,UAAU,EAAE,WAAW;oBACvB,MAAM,EAAE,MAAA,MAAA,aAAa,CAAC,MAAM,CAAC,MAAM,0CAAE,MAAM,mCAAI,+BAA+B,CAAC,GAAG;iBACnF,CAAC,CAAC;YACL,CAAC,CAAC;YAEF,MAAM,gCAAgC,GAAG,CAAC,KAAa,EAAE,EAAE;gBACzD,MAAM,aAAa,GAAG;oBACpB,mBAAmB;oBACnB,gCAAgC;oBAChC,qDAAqD;iBACtD,CAAC;gBAEF,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;oBACxD,IAAI,CAAC,kBAAkB,EAAE,CAAC;oBAC1B,OAAO,CAAC,KAAK,CAAC,uBAAuB,KAAK,EAAE,CAAC,CAAC;oBAC9C,MAAM,CAAC,KAAK,CAAC,CAAC;gBAChB,CAAC;YACH,CAAC,CAAC;YAED,MAAc,CAAC,mBAAmB,CAAC,KAAK,CACvC,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,EAChC,iBAAiB,EACjB,kCAAkC,EAClC,gCAAgC,CACjC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { Html5QrcodeResult } from 'html5-qrcode';\nimport { Html5Qrcode } from 'html5-qrcode';\n\nimport type {\n CapacitorBarcodeScannerPlugin,\n CapacitorBarcodeScannerOptions,\n CapacitorBarcodeScannerScanResult,\n} from './definitions';\nimport { CapacitorBarcodeScannerScanOrientation, CapacitorBarcodeScannerTypeHint } from './definitions';\n\n/**\n * Implements OSBarcodePlugin to provide web functionality for barcode scanning.\n */\nexport class CapacitorBarcodeScannerWeb extends WebPlugin implements CapacitorBarcodeScannerPlugin {\n /**\n * Stops the barcode scanner and hides its UI.\n * @private\n * @returns {Promise<void>} A promise that resolves when the scanner has stopped and its UI is hidden.\n */\n private async stopAndHideScanner(): Promise<void> {\n console.log((window as any).OSBarcodeWebScanner);\n if ((window as any).OSBarcodeWebScanner) {\n await (window as any).OSBarcodeWebScanner.stop();\n (window as any).OSBarcodeWebScanner = null;\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container-dialog')!.style.display = 'none';\n }\n\n /**\n * Builds the HTML elements necessary for the barcode scanner UI.\n * This method checks if the scanner container exists before creating it to avoid duplicates.\n * It also sets up the close button to stop and hide the scanner on click.\n * @private\n */\n private buildScannerElement(): void {\n if (document.getElementById('cap-os-barcode-scanner-container')) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container')!.className = 'scanner-container-display';\n return;\n }\n // Create and configure scanner container elements\n const caposbarcodescannercontainer = document.body.appendChild(document.createElement('div'));\n caposbarcodescannercontainer.id = 'cap-os-barcode-scanner-container';\n const caposbarcodescannercontainerdialog = document.createElement('div');\n caposbarcodescannercontainerdialog.id = 'cap-os-barcode-scanner-container-dialog';\n caposbarcodescannercontainerdialog.className = 'scanner-dialog';\n\n // Inner dialog elements including the close button and scanner view\n const caposbarcodescannercontainerdialoginner = document.createElement('div');\n caposbarcodescannercontainerdialoginner.className = 'scanner-dialog-inner';\n\n const caposbarcodescannercontainerdialoginnerclose = document.createElement('span');\n caposbarcodescannercontainerdialoginnerclose.className = 'close-button';\n caposbarcodescannercontainerdialoginnerclose.innerHTML = '×';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnerclose);\n\n const caposbarcodescannercontainerdialoginnercontainerp = document.createElement('p');\n caposbarcodescannercontainerdialoginnercontainerp.innerHTML = ' ';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainerp);\n\n const caposbarcodescannercontainerdialoginnercontainer = document.createElement('div');\n caposbarcodescannercontainerdialoginnercontainer.className = 'scanner-container-full-width';\n caposbarcodescannercontainerdialoginnercontainer.id = 'cap-os-barcode-scanner-container-scanner';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainer);\n\n caposbarcodescannercontainerdialog.appendChild(caposbarcodescannercontainerdialoginner);\n caposbarcodescannercontainer.appendChild(caposbarcodescannercontainerdialog);\n\n caposbarcodescannercontainerdialoginnerclose.onclick = this.stopAndHideScanner;\n }\n\n /**\n * Initiates a barcode scan using the user's camera and HTML5 QR code scanner.\n * Displays the scanner UI and waits for a scan to complete or fail.\n * @param {OSBarcodeScanOptions} options Configuration options for the scan, including camera direction and UI preferences.\n * @returns {Promise<OSBarcodeScanResult>} A promise that resolves with the scan result or rejects with an error.\n */\n async scanBarcode(options: CapacitorBarcodeScannerOptions): Promise<CapacitorBarcodeScannerScanResult> {\n this.buildScannerElement();\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container-dialog')!.style.display = 'block';\n return new Promise((resolve, reject) => {\n const param = {\n facingMode: options.cameraDirection === 1 ? 'environment' : 'user',\n hasScannerButton: false,\n scanButton: options.scanButton === undefined ? false : options.scanButton,\n showScanLine: false,\n scanInstructions: options.scanInstructions ? options.scanInstructions : '',\n orientation: options.scanOrientation\n ? options.scanOrientation\n : CapacitorBarcodeScannerScanOrientation.PORTRAIT,\n showCameraSelection: options.web?.showCameraSelection ? options.web.showCameraSelection : false,\n typeHint: options.hint === 17 ? undefined : options.hint,\n scannerFPS: options.web?.scannerFPS ? options.web.scannerFPS : 50,\n };\n\n // Set up and start the scanner\n const scannerElement = document.getElementById('cap-os-barcode-scanner-container-scanner');\n if (!scannerElement) {\n throw new Error('Scanner Element is required for web');\n }\n\n (window as any).OSBarcodeWebScanner = new Html5Qrcode(scannerElement.id, {\n formatsToSupport: param.typeHint !== undefined ? [param.typeHint] : undefined,\n verbose: undefined,\n });\n const Html5QrcodeConfig = {\n fps: param.scannerFPS,\n qrbox: scannerElement.getBoundingClientRect().width * (9 / 16) - 10,\n aspectRatio: 16 / 9,\n videoConstraints: {\n focusMode: 'continuous',\n height: { min: 576, ideal: 1920 },\n deviceId: undefined,\n facingMode: param.facingMode,\n },\n };\n\n // Success and error callbacks for the scanner\n const OSBarcodeWebScannerSuccessCallback = (decodedText: string, decodedResult: Html5QrcodeResult) => {\n this.stopAndHideScanner();\n resolve({\n ScanResult: decodedText,\n format: decodedResult.result.format?.format ?? CapacitorBarcodeScannerTypeHint.ALL,\n });\n };\n\n const OSBarcodeWebScannerErrorCallback = (error: string) => {\n const allowedErrors = [\n 'NotFoundException',\n 'No barcode or QR code detected',\n 'No MultiFormat Readers were able to detect the code',\n ];\n\n if (!allowedErrors.find((e) => error.indexOf(e) !== -1)) {\n this.stopAndHideScanner();\n console.error(`[Scanner Web Error] ${error}`);\n reject(error);\n }\n };\n\n (window as any).OSBarcodeWebScanner.start(\n { facingMode: param.facingMode },\n Html5QrcodeConfig,\n OSBarcodeWebScannerSuccessCallback,\n OSBarcodeWebScannerErrorCallback\n );\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAO3C,OAAO,EAAE,sCAAsC,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAExG;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,SAAS;IACvD;;;;OAIG;IACK,KAAK,CAAC,kBAAkB;QAC9B,OAAO,CAAC,GAAG,CA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,MAAc,CAAC,mBAAmB,CAAC,KAAK,CACvC,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,EAChC,iBAAiB,EACjB,kCAAkC,EAClC,gCAAgC,CACjC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { Html5QrcodeResult } from 'html5-qrcode';\nimport { Html5Qrcode } from 'html5-qrcode';\n\nimport type {\n CapacitorBarcodeScannerPlugin,\n CapacitorBarcodeScannerOptions,\n CapacitorBarcodeScannerScanResult,\n} from './definitions';\nimport { CapacitorBarcodeScannerScanOrientation, CapacitorBarcodeScannerTypeHint } from './definitions';\n\n/**\n * Implements OSBarcodePlugin to provide web functionality for barcode scanning.\n */\nexport class CapacitorBarcodeScannerWeb extends WebPlugin implements CapacitorBarcodeScannerPlugin {\n /**\n * Stops the barcode scanner and hides its UI.\n * @private\n * @returns {Promise<void>} A promise that resolves when the scanner has stopped and its UI is hidden.\n */\n private async stopAndHideScanner(): Promise<void> {\n console.log((window as any).OSBarcodeWebScanner);\n if ((window as any).OSBarcodeWebScanner) {\n await (window as any).OSBarcodeWebScanner.stop();\n (window as any).OSBarcodeWebScanner = null;\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container-dialog')!.style.display = 'none';\n }\n\n /**\n * Builds the HTML elements necessary for the barcode scanner UI.\n * This method checks if the scanner container exists before creating it to avoid duplicates.\n * It also sets up the close button to stop and hide the scanner on click.\n * @private\n */\n private buildScannerElement(): void {\n if (document.getElementById('cap-os-barcode-scanner-container')) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container')!.className = 'scanner-container-display';\n return;\n }\n // Create and configure scanner container elements\n const caposbarcodescannercontainer = document.body.appendChild(document.createElement('div'));\n caposbarcodescannercontainer.id = 'cap-os-barcode-scanner-container';\n const caposbarcodescannercontainerdialog = document.createElement('div');\n caposbarcodescannercontainerdialog.id = 'cap-os-barcode-scanner-container-dialog';\n caposbarcodescannercontainerdialog.className = 'scanner-dialog';\n\n // Inner dialog elements including the close button and scanner view\n const caposbarcodescannercontainerdialoginner = document.createElement('div');\n caposbarcodescannercontainerdialoginner.className = 'scanner-dialog-inner';\n\n const caposbarcodescannercontainerdialoginnerclose = document.createElement('span');\n caposbarcodescannercontainerdialoginnerclose.id = 'cap-os-barcode-scanner-close-button';\n caposbarcodescannercontainerdialoginnerclose.className = 'close-button';\n caposbarcodescannercontainerdialoginnerclose.innerHTML = '×';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnerclose);\n\n const caposbarcodescannercontainerdialoginnercontainerp = document.createElement('p');\n caposbarcodescannercontainerdialoginnercontainerp.innerHTML = ' ';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainerp);\n\n const caposbarcodescannercontainerdialoginnercontainer = document.createElement('div');\n caposbarcodescannercontainerdialoginnercontainer.className = 'scanner-container-full-width';\n caposbarcodescannercontainerdialoginnercontainer.id = 'cap-os-barcode-scanner-container-scanner';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainer);\n\n caposbarcodescannercontainerdialog.appendChild(caposbarcodescannercontainerdialoginner);\n caposbarcodescannercontainer.appendChild(caposbarcodescannercontainerdialog);\n }\n\n /**\n * Initiates a barcode scan using the user's camera and HTML5 QR code scanner.\n * Displays the scanner UI and waits for a scan to complete or fail.\n * @param {OSBarcodeScanOptions} options Configuration options for the scan, including camera direction and UI preferences.\n * @returns {Promise<OSBarcodeScanResult>} A promise that resolves with the scan result or rejects with an error.\n */\n async scanBarcode(options: CapacitorBarcodeScannerOptions): Promise<CapacitorBarcodeScannerScanResult> {\n this.buildScannerElement();\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container-dialog')!.style.display = 'block';\n return new Promise((resolve, reject) => {\n const param = {\n facingMode: options.cameraDirection === 1 ? 'environment' : 'user',\n hasScannerButton: false,\n scanButton: options.scanButton === undefined ? false : options.scanButton,\n showScanLine: false,\n scanInstructions: options.scanInstructions ? options.scanInstructions : '',\n orientation: options.scanOrientation\n ? options.scanOrientation\n : CapacitorBarcodeScannerScanOrientation.PORTRAIT,\n showCameraSelection: options.web?.showCameraSelection ? options.web.showCameraSelection : false,\n typeHint: options.hint === 17 ? undefined : options.hint,\n scannerFPS: options.web?.scannerFPS ? options.web.scannerFPS : 50,\n };\n\n let alreadyCancelled = false;\n const closeButton = document.getElementById('cap-os-barcode-scanner-close-button');\n if (closeButton) {\n closeButton.onclick = async () => {\n if (alreadyCancelled) return;\n alreadyCancelled = true;\n await this.stopAndHideScanner();\n reject(new Error('Couldn’t scan because the process was cancelled.'));\n };\n }\n\n // Set up and start the scanner\n const scannerElement = document.getElementById('cap-os-barcode-scanner-container-scanner');\n if (!scannerElement) {\n throw new Error('Scanner Element is required for web');\n }\n\n (window as any).OSBarcodeWebScanner = new Html5Qrcode(scannerElement.id, {\n formatsToSupport: param.typeHint !== undefined ? [param.typeHint] : undefined,\n verbose: undefined,\n });\n const Html5QrcodeConfig = {\n fps: param.scannerFPS,\n qrbox: scannerElement.getBoundingClientRect().width * (9 / 16) - 10,\n aspectRatio: 16 / 9,\n videoConstraints: {\n focusMode: 'continuous',\n height: { min: 576, ideal: 1920 },\n deviceId: undefined,\n facingMode: param.facingMode,\n },\n };\n\n // Success and error callbacks for the scanner\n const OSBarcodeWebScannerSuccessCallback = (decodedText: string, decodedResult: Html5QrcodeResult) => {\n this.stopAndHideScanner();\n resolve({\n ScanResult: decodedText,\n format: decodedResult.result.format?.format ?? CapacitorBarcodeScannerTypeHint.ALL,\n });\n };\n\n const OSBarcodeWebScannerErrorCallback = (error: string) => {\n const allowedErrors = [\n 'NotFoundException',\n 'No barcode or QR code detected',\n 'No MultiFormat Readers were able to detect the code',\n ];\n\n if (!allowedErrors.find((e) => error.indexOf(e) !== -1)) {\n this.stopAndHideScanner();\n console.error(`[Scanner Web Error] ${error}`);\n reject(error);\n }\n };\n\n (window as any).OSBarcodeWebScanner.start(\n { facingMode: param.facingMode },\n Html5QrcodeConfig,\n OSBarcodeWebScannerSuccessCallback,\n OSBarcodeWebScannerErrorCallback\n );\n });\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -160,6 +160,7 @@ class CapacitorBarcodeScannerWeb extends core.WebPlugin {
|
|
|
160
160
|
const caposbarcodescannercontainerdialoginner = document.createElement('div');
|
|
161
161
|
caposbarcodescannercontainerdialoginner.className = 'scanner-dialog-inner';
|
|
162
162
|
const caposbarcodescannercontainerdialoginnerclose = document.createElement('span');
|
|
163
|
+
caposbarcodescannercontainerdialoginnerclose.id = 'cap-os-barcode-scanner-close-button';
|
|
163
164
|
caposbarcodescannercontainerdialoginnerclose.className = 'close-button';
|
|
164
165
|
caposbarcodescannercontainerdialoginnerclose.innerHTML = '×';
|
|
165
166
|
caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnerclose);
|
|
@@ -172,7 +173,6 @@ class CapacitorBarcodeScannerWeb extends core.WebPlugin {
|
|
|
172
173
|
caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainer);
|
|
173
174
|
caposbarcodescannercontainerdialog.appendChild(caposbarcodescannercontainerdialoginner);
|
|
174
175
|
caposbarcodescannercontainer.appendChild(caposbarcodescannercontainerdialog);
|
|
175
|
-
caposbarcodescannercontainerdialoginnerclose.onclick = this.stopAndHideScanner;
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
178
|
* Initiates a barcode scan using the user's camera and HTML5 QR code scanner.
|
|
@@ -199,6 +199,17 @@ class CapacitorBarcodeScannerWeb extends core.WebPlugin {
|
|
|
199
199
|
typeHint: options.hint === 17 ? undefined : options.hint,
|
|
200
200
|
scannerFPS: ((_b = options.web) === null || _b === void 0 ? void 0 : _b.scannerFPS) ? options.web.scannerFPS : 50,
|
|
201
201
|
};
|
|
202
|
+
let alreadyCancelled = false;
|
|
203
|
+
const closeButton = document.getElementById('cap-os-barcode-scanner-close-button');
|
|
204
|
+
if (closeButton) {
|
|
205
|
+
closeButton.onclick = async () => {
|
|
206
|
+
if (alreadyCancelled)
|
|
207
|
+
return;
|
|
208
|
+
alreadyCancelled = true;
|
|
209
|
+
await this.stopAndHideScanner();
|
|
210
|
+
reject(new Error('Couldn’t scan because the process was cancelled.'));
|
|
211
|
+
};
|
|
212
|
+
}
|
|
202
213
|
// Set up and start the scanner
|
|
203
214
|
const scannerElement = document.getElementById('cap-os-barcode-scanner-container-scanner');
|
|
204
215
|
if (!scannerElement) {
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/utils.js","esm/index.js","esm/web.js"],"sourcesContent":["import { Html5QrcodeSupportedFormats } from 'html5-qrcode';\n/**\n * Enum representing the direction of the camera to be used for barcode scanning.\n */\nexport var CapacitorBarcodeScannerCameraDirection;\n(function (CapacitorBarcodeScannerCameraDirection) {\n CapacitorBarcodeScannerCameraDirection[CapacitorBarcodeScannerCameraDirection[\"BACK\"] = 1] = \"BACK\";\n CapacitorBarcodeScannerCameraDirection[CapacitorBarcodeScannerCameraDirection[\"FRONT\"] = 2] = \"FRONT\";\n})(CapacitorBarcodeScannerCameraDirection || (CapacitorBarcodeScannerCameraDirection = {}));\n/**\n * Enum representing the orientation of the scanner during barcode scanning.\n */\nexport var CapacitorBarcodeScannerScanOrientation;\n(function (CapacitorBarcodeScannerScanOrientation) {\n CapacitorBarcodeScannerScanOrientation[CapacitorBarcodeScannerScanOrientation[\"PORTRAIT\"] = 1] = \"PORTRAIT\";\n CapacitorBarcodeScannerScanOrientation[CapacitorBarcodeScannerScanOrientation[\"LANDSCAPE\"] = 2] = \"LANDSCAPE\";\n CapacitorBarcodeScannerScanOrientation[CapacitorBarcodeScannerScanOrientation[\"ADAPTIVE\"] = 3] = \"ADAPTIVE\";\n})(CapacitorBarcodeScannerScanOrientation || (CapacitorBarcodeScannerScanOrientation = {}));\n/**\n * Enum representing a special option to indicate that all barcode types are supported.\n */\nexport var CapacitorBarcodeScannerTypeHintALLOption;\n(function (CapacitorBarcodeScannerTypeHintALLOption) {\n CapacitorBarcodeScannerTypeHintALLOption[CapacitorBarcodeScannerTypeHintALLOption[\"ALL\"] = 17] = \"ALL\";\n})(CapacitorBarcodeScannerTypeHintALLOption || (CapacitorBarcodeScannerTypeHintALLOption = {}));\n/**\n * Extends supported formats from Html5Qrcode with a special 'ALL' option,\n * indicating support for all barcode types.\n */\nexport const CapacitorBarcodeScannerTypeHint = Object.assign(Object.assign({}, Html5QrcodeSupportedFormats), CapacitorBarcodeScannerTypeHintALLOption);\n/**\n * Enum representing the library to be used for barcode scanning on Android devices.\n */\nexport var CapacitorBarcodeScannerAndroidScanningLibrary;\n(function (CapacitorBarcodeScannerAndroidScanningLibrary) {\n CapacitorBarcodeScannerAndroidScanningLibrary[\"ZXING\"] = \"zxing\";\n CapacitorBarcodeScannerAndroidScanningLibrary[\"MLKIT\"] = \"mlkit\";\n})(CapacitorBarcodeScannerAndroidScanningLibrary || (CapacitorBarcodeScannerAndroidScanningLibrary = {}));\n//# sourceMappingURL=definitions.js.map","/**\n * Predefined CSS rules for styling barcode scanner components.\n * Each object in the array defines a CSS rule, with a selector and the CSS properties to apply.\n */\nexport const barcodeScannerCss = [\n { selector: '.scanner-container-display', css: 'display: block;' },\n {\n selector: '.scanner-dialog',\n css: 'display: none; position: fixed; z-index: 999; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.4);',\n },\n {\n selector: '.scanner-dialog-inner',\n css: 'background-color: #fefefe; margin: 2% auto; padding: 20px; border: 1px solid #888; width: 96%;',\n },\n { selector: '.close-button', css: 'color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer;' },\n { selector: '.close-button:hover', css: 'color: #222;' },\n { selector: '.scanner-container-full-width', css: 'width: 100%;' },\n];\n/**\n * Dynamically applies a set of CSS rules to the document.\n * If a custom style element with a specific ID does not exist, it is created and appended to the document's head.\n * Existing rules in the style element are cleared before new ones are applied.\n * This function supports both modern and older browsers by using `CSSStyleSheet.insertRule` and `textContent` respectively.\n *\n * @param {Array<{selector: string, css: string}>} cssRules - An array of objects containing CSS selectors and styles to apply.\n */\nexport function applyCss(cssRules) {\n const styleId = 'custom-style-os-cap-barcode'; // Unique identifier for the style element.\n let styleElement = document.getElementById(styleId);\n if (!styleElement) {\n // Create and append a new style element if it does not exist.\n styleElement = document.createElement('style');\n styleElement.type = 'text/css';\n styleElement.id = styleId;\n document.head.appendChild(styleElement);\n }\n if (styleElement.sheet) {\n // Clear existing CSS rules.\n while (styleElement.sheet.cssRules.length) {\n styleElement.sheet.deleteRule(0);\n }\n // Insert new CSS rules.\n for (const { selector, css } of cssRules) {\n styleElement.sheet.insertRule(`${selector} { ${css} }`);\n }\n }\n else {\n // Fallback for older browsers using textContent.\n styleElement.textContent = '';\n for (const { selector, css } of cssRules) {\n styleElement.textContent += `${selector} { ${css} }`;\n }\n }\n}\n//# sourceMappingURL=utils.js.map","import { registerPlugin } from '@capacitor/core';\nimport { CapacitorBarcodeScannerCameraDirection, CapacitorBarcodeScannerScanOrientation, } from './definitions'; // Importing the interface for type checking.\nimport { applyCss, barcodeScannerCss } from './utils'; // Import utilities for applying CSS.\n/**\n * Registers the `OSBarcode` plugin with Capacitor.\n * For web platforms, it applies necessary CSS for the barcode scanner and dynamically imports the web implementation.\n * This allows for lazy loading of the web code only when needed, optimizing overall bundle size.\n */\nconst CapacitorBarcodeScannerImpl = registerPlugin('CapacitorBarcodeScanner', {\n web: () => {\n applyCss(barcodeScannerCss); // Apply the CSS styles necessary for the web implementation of the barcode scanner.\n return import('./web').then((m) => new m.CapacitorBarcodeScannerWeb()); // Dynamically import the web implementation and instantiate it.\n },\n});\nclass CapacitorBarcodeScanner {\n static async scanBarcode(options) {\n options.scanInstructions = options.scanInstructions || ' '; // Ensure scanInstructions is at least a space.\n options.scanButton = options.scanButton || false; // Set scanButton to false if not provided.\n options.scanText = options.scanText || ' '; // Ensure scanText is at least a space.\n options.cameraDirection = options.cameraDirection || CapacitorBarcodeScannerCameraDirection.BACK; // Set cameraDirection to 'BACK' if not provided.\n options.scanOrientation = options.scanOrientation || CapacitorBarcodeScannerScanOrientation.ADAPTIVE; // Set scanOrientation to 'ADAPTIVE' if not provided.\n return CapacitorBarcodeScannerImpl.scanBarcode(options);\n }\n}\nexport { CapacitorBarcodeScanner }; // Export the `CapacitorBarcodeScanner` class.\nexport * from './definitions'; // Re-export all exports from the definitions file.\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { Html5Qrcode } from 'html5-qrcode';\nimport { CapacitorBarcodeScannerScanOrientation, CapacitorBarcodeScannerTypeHint } from './definitions';\n/**\n * Implements OSBarcodePlugin to provide web functionality for barcode scanning.\n */\nexport class CapacitorBarcodeScannerWeb extends WebPlugin {\n /**\n * Stops the barcode scanner and hides its UI.\n * @private\n * @returns {Promise<void>} A promise that resolves when the scanner has stopped and its UI is hidden.\n */\n async stopAndHideScanner() {\n console.log(window.OSBarcodeWebScanner);\n if (window.OSBarcodeWebScanner) {\n await window.OSBarcodeWebScanner.stop();\n window.OSBarcodeWebScanner = null;\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container-dialog').style.display = 'none';\n }\n /**\n * Builds the HTML elements necessary for the barcode scanner UI.\n * This method checks if the scanner container exists before creating it to avoid duplicates.\n * It also sets up the close button to stop and hide the scanner on click.\n * @private\n */\n buildScannerElement() {\n if (document.getElementById('cap-os-barcode-scanner-container')) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container').className = 'scanner-container-display';\n return;\n }\n // Create and configure scanner container elements\n const caposbarcodescannercontainer = document.body.appendChild(document.createElement('div'));\n caposbarcodescannercontainer.id = 'cap-os-barcode-scanner-container';\n const caposbarcodescannercontainerdialog = document.createElement('div');\n caposbarcodescannercontainerdialog.id = 'cap-os-barcode-scanner-container-dialog';\n caposbarcodescannercontainerdialog.className = 'scanner-dialog';\n // Inner dialog elements including the close button and scanner view\n const caposbarcodescannercontainerdialoginner = document.createElement('div');\n caposbarcodescannercontainerdialoginner.className = 'scanner-dialog-inner';\n const caposbarcodescannercontainerdialoginnerclose = document.createElement('span');\n caposbarcodescannercontainerdialoginnerclose.className = 'close-button';\n caposbarcodescannercontainerdialoginnerclose.innerHTML = '×';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnerclose);\n const caposbarcodescannercontainerdialoginnercontainerp = document.createElement('p');\n caposbarcodescannercontainerdialoginnercontainerp.innerHTML = ' ';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainerp);\n const caposbarcodescannercontainerdialoginnercontainer = document.createElement('div');\n caposbarcodescannercontainerdialoginnercontainer.className = 'scanner-container-full-width';\n caposbarcodescannercontainerdialoginnercontainer.id = 'cap-os-barcode-scanner-container-scanner';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainer);\n caposbarcodescannercontainerdialog.appendChild(caposbarcodescannercontainerdialoginner);\n caposbarcodescannercontainer.appendChild(caposbarcodescannercontainerdialog);\n caposbarcodescannercontainerdialoginnerclose.onclick = this.stopAndHideScanner;\n }\n /**\n * Initiates a barcode scan using the user's camera and HTML5 QR code scanner.\n * Displays the scanner UI and waits for a scan to complete or fail.\n * @param {OSBarcodeScanOptions} options Configuration options for the scan, including camera direction and UI preferences.\n * @returns {Promise<OSBarcodeScanResult>} A promise that resolves with the scan result or rejects with an error.\n */\n async scanBarcode(options) {\n this.buildScannerElement();\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container-dialog').style.display = 'block';\n return new Promise((resolve, reject) => {\n var _a, _b;\n const param = {\n facingMode: options.cameraDirection === 1 ? 'environment' : 'user',\n hasScannerButton: false,\n scanButton: options.scanButton === undefined ? false : options.scanButton,\n showScanLine: false,\n scanInstructions: options.scanInstructions ? options.scanInstructions : '',\n orientation: options.scanOrientation\n ? options.scanOrientation\n : CapacitorBarcodeScannerScanOrientation.PORTRAIT,\n showCameraSelection: ((_a = options.web) === null || _a === void 0 ? void 0 : _a.showCameraSelection) ? options.web.showCameraSelection : false,\n typeHint: options.hint === 17 ? undefined : options.hint,\n scannerFPS: ((_b = options.web) === null || _b === void 0 ? void 0 : _b.scannerFPS) ? options.web.scannerFPS : 50,\n };\n // Set up and start the scanner\n const scannerElement = document.getElementById('cap-os-barcode-scanner-container-scanner');\n if (!scannerElement) {\n throw new Error('Scanner Element is required for web');\n }\n window.OSBarcodeWebScanner = new Html5Qrcode(scannerElement.id, {\n formatsToSupport: param.typeHint !== undefined ? [param.typeHint] : undefined,\n verbose: undefined,\n });\n const Html5QrcodeConfig = {\n fps: param.scannerFPS,\n qrbox: scannerElement.getBoundingClientRect().width * (9 / 16) - 10,\n aspectRatio: 16 / 9,\n videoConstraints: {\n focusMode: 'continuous',\n height: { min: 576, ideal: 1920 },\n deviceId: undefined,\n facingMode: param.facingMode,\n },\n };\n // Success and error callbacks for the scanner\n const OSBarcodeWebScannerSuccessCallback = (decodedText, decodedResult) => {\n var _a, _b;\n this.stopAndHideScanner();\n resolve({\n ScanResult: decodedText,\n format: (_b = (_a = decodedResult.result.format) === null || _a === void 0 ? void 0 : _a.format) !== null && _b !== void 0 ? _b : CapacitorBarcodeScannerTypeHint.ALL,\n });\n };\n const OSBarcodeWebScannerErrorCallback = (error) => {\n const allowedErrors = [\n 'NotFoundException',\n 'No barcode or QR code detected',\n 'No MultiFormat Readers were able to detect the code',\n ];\n if (!allowedErrors.find((e) => error.indexOf(e) !== -1)) {\n this.stopAndHideScanner();\n console.error(`[Scanner Web Error] ${error}`);\n reject(error);\n }\n };\n window.OSBarcodeWebScanner.start({ facingMode: param.facingMode }, Html5QrcodeConfig, OSBarcodeWebScannerSuccessCallback, OSBarcodeWebScannerErrorCallback);\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["CapacitorBarcodeScannerCameraDirection","CapacitorBarcodeScannerScanOrientation","CapacitorBarcodeScannerTypeHintALLOption","Html5QrcodeSupportedFormats","CapacitorBarcodeScannerAndroidScanningLibrary","registerPlugin","WebPlugin","Html5Qrcode"],"mappings":";;;;;;;AACA;AACA;AACA;AACWA,wDAAuC;AAClD,CAAC,UAAU,sCAAsC,EAAE;AACnD,IAAI,sCAAsC,CAAC,sCAAsC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;AACxG,IAAI,sCAAsC,CAAC,sCAAsC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC;AAC1G,CAAC,EAAEA,8CAAsC,KAAKA,8CAAsC,GAAG,EAAE,CAAC,CAAC,CAAC;AAC5F;AACA;AACA;AACWC,wDAAuC;AAClD,CAAC,UAAU,sCAAsC,EAAE;AACnD,IAAI,sCAAsC,CAAC,sCAAsC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC;AAChH,IAAI,sCAAsC,CAAC,sCAAsC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC;AAClH,IAAI,sCAAsC,CAAC,sCAAsC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC;AAChH,CAAC,EAAEA,8CAAsC,KAAKA,8CAAsC,GAAG,EAAE,CAAC,CAAC,CAAC;AAC5F;AACA;AACA;AACWC,0DAAyC;AACpD,CAAC,UAAU,wCAAwC,EAAE;AACrD,IAAI,wCAAwC,CAAC,wCAAwC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;AAC3G,CAAC,EAAEA,gDAAwC,KAAKA,gDAAwC,GAAG,EAAE,CAAC,CAAC,CAAC;AAChG;AACA;AAC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Formats } from 'html5-qrcode';\n/**\n * Enum representing the direction of the camera to be used for barcode scanning.\n */\nexport var CapacitorBarcodeScannerCameraDirection;\n(function (CapacitorBarcodeScannerCameraDirection) {\n CapacitorBarcodeScannerCameraDirection[CapacitorBarcodeScannerCameraDirection[\"BACK\"] = 1] = \"BACK\";\n CapacitorBarcodeScannerCameraDirection[CapacitorBarcodeScannerCameraDirection[\"FRONT\"] = 2] = \"FRONT\";\n})(CapacitorBarcodeScannerCameraDirection || (CapacitorBarcodeScannerCameraDirection = {}));\n/**\n * Enum representing the orientation of the scanner during barcode scanning.\n */\nexport var CapacitorBarcodeScannerScanOrientation;\n(function (CapacitorBarcodeScannerScanOrientation) {\n CapacitorBarcodeScannerScanOrientation[CapacitorBarcodeScannerScanOrientation[\"PORTRAIT\"] = 1] = \"PORTRAIT\";\n CapacitorBarcodeScannerScanOrientation[CapacitorBarcodeScannerScanOrientation[\"LANDSCAPE\"] = 2] = \"LANDSCAPE\";\n CapacitorBarcodeScannerScanOrientation[CapacitorBarcodeScannerScanOrientation[\"ADAPTIVE\"] = 3] = \"ADAPTIVE\";\n})(CapacitorBarcodeScannerScanOrientation || (CapacitorBarcodeScannerScanOrientation = {}));\n/**\n * Enum representing a special option to indicate that all barcode types are supported.\n */\nexport var CapacitorBarcodeScannerTypeHintALLOption;\n(function (CapacitorBarcodeScannerTypeHintALLOption) {\n CapacitorBarcodeScannerTypeHintALLOption[CapacitorBarcodeScannerTypeHintALLOption[\"ALL\"] = 17] = \"ALL\";\n})(CapacitorBarcodeScannerTypeHintALLOption || (CapacitorBarcodeScannerTypeHintALLOption = {}));\n/**\n * Extends supported formats from Html5Qrcode with a special 'ALL' option,\n * indicating support for all barcode types.\n */\nexport const CapacitorBarcodeScannerTypeHint = Object.assign(Object.assign({}, Html5QrcodeSupportedFormats), CapacitorBarcodeScannerTypeHintALLOption);\n/**\n * Enum representing the library to be used for barcode scanning on Android devices.\n */\nexport var CapacitorBarcodeScannerAndroidScanningLibrary;\n(function (CapacitorBarcodeScannerAndroidScanningLibrary) {\n CapacitorBarcodeScannerAndroidScanningLibrary[\"ZXING\"] = \"zxing\";\n CapacitorBarcodeScannerAndroidScanningLibrary[\"MLKIT\"] = \"mlkit\";\n})(CapacitorBarcodeScannerAndroidScanningLibrary || (CapacitorBarcodeScannerAndroidScanningLibrary = {}));\n//# sourceMappingURL=definitions.js.map","/**\n * Predefined CSS rules for styling barcode scanner components.\n * Each object in the array defines a CSS rule, with a selector and the CSS properties to apply.\n */\nexport const barcodeScannerCss = [\n { selector: '.scanner-container-display', css: 'display: block;' },\n {\n selector: '.scanner-dialog',\n css: 'display: none; position: fixed; z-index: 999; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.4);',\n },\n {\n selector: '.scanner-dialog-inner',\n css: 'background-color: #fefefe; margin: 2% auto; padding: 20px; border: 1px solid #888; width: 96%;',\n },\n { selector: '.close-button', css: 'color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer;' },\n { selector: '.close-button:hover', css: 'color: #222;' },\n { selector: '.scanner-container-full-width', css: 'width: 100%;' },\n];\n/**\n * Dynamically applies a set of CSS rules to the document.\n * If a custom style element with a specific ID does not exist, it is created and appended to the document's head.\n * Existing rules in the style element are cleared before new ones are applied.\n * This function supports both modern and older browsers by using `CSSStyleSheet.insertRule` and `textContent` respectively.\n *\n * @param {Array<{selector: string, css: string}>} cssRules - An array of objects containing CSS selectors and styles to apply.\n */\nexport function applyCss(cssRules) {\n const styleId = 'custom-style-os-cap-barcode'; // Unique identifier for the style element.\n let styleElement = document.getElementById(styleId);\n if (!styleElement) {\n // Create and append a new style element if it does not exist.\n styleElement = document.createElement('style');\n styleElement.type = 'text/css';\n styleElement.id = styleId;\n document.head.appendChild(styleElement);\n }\n if (styleElement.sheet) {\n // Clear existing CSS rules.\n while (styleElement.sheet.cssRules.length) {\n styleElement.sheet.deleteRule(0);\n }\n // Insert new CSS rules.\n for (const { selector, css } of cssRules) {\n styleElement.sheet.insertRule(`${selector} { ${css} }`);\n }\n }\n else {\n // Fallback for older browsers using textContent.\n styleElement.textContent = '';\n for (const { selector, css } of cssRules) {\n styleElement.textContent += `${selector} { ${css} }`;\n }\n }\n}\n//# sourceMappingURL=utils.js.map","import { registerPlugin } from '@capacitor/core';\nimport { CapacitorBarcodeScannerCameraDirection, CapacitorBarcodeScannerScanOrientation, } from './definitions'; // Importing the interface for type checking.\nimport { applyCss, barcodeScannerCss } from './utils'; // Import utilities for applying CSS.\n/**\n * Registers the `OSBarcode` plugin with Capacitor.\n * For web platforms, it applies necessary CSS for the barcode scanner and dynamically imports the web implementation.\n * This allows for lazy loading of the web code only when needed, optimizing overall bundle size.\n */\nconst CapacitorBarcodeScannerImpl = registerPlugin('CapacitorBarcodeScanner', {\n web: () => {\n applyCss(barcodeScannerCss); // Apply the CSS styles necessary for the web implementation of the barcode scanner.\n return import('./web').then((m) => new m.CapacitorBarcodeScannerWeb()); // Dynamically import the web implementation and instantiate it.\n },\n});\nclass CapacitorBarcodeScanner {\n static async scanBarcode(options) {\n options.scanInstructions = options.scanInstructions || ' '; // Ensure scanInstructions is at least a space.\n options.scanButton = options.scanButton || false; // Set scanButton to false if not provided.\n options.scanText = options.scanText || ' '; // Ensure scanText is at least a space.\n options.cameraDirection = options.cameraDirection || CapacitorBarcodeScannerCameraDirection.BACK; // Set cameraDirection to 'BACK' if not provided.\n options.scanOrientation = options.scanOrientation || CapacitorBarcodeScannerScanOrientation.ADAPTIVE; // Set scanOrientation to 'ADAPTIVE' if not provided.\n return CapacitorBarcodeScannerImpl.scanBarcode(options);\n }\n}\nexport { CapacitorBarcodeScanner }; // Export the `CapacitorBarcodeScanner` class.\nexport * from './definitions'; // Re-export all exports from the definitions file.\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { Html5Qrcode } from 'html5-qrcode';\nimport { CapacitorBarcodeScannerScanOrientation, CapacitorBarcodeScannerTypeHint } from './definitions';\n/**\n * Implements OSBarcodePlugin to provide web functionality for barcode scanning.\n */\nexport class CapacitorBarcodeScannerWeb extends WebPlugin {\n /**\n * Stops the barcode scanner and hides its UI.\n * @private\n * @returns {Promise<void>} A promise that resolves when the scanner has stopped and its UI is hidden.\n */\n async stopAndHideScanner() {\n console.log(window.OSBarcodeWebScanner);\n if (window.OSBarcodeWebScanner) {\n await window.OSBarcodeWebScanner.stop();\n window.OSBarcodeWebScanner = null;\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container-dialog').style.display = 'none';\n }\n /**\n * Builds the HTML elements necessary for the barcode scanner UI.\n * This method checks if the scanner container exists before creating it to avoid duplicates.\n * It also sets up the close button to stop and hide the scanner on click.\n * @private\n */\n buildScannerElement() {\n if (document.getElementById('cap-os-barcode-scanner-container')) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container').className = 'scanner-container-display';\n return;\n }\n // Create and configure scanner container elements\n const caposbarcodescannercontainer = document.body.appendChild(document.createElement('div'));\n caposbarcodescannercontainer.id = 'cap-os-barcode-scanner-container';\n const caposbarcodescannercontainerdialog = document.createElement('div');\n caposbarcodescannercontainerdialog.id = 'cap-os-barcode-scanner-container-dialog';\n caposbarcodescannercontainerdialog.className = 'scanner-dialog';\n // Inner dialog elements including the close button and scanner view\n const caposbarcodescannercontainerdialoginner = document.createElement('div');\n caposbarcodescannercontainerdialoginner.className = 'scanner-dialog-inner';\n const caposbarcodescannercontainerdialoginnerclose = document.createElement('span');\n caposbarcodescannercontainerdialoginnerclose.id = 'cap-os-barcode-scanner-close-button';\n caposbarcodescannercontainerdialoginnerclose.className = 'close-button';\n caposbarcodescannercontainerdialoginnerclose.innerHTML = '×';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnerclose);\n const caposbarcodescannercontainerdialoginnercontainerp = document.createElement('p');\n caposbarcodescannercontainerdialoginnercontainerp.innerHTML = ' ';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainerp);\n const caposbarcodescannercontainerdialoginnercontainer = document.createElement('div');\n caposbarcodescannercontainerdialoginnercontainer.className = 'scanner-container-full-width';\n caposbarcodescannercontainerdialoginnercontainer.id = 'cap-os-barcode-scanner-container-scanner';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainer);\n caposbarcodescannercontainerdialog.appendChild(caposbarcodescannercontainerdialoginner);\n caposbarcodescannercontainer.appendChild(caposbarcodescannercontainerdialog);\n }\n /**\n * Initiates a barcode scan using the user's camera and HTML5 QR code scanner.\n * Displays the scanner UI and waits for a scan to complete or fail.\n * @param {OSBarcodeScanOptions} options Configuration options for the scan, including camera direction and UI preferences.\n * @returns {Promise<OSBarcodeScanResult>} A promise that resolves with the scan result or rejects with an error.\n */\n async scanBarcode(options) {\n this.buildScannerElement();\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container-dialog').style.display = 'block';\n return new Promise((resolve, reject) => {\n var _a, _b;\n const param = {\n facingMode: options.cameraDirection === 1 ? 'environment' : 'user',\n hasScannerButton: false,\n scanButton: options.scanButton === undefined ? false : options.scanButton,\n showScanLine: false,\n scanInstructions: options.scanInstructions ? options.scanInstructions : '',\n orientation: options.scanOrientation\n ? options.scanOrientation\n : CapacitorBarcodeScannerScanOrientation.PORTRAIT,\n showCameraSelection: ((_a = options.web) === null || _a === void 0 ? void 0 : _a.showCameraSelection) ? options.web.showCameraSelection : false,\n typeHint: options.hint === 17 ? undefined : options.hint,\n scannerFPS: ((_b = options.web) === null || _b === void 0 ? void 0 : _b.scannerFPS) ? options.web.scannerFPS : 50,\n };\n let alreadyCancelled = false;\n const closeButton = document.getElementById('cap-os-barcode-scanner-close-button');\n if (closeButton) {\n closeButton.onclick = async () => {\n if (alreadyCancelled)\n return;\n alreadyCancelled = true;\n await this.stopAndHideScanner();\n reject(new Error('Couldn’t scan because the process was cancelled.'));\n };\n }\n // Set up and start the scanner\n const scannerElement = document.getElementById('cap-os-barcode-scanner-container-scanner');\n if (!scannerElement) {\n throw new Error('Scanner Element is required for web');\n }\n window.OSBarcodeWebScanner = new Html5Qrcode(scannerElement.id, {\n formatsToSupport: param.typeHint !== undefined ? [param.typeHint] : undefined,\n verbose: undefined,\n });\n const Html5QrcodeConfig = {\n fps: param.scannerFPS,\n qrbox: scannerElement.getBoundingClientRect().width * (9 / 16) - 10,\n aspectRatio: 16 / 9,\n videoConstraints: {\n focusMode: 'continuous',\n height: { min: 576, ideal: 1920 },\n deviceId: undefined,\n facingMode: param.facingMode,\n },\n };\n // Success and error callbacks for the scanner\n const OSBarcodeWebScannerSuccessCallback = (decodedText, decodedResult) => {\n var _a, _b;\n this.stopAndHideScanner();\n resolve({\n ScanResult: decodedText,\n format: (_b = (_a = decodedResult.result.format) === null || _a === void 0 ? void 0 : _a.format) !== null && _b !== void 0 ? _b : CapacitorBarcodeScannerTypeHint.ALL,\n });\n };\n const OSBarcodeWebScannerErrorCallback = (error) => {\n const allowedErrors = [\n 'NotFoundException',\n 'No barcode or QR code detected',\n 'No MultiFormat Readers were able to detect the code',\n ];\n if (!allowedErrors.find((e) => error.indexOf(e) !== -1)) {\n this.stopAndHideScanner();\n console.error(`[Scanner Web Error] ${error}`);\n reject(error);\n }\n };\n window.OSBarcodeWebScanner.start({ facingMode: param.facingMode }, Html5QrcodeConfig, OSBarcodeWebScannerSuccessCallback, OSBarcodeWebScannerErrorCallback);\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["CapacitorBarcodeScannerCameraDirection","CapacitorBarcodeScannerScanOrientation","CapacitorBarcodeScannerTypeHintALLOption","Html5QrcodeSupportedFormats","CapacitorBarcodeScannerAndroidScanningLibrary","registerPlugin","WebPlugin","Html5Qrcode"],"mappings":";;;;;;;AACA;AACA;AACA;AACWA,wDAAuC;AAClD,CAAC,UAAU,sCAAsC,EAAE;AACnD,IAAI,sCAAsC,CAAC,sCAAsC,CAAC,MA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OSBarcode = (function (exports, core, html5Qrcode) {
|
|
|
156
156
|
const caposbarcodescannercontainerdialoginner = document.createElement('div');
|
|
157
157
|
caposbarcodescannercontainerdialoginner.className = 'scanner-dialog-inner';
|
|
158
158
|
const caposbarcodescannercontainerdialoginnerclose = document.createElement('span');
|
|
159
|
+
caposbarcodescannercontainerdialoginnerclose.id = 'cap-os-barcode-scanner-close-button';
|
|
159
160
|
caposbarcodescannercontainerdialoginnerclose.className = 'close-button';
|
|
160
161
|
caposbarcodescannercontainerdialoginnerclose.innerHTML = '×';
|
|
161
162
|
caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnerclose);
|
|
@@ -168,7 +169,6 @@ var capacitorOSBarcode = (function (exports, core, html5Qrcode) {
|
|
|
168
169
|
caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainer);
|
|
169
170
|
caposbarcodescannercontainerdialog.appendChild(caposbarcodescannercontainerdialoginner);
|
|
170
171
|
caposbarcodescannercontainer.appendChild(caposbarcodescannercontainerdialog);
|
|
171
|
-
caposbarcodescannercontainerdialoginnerclose.onclick = this.stopAndHideScanner;
|
|
172
172
|
}
|
|
173
173
|
/**
|
|
174
174
|
* Initiates a barcode scan using the user's camera and HTML5 QR code scanner.
|
|
@@ -195,6 +195,17 @@ var capacitorOSBarcode = (function (exports, core, html5Qrcode) {
|
|
|
195
195
|
typeHint: options.hint === 17 ? undefined : options.hint,
|
|
196
196
|
scannerFPS: ((_b = options.web) === null || _b === void 0 ? void 0 : _b.scannerFPS) ? options.web.scannerFPS : 50,
|
|
197
197
|
};
|
|
198
|
+
let alreadyCancelled = false;
|
|
199
|
+
const closeButton = document.getElementById('cap-os-barcode-scanner-close-button');
|
|
200
|
+
if (closeButton) {
|
|
201
|
+
closeButton.onclick = async () => {
|
|
202
|
+
if (alreadyCancelled)
|
|
203
|
+
return;
|
|
204
|
+
alreadyCancelled = true;
|
|
205
|
+
await this.stopAndHideScanner();
|
|
206
|
+
reject(new Error('Couldn’t scan because the process was cancelled.'));
|
|
207
|
+
};
|
|
208
|
+
}
|
|
198
209
|
// Set up and start the scanner
|
|
199
210
|
const scannerElement = document.getElementById('cap-os-barcode-scanner-container-scanner');
|
|
200
211
|
if (!scannerElement) {
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/utils.js","esm/index.js","esm/web.js"],"sourcesContent":["import { Html5QrcodeSupportedFormats } from 'html5-qrcode';\n/**\n * Enum representing the direction of the camera to be used for barcode scanning.\n */\nexport var CapacitorBarcodeScannerCameraDirection;\n(function (CapacitorBarcodeScannerCameraDirection) {\n CapacitorBarcodeScannerCameraDirection[CapacitorBarcodeScannerCameraDirection[\"BACK\"] = 1] = \"BACK\";\n CapacitorBarcodeScannerCameraDirection[CapacitorBarcodeScannerCameraDirection[\"FRONT\"] = 2] = \"FRONT\";\n})(CapacitorBarcodeScannerCameraDirection || (CapacitorBarcodeScannerCameraDirection = {}));\n/**\n * Enum representing the orientation of the scanner during barcode scanning.\n */\nexport var CapacitorBarcodeScannerScanOrientation;\n(function (CapacitorBarcodeScannerScanOrientation) {\n CapacitorBarcodeScannerScanOrientation[CapacitorBarcodeScannerScanOrientation[\"PORTRAIT\"] = 1] = \"PORTRAIT\";\n CapacitorBarcodeScannerScanOrientation[CapacitorBarcodeScannerScanOrientation[\"LANDSCAPE\"] = 2] = \"LANDSCAPE\";\n CapacitorBarcodeScannerScanOrientation[CapacitorBarcodeScannerScanOrientation[\"ADAPTIVE\"] = 3] = \"ADAPTIVE\";\n})(CapacitorBarcodeScannerScanOrientation || (CapacitorBarcodeScannerScanOrientation = {}));\n/**\n * Enum representing a special option to indicate that all barcode types are supported.\n */\nexport var CapacitorBarcodeScannerTypeHintALLOption;\n(function (CapacitorBarcodeScannerTypeHintALLOption) {\n CapacitorBarcodeScannerTypeHintALLOption[CapacitorBarcodeScannerTypeHintALLOption[\"ALL\"] = 17] = \"ALL\";\n})(CapacitorBarcodeScannerTypeHintALLOption || (CapacitorBarcodeScannerTypeHintALLOption = {}));\n/**\n * Extends supported formats from Html5Qrcode with a special 'ALL' option,\n * indicating support for all barcode types.\n */\nexport const CapacitorBarcodeScannerTypeHint = Object.assign(Object.assign({}, Html5QrcodeSupportedFormats), CapacitorBarcodeScannerTypeHintALLOption);\n/**\n * Enum representing the library to be used for barcode scanning on Android devices.\n */\nexport var CapacitorBarcodeScannerAndroidScanningLibrary;\n(function (CapacitorBarcodeScannerAndroidScanningLibrary) {\n CapacitorBarcodeScannerAndroidScanningLibrary[\"ZXING\"] = \"zxing\";\n CapacitorBarcodeScannerAndroidScanningLibrary[\"MLKIT\"] = \"mlkit\";\n})(CapacitorBarcodeScannerAndroidScanningLibrary || (CapacitorBarcodeScannerAndroidScanningLibrary = {}));\n//# sourceMappingURL=definitions.js.map","/**\n * Predefined CSS rules for styling barcode scanner components.\n * Each object in the array defines a CSS rule, with a selector and the CSS properties to apply.\n */\nexport const barcodeScannerCss = [\n { selector: '.scanner-container-display', css: 'display: block;' },\n {\n selector: '.scanner-dialog',\n css: 'display: none; position: fixed; z-index: 999; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.4);',\n },\n {\n selector: '.scanner-dialog-inner',\n css: 'background-color: #fefefe; margin: 2% auto; padding: 20px; border: 1px solid #888; width: 96%;',\n },\n { selector: '.close-button', css: 'color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer;' },\n { selector: '.close-button:hover', css: 'color: #222;' },\n { selector: '.scanner-container-full-width', css: 'width: 100%;' },\n];\n/**\n * Dynamically applies a set of CSS rules to the document.\n * If a custom style element with a specific ID does not exist, it is created and appended to the document's head.\n * Existing rules in the style element are cleared before new ones are applied.\n * This function supports both modern and older browsers by using `CSSStyleSheet.insertRule` and `textContent` respectively.\n *\n * @param {Array<{selector: string, css: string}>} cssRules - An array of objects containing CSS selectors and styles to apply.\n */\nexport function applyCss(cssRules) {\n const styleId = 'custom-style-os-cap-barcode'; // Unique identifier for the style element.\n let styleElement = document.getElementById(styleId);\n if (!styleElement) {\n // Create and append a new style element if it does not exist.\n styleElement = document.createElement('style');\n styleElement.type = 'text/css';\n styleElement.id = styleId;\n document.head.appendChild(styleElement);\n }\n if (styleElement.sheet) {\n // Clear existing CSS rules.\n while (styleElement.sheet.cssRules.length) {\n styleElement.sheet.deleteRule(0);\n }\n // Insert new CSS rules.\n for (const { selector, css } of cssRules) {\n styleElement.sheet.insertRule(`${selector} { ${css} }`);\n }\n }\n else {\n // Fallback for older browsers using textContent.\n styleElement.textContent = '';\n for (const { selector, css } of cssRules) {\n styleElement.textContent += `${selector} { ${css} }`;\n }\n }\n}\n//# sourceMappingURL=utils.js.map","import { registerPlugin } from '@capacitor/core';\nimport { CapacitorBarcodeScannerCameraDirection, CapacitorBarcodeScannerScanOrientation, } from './definitions'; // Importing the interface for type checking.\nimport { applyCss, barcodeScannerCss } from './utils'; // Import utilities for applying CSS.\n/**\n * Registers the `OSBarcode` plugin with Capacitor.\n * For web platforms, it applies necessary CSS for the barcode scanner and dynamically imports the web implementation.\n * This allows for lazy loading of the web code only when needed, optimizing overall bundle size.\n */\nconst CapacitorBarcodeScannerImpl = registerPlugin('CapacitorBarcodeScanner', {\n web: () => {\n applyCss(barcodeScannerCss); // Apply the CSS styles necessary for the web implementation of the barcode scanner.\n return import('./web').then((m) => new m.CapacitorBarcodeScannerWeb()); // Dynamically import the web implementation and instantiate it.\n },\n});\nclass CapacitorBarcodeScanner {\n static async scanBarcode(options) {\n options.scanInstructions = options.scanInstructions || ' '; // Ensure scanInstructions is at least a space.\n options.scanButton = options.scanButton || false; // Set scanButton to false if not provided.\n options.scanText = options.scanText || ' '; // Ensure scanText is at least a space.\n options.cameraDirection = options.cameraDirection || CapacitorBarcodeScannerCameraDirection.BACK; // Set cameraDirection to 'BACK' if not provided.\n options.scanOrientation = options.scanOrientation || CapacitorBarcodeScannerScanOrientation.ADAPTIVE; // Set scanOrientation to 'ADAPTIVE' if not provided.\n return CapacitorBarcodeScannerImpl.scanBarcode(options);\n }\n}\nexport { CapacitorBarcodeScanner }; // Export the `CapacitorBarcodeScanner` class.\nexport * from './definitions'; // Re-export all exports from the definitions file.\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { Html5Qrcode } from 'html5-qrcode';\nimport { CapacitorBarcodeScannerScanOrientation, CapacitorBarcodeScannerTypeHint } from './definitions';\n/**\n * Implements OSBarcodePlugin to provide web functionality for barcode scanning.\n */\nexport class CapacitorBarcodeScannerWeb extends WebPlugin {\n /**\n * Stops the barcode scanner and hides its UI.\n * @private\n * @returns {Promise<void>} A promise that resolves when the scanner has stopped and its UI is hidden.\n */\n async stopAndHideScanner() {\n console.log(window.OSBarcodeWebScanner);\n if (window.OSBarcodeWebScanner) {\n await window.OSBarcodeWebScanner.stop();\n window.OSBarcodeWebScanner = null;\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container-dialog').style.display = 'none';\n }\n /**\n * Builds the HTML elements necessary for the barcode scanner UI.\n * This method checks if the scanner container exists before creating it to avoid duplicates.\n * It also sets up the close button to stop and hide the scanner on click.\n * @private\n */\n buildScannerElement() {\n if (document.getElementById('cap-os-barcode-scanner-container')) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container').className = 'scanner-container-display';\n return;\n }\n // Create and configure scanner container elements\n const caposbarcodescannercontainer = document.body.appendChild(document.createElement('div'));\n caposbarcodescannercontainer.id = 'cap-os-barcode-scanner-container';\n const caposbarcodescannercontainerdialog = document.createElement('div');\n caposbarcodescannercontainerdialog.id = 'cap-os-barcode-scanner-container-dialog';\n caposbarcodescannercontainerdialog.className = 'scanner-dialog';\n // Inner dialog elements including the close button and scanner view\n const caposbarcodescannercontainerdialoginner = document.createElement('div');\n caposbarcodescannercontainerdialoginner.className = 'scanner-dialog-inner';\n const caposbarcodescannercontainerdialoginnerclose = document.createElement('span');\n caposbarcodescannercontainerdialoginnerclose.className = 'close-button';\n caposbarcodescannercontainerdialoginnerclose.innerHTML = '×';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnerclose);\n const caposbarcodescannercontainerdialoginnercontainerp = document.createElement('p');\n caposbarcodescannercontainerdialoginnercontainerp.innerHTML = ' ';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainerp);\n const caposbarcodescannercontainerdialoginnercontainer = document.createElement('div');\n caposbarcodescannercontainerdialoginnercontainer.className = 'scanner-container-full-width';\n caposbarcodescannercontainerdialoginnercontainer.id = 'cap-os-barcode-scanner-container-scanner';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainer);\n caposbarcodescannercontainerdialog.appendChild(caposbarcodescannercontainerdialoginner);\n caposbarcodescannercontainer.appendChild(caposbarcodescannercontainerdialog);\n caposbarcodescannercontainerdialoginnerclose.onclick = this.stopAndHideScanner;\n }\n /**\n * Initiates a barcode scan using the user's camera and HTML5 QR code scanner.\n * Displays the scanner UI and waits for a scan to complete or fail.\n * @param {OSBarcodeScanOptions} options Configuration options for the scan, including camera direction and UI preferences.\n * @returns {Promise<OSBarcodeScanResult>} A promise that resolves with the scan result or rejects with an error.\n */\n async scanBarcode(options) {\n this.buildScannerElement();\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container-dialog').style.display = 'block';\n return new Promise((resolve, reject) => {\n var _a, _b;\n const param = {\n facingMode: options.cameraDirection === 1 ? 'environment' : 'user',\n hasScannerButton: false,\n scanButton: options.scanButton === undefined ? false : options.scanButton,\n showScanLine: false,\n scanInstructions: options.scanInstructions ? options.scanInstructions : '',\n orientation: options.scanOrientation\n ? options.scanOrientation\n : CapacitorBarcodeScannerScanOrientation.PORTRAIT,\n showCameraSelection: ((_a = options.web) === null || _a === void 0 ? void 0 : _a.showCameraSelection) ? options.web.showCameraSelection : false,\n typeHint: options.hint === 17 ? undefined : options.hint,\n scannerFPS: ((_b = options.web) === null || _b === void 0 ? void 0 : _b.scannerFPS) ? options.web.scannerFPS : 50,\n };\n // Set up and start the scanner\n const scannerElement = document.getElementById('cap-os-barcode-scanner-container-scanner');\n if (!scannerElement) {\n throw new Error('Scanner Element is required for web');\n }\n window.OSBarcodeWebScanner = new Html5Qrcode(scannerElement.id, {\n formatsToSupport: param.typeHint !== undefined ? [param.typeHint] : undefined,\n verbose: undefined,\n });\n const Html5QrcodeConfig = {\n fps: param.scannerFPS,\n qrbox: scannerElement.getBoundingClientRect().width * (9 / 16) - 10,\n aspectRatio: 16 / 9,\n videoConstraints: {\n focusMode: 'continuous',\n height: { min: 576, ideal: 1920 },\n deviceId: undefined,\n facingMode: param.facingMode,\n },\n };\n // Success and error callbacks for the scanner\n const OSBarcodeWebScannerSuccessCallback = (decodedText, decodedResult) => {\n var _a, _b;\n this.stopAndHideScanner();\n resolve({\n ScanResult: decodedText,\n format: (_b = (_a = decodedResult.result.format) === null || _a === void 0 ? void 0 : _a.format) !== null && _b !== void 0 ? _b : CapacitorBarcodeScannerTypeHint.ALL,\n });\n };\n const OSBarcodeWebScannerErrorCallback = (error) => {\n const allowedErrors = [\n 'NotFoundException',\n 'No barcode or QR code detected',\n 'No MultiFormat Readers were able to detect the code',\n ];\n if (!allowedErrors.find((e) => error.indexOf(e) !== -1)) {\n this.stopAndHideScanner();\n console.error(`[Scanner Web Error] ${error}`);\n reject(error);\n }\n };\n window.OSBarcodeWebScanner.start({ facingMode: param.facingMode }, Html5QrcodeConfig, OSBarcodeWebScannerSuccessCallback, OSBarcodeWebScannerErrorCallback);\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["CapacitorBarcodeScannerCameraDirection","CapacitorBarcodeScannerScanOrientation","CapacitorBarcodeScannerTypeHintALLOption","Html5QrcodeSupportedFormats","CapacitorBarcodeScannerAndroidScanningLibrary","registerPlugin","WebPlugin","Html5Qr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G,EAAE,CAAC,MAAM,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,EAAE,GAAG,+BAA+B,CAAC,GAAG;IACzL,iBAAiB,CAAC,CAAC;IACnB,aAAa,CAAC;IACd,YAAY,MAAM,gCAAgC,GAAG,CAAC,KAAK,KAAK;IAChE,gBAAgB,MAAM,aAAa,GAAG;IACtC,oBAAoB,mBAAmB;IACvC,oBAAoB,gCAAgC;IACpD,oBAAoB,qDAAqD;IACzE,iBAAiB,CAAC;IAClB,gBAAgB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACzE,oBAAoB,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC9C,oBAAoB,OAAO,CAAC,KAAK,CAAC,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAClE,oBAAoB,MAAM,CAAC,KAAK,CAAC,CAAC;IAClC,iBAAiB;IACjB,aAAa,CAAC;IACd,YAAY,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,EAAE,iBAAiB,EAAE,kCAAkC,EAAE,gCAAgC,CAAC,CAAC;IACxK,SAAS,CAAC,CAAC;IACX,KAAK;IACL;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/utils.js","esm/index.js","esm/web.js"],"sourcesContent":["import { Html5QrcodeSupportedFormats } from 'html5-qrcode';\n/**\n * Enum representing the direction of the camera to be used for barcode scanning.\n */\nexport var CapacitorBarcodeScannerCameraDirection;\n(function (CapacitorBarcodeScannerCameraDirection) {\n CapacitorBarcodeScannerCameraDirection[CapacitorBarcodeScannerCameraDirection[\"BACK\"] = 1] = \"BACK\";\n CapacitorBarcodeScannerCameraDirection[CapacitorBarcodeScannerCameraDirection[\"FRONT\"] = 2] = \"FRONT\";\n})(CapacitorBarcodeScannerCameraDirection || (CapacitorBarcodeScannerCameraDirection = {}));\n/**\n * Enum representing the orientation of the scanner during barcode scanning.\n */\nexport var CapacitorBarcodeScannerScanOrientation;\n(function (CapacitorBarcodeScannerScanOrientation) {\n CapacitorBarcodeScannerScanOrientation[CapacitorBarcodeScannerScanOrientation[\"PORTRAIT\"] = 1] = \"PORTRAIT\";\n CapacitorBarcodeScannerScanOrientation[CapacitorBarcodeScannerScanOrientation[\"LANDSCAPE\"] = 2] = \"LANDSCAPE\";\n CapacitorBarcodeScannerScanOrientation[CapacitorBarcodeScannerScanOrientation[\"ADAPTIVE\"] = 3] = \"ADAPTIVE\";\n})(CapacitorBarcodeScannerScanOrientation || (CapacitorBarcodeScannerScanOrientation = {}));\n/**\n * Enum representing a special option to indicate that all barcode types are supported.\n */\nexport var CapacitorBarcodeScannerTypeHintALLOption;\n(function (CapacitorBarcodeScannerTypeHintALLOption) {\n CapacitorBarcodeScannerTypeHintALLOption[CapacitorBarcodeScannerTypeHintALLOption[\"ALL\"] = 17] = \"ALL\";\n})(CapacitorBarcodeScannerTypeHintALLOption || (CapacitorBarcodeScannerTypeHintALLOption = {}));\n/**\n * Extends supported formats from Html5Qrcode with a special 'ALL' option,\n * indicating support for all barcode types.\n */\nexport const CapacitorBarcodeScannerTypeHint = Object.assign(Object.assign({}, Html5QrcodeSupportedFormats), CapacitorBarcodeScannerTypeHintALLOption);\n/**\n * Enum representing the library to be used for barcode scanning on Android devices.\n */\nexport var CapacitorBarcodeScannerAndroidScanningLibrary;\n(function (CapacitorBarcodeScannerAndroidScanningLibrary) {\n CapacitorBarcodeScannerAndroidScanningLibrary[\"ZXING\"] = \"zxing\";\n CapacitorBarcodeScannerAndroidScanningLibrary[\"MLKIT\"] = \"mlkit\";\n})(CapacitorBarcodeScannerAndroidScanningLibrary || (CapacitorBarcodeScannerAndroidScanningLibrary = {}));\n//# sourceMappingURL=definitions.js.map","/**\n * Predefined CSS rules for styling barcode scanner components.\n * Each object in the array defines a CSS rule, with a selector and the CSS properties to apply.\n */\nexport const barcodeScannerCss = [\n { selector: '.scanner-container-display', css: 'display: block;' },\n {\n selector: '.scanner-dialog',\n css: 'display: none; position: fixed; z-index: 999; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.4);',\n },\n {\n selector: '.scanner-dialog-inner',\n css: 'background-color: #fefefe; margin: 2% auto; padding: 20px; border: 1px solid #888; width: 96%;',\n },\n { selector: '.close-button', css: 'color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer;' },\n { selector: '.close-button:hover', css: 'color: #222;' },\n { selector: '.scanner-container-full-width', css: 'width: 100%;' },\n];\n/**\n * Dynamically applies a set of CSS rules to the document.\n * If a custom style element with a specific ID does not exist, it is created and appended to the document's head.\n * Existing rules in the style element are cleared before new ones are applied.\n * This function supports both modern and older browsers by using `CSSStyleSheet.insertRule` and `textContent` respectively.\n *\n * @param {Array<{selector: string, css: string}>} cssRules - An array of objects containing CSS selectors and styles to apply.\n */\nexport function applyCss(cssRules) {\n const styleId = 'custom-style-os-cap-barcode'; // Unique identifier for the style element.\n let styleElement = document.getElementById(styleId);\n if (!styleElement) {\n // Create and append a new style element if it does not exist.\n styleElement = document.createElement('style');\n styleElement.type = 'text/css';\n styleElement.id = styleId;\n document.head.appendChild(styleElement);\n }\n if (styleElement.sheet) {\n // Clear existing CSS rules.\n while (styleElement.sheet.cssRules.length) {\n styleElement.sheet.deleteRule(0);\n }\n // Insert new CSS rules.\n for (const { selector, css } of cssRules) {\n styleElement.sheet.insertRule(`${selector} { ${css} }`);\n }\n }\n else {\n // Fallback for older browsers using textContent.\n styleElement.textContent = '';\n for (const { selector, css } of cssRules) {\n styleElement.textContent += `${selector} { ${css} }`;\n }\n }\n}\n//# sourceMappingURL=utils.js.map","import { registerPlugin } from '@capacitor/core';\nimport { CapacitorBarcodeScannerCameraDirection, CapacitorBarcodeScannerScanOrientation, } from './definitions'; // Importing the interface for type checking.\nimport { applyCss, barcodeScannerCss } from './utils'; // Import utilities for applying CSS.\n/**\n * Registers the `OSBarcode` plugin with Capacitor.\n * For web platforms, it applies necessary CSS for the barcode scanner and dynamically imports the web implementation.\n * This allows for lazy loading of the web code only when needed, optimizing overall bundle size.\n */\nconst CapacitorBarcodeScannerImpl = registerPlugin('CapacitorBarcodeScanner', {\n web: () => {\n applyCss(barcodeScannerCss); // Apply the CSS styles necessary for the web implementation of the barcode scanner.\n return import('./web').then((m) => new m.CapacitorBarcodeScannerWeb()); // Dynamically import the web implementation and instantiate it.\n },\n});\nclass CapacitorBarcodeScanner {\n static async scanBarcode(options) {\n options.scanInstructions = options.scanInstructions || ' '; // Ensure scanInstructions is at least a space.\n options.scanButton = options.scanButton || false; // Set scanButton to false if not provided.\n options.scanText = options.scanText || ' '; // Ensure scanText is at least a space.\n options.cameraDirection = options.cameraDirection || CapacitorBarcodeScannerCameraDirection.BACK; // Set cameraDirection to 'BACK' if not provided.\n options.scanOrientation = options.scanOrientation || CapacitorBarcodeScannerScanOrientation.ADAPTIVE; // Set scanOrientation to 'ADAPTIVE' if not provided.\n return CapacitorBarcodeScannerImpl.scanBarcode(options);\n }\n}\nexport { CapacitorBarcodeScanner }; // Export the `CapacitorBarcodeScanner` class.\nexport * from './definitions'; // Re-export all exports from the definitions file.\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { Html5Qrcode } from 'html5-qrcode';\nimport { CapacitorBarcodeScannerScanOrientation, CapacitorBarcodeScannerTypeHint } from './definitions';\n/**\n * Implements OSBarcodePlugin to provide web functionality for barcode scanning.\n */\nexport class CapacitorBarcodeScannerWeb extends WebPlugin {\n /**\n * Stops the barcode scanner and hides its UI.\n * @private\n * @returns {Promise<void>} A promise that resolves when the scanner has stopped and its UI is hidden.\n */\n async stopAndHideScanner() {\n console.log(window.OSBarcodeWebScanner);\n if (window.OSBarcodeWebScanner) {\n await window.OSBarcodeWebScanner.stop();\n window.OSBarcodeWebScanner = null;\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container-dialog').style.display = 'none';\n }\n /**\n * Builds the HTML elements necessary for the barcode scanner UI.\n * This method checks if the scanner container exists before creating it to avoid duplicates.\n * It also sets up the close button to stop and hide the scanner on click.\n * @private\n */\n buildScannerElement() {\n if (document.getElementById('cap-os-barcode-scanner-container')) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container').className = 'scanner-container-display';\n return;\n }\n // Create and configure scanner container elements\n const caposbarcodescannercontainer = document.body.appendChild(document.createElement('div'));\n caposbarcodescannercontainer.id = 'cap-os-barcode-scanner-container';\n const caposbarcodescannercontainerdialog = document.createElement('div');\n caposbarcodescannercontainerdialog.id = 'cap-os-barcode-scanner-container-dialog';\n caposbarcodescannercontainerdialog.className = 'scanner-dialog';\n // Inner dialog elements including the close button and scanner view\n const caposbarcodescannercontainerdialoginner = document.createElement('div');\n caposbarcodescannercontainerdialoginner.className = 'scanner-dialog-inner';\n const caposbarcodescannercontainerdialoginnerclose = document.createElement('span');\n caposbarcodescannercontainerdialoginnerclose.id = 'cap-os-barcode-scanner-close-button';\n caposbarcodescannercontainerdialoginnerclose.className = 'close-button';\n caposbarcodescannercontainerdialoginnerclose.innerHTML = '×';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnerclose);\n const caposbarcodescannercontainerdialoginnercontainerp = document.createElement('p');\n caposbarcodescannercontainerdialoginnercontainerp.innerHTML = ' ';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainerp);\n const caposbarcodescannercontainerdialoginnercontainer = document.createElement('div');\n caposbarcodescannercontainerdialoginnercontainer.className = 'scanner-container-full-width';\n caposbarcodescannercontainerdialoginnercontainer.id = 'cap-os-barcode-scanner-container-scanner';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainer);\n caposbarcodescannercontainerdialog.appendChild(caposbarcodescannercontainerdialoginner);\n caposbarcodescannercontainer.appendChild(caposbarcodescannercontainerdialog);\n }\n /**\n * Initiates a barcode scan using the user's camera and HTML5 QR code scanner.\n * Displays the scanner UI and waits for a scan to complete or fail.\n * @param {OSBarcodeScanOptions} options Configuration options for the scan, including camera direction and UI preferences.\n * @returns {Promise<OSBarcodeScanResult>} A promise that resolves with the scan result or rejects with an error.\n */\n async scanBarcode(options) {\n this.buildScannerElement();\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('cap-os-barcode-scanner-container-dialog').style.display = 'block';\n return new Promise((resolve, reject) => {\n var _a, _b;\n const param = {\n facingMode: options.cameraDirection === 1 ? 'environment' : 'user',\n hasScannerButton: false,\n scanButton: options.scanButton === undefined ? false : options.scanButton,\n showScanLine: false,\n scanInstructions: options.scanInstructions ? options.scanInstructions : '',\n orientation: options.scanOrientation\n ? options.scanOrientation\n : CapacitorBarcodeScannerScanOrientation.PORTRAIT,\n showCameraSelection: ((_a = options.web) === null || _a === void 0 ? void 0 : _a.showCameraSelection) ? options.web.showCameraSelection : false,\n typeHint: options.hint === 17 ? undefined : options.hint,\n scannerFPS: ((_b = options.web) === null || _b === void 0 ? void 0 : _b.scannerFPS) ? options.web.scannerFPS : 50,\n };\n let alreadyCancelled = false;\n const closeButton = document.getElementById('cap-os-barcode-scanner-close-button');\n if (closeButton) {\n closeButton.onclick = async () => {\n if (alreadyCancelled)\n return;\n alreadyCancelled = true;\n await this.stopAndHideScanner();\n reject(new Error('Couldn’t scan because the process was cancelled.'));\n };\n }\n // Set up and start the scanner\n const scannerElement = document.getElementById('cap-os-barcode-scanner-container-scanner');\n if (!scannerElement) {\n throw new Error('Scanner Element is required for web');\n }\n window.OSBarcodeWebScanner = new Html5Qrcode(scannerElement.id, {\n formatsToSupport: param.typeHint !== undefined ? [param.typeHint] : undefined,\n verbose: undefined,\n });\n const Html5QrcodeConfig = {\n fps: param.scannerFPS,\n qrbox: scannerElement.getBoundingClientRect().width * (9 / 16) - 10,\n aspectRatio: 16 / 9,\n videoConstraints: {\n focusMode: 'continuous',\n height: { min: 576, ideal: 1920 },\n deviceId: undefined,\n facingMode: param.facingMode,\n },\n };\n // Success and error callbacks for the scanner\n const OSBarcodeWebScannerSuccessCallback = (decodedText, decodedResult) => {\n var _a, _b;\n this.stopAndHideScanner();\n resolve({\n ScanResult: decodedText,\n format: (_b = (_a = decodedResult.result.format) === null || _a === void 0 ? void 0 : _a.format) !== null && _b !== void 0 ? _b : CapacitorBarcodeScannerTypeHint.ALL,\n });\n };\n const OSBarcodeWebScannerErrorCallback = (error) => {\n const allowedErrors = [\n 'NotFoundException',\n 'No barcode or QR code detected',\n 'No MultiFormat Readers were able to detect the code',\n ];\n if (!allowedErrors.find((e) => error.indexOf(e) !== -1)) {\n this.stopAndHideScanner();\n console.error(`[Scanner Web Error] ${error}`);\n reject(error);\n }\n };\n window.OSBarcodeWebScanner.start({ facingMode: param.facingMode }, Html5QrcodeConfig, OSBarcodeWebScannerSuccessCallback, OSBarcodeWebScannerErrorCallback);\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["CapacitorBarcodeScannerCameraDirection","CapacitorBarcodeScannerScanOrientation","CapacitorBarcodeScannerTypeHintALLOption","Html5QrcodeSupportedFormats","CapacitorBarcodeScannerAndroidScanningLibrary","registerPlugin","WebPlugin","Html5Qrcode"],"mappings":";;;IACA;IACA;IACA;AACWA,4DAAuC;IAClD,CAAC,UAAU,sCAAsC,EAAE;IACnD,IAAI,sCAAsC,CAAC,sCAAsC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;IACxG,IAAI,sCAAsC,CAAC,sCAAsC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC;IAC1G,CAAC,EAAEA,8CAAsC,KAAKA,8CAAsC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC5F;IACA;IACA;AACWC,4DAAuC;IAClD,CAAC,UAAU,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AAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,EAAE,GAAG,+BAA+B,CAAC,GAAG;IACzL,iBAAiB,CAAC,CAAC;IACnB,aAAa,CAAC;IACd,YAAY,MAAM,gCAAgC,GAAG,CAAC,KAAK,KAAK;IAChE,gBAAgB,MAAM,aAAa,GAAG;IACtC,oBAAoB,mBAAmB;IACvC,oBAAoB,gCAAgC;IACpD,oBAAoB,qDAAqD;IACzE,iBAAiB,CAAC;IAClB,gBAAgB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACzE,oBAAoB,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC9C,oBAAoB,OAAO,CAAC,KAAK,CAAC,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAClE,oBAAoB,MAAM,CAAC,KAAK,CAAC,CAAC;IAClC,iBAAiB;IACjB,aAAa,CAAC;IACd,YAAY,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,EAAE,iBAAiB,EAAE,kCAAkC,EAAE,gCAAgC,CAAC,CAAC;IACxK,SAAS,CAAC,CAAC;IACX,KAAK;IACL;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/barcode-scanner",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.5",
|
|
4
4
|
"description": "Capacitor plugin using Outsystems Barcode libs",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"src": "android"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "64c55a086b94d2f94c624e9acaea6a184017f490"
|
|
86
86
|
}
|