@capacitor/barcode-scanner 2.2.1 → 2.2.2

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.
@@ -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 {\n selector: \".close-button\",\n css: \"color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer;\",\n },\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 =\n options.cameraDirection || CapacitorBarcodeScannerCameraDirection.BACK; // Set cameraDirection to 'BACK' if not provided.\n options.scanOrientation =\n options.scanOrientation ||\n 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","/* eslint-env browser */\nimport { 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 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 document.getElementById(\"cap-os-barcode-scanner-container\").className =\n \"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 =\n \"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 = \"&times;\";\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnerclose);\n const caposbarcodescannercontainerdialoginnercontainerp = document.createElement(\"p\");\n caposbarcodescannercontainerdialoginnercontainerp.innerHTML = \"&nbsp;\";\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainerp);\n const caposbarcodescannercontainerdialoginnercontainer = document.createElement(\"div\");\n caposbarcodescannercontainerdialoginnercontainer.className =\n \"scanner-container-full-width\";\n caposbarcodescannercontainerdialoginnercontainer.id =\n \"cap-os-barcode-scanner-container-scanner\";\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnercontainer);\n caposbarcodescannercontainerdialog.appendChild(caposbarcodescannercontainerdialoginner);\n caposbarcodescannercontainer.appendChild(caposbarcodescannercontainerdialog);\n caposbarcodescannercontainerdialoginnerclose.onclick =\n 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 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\n ? options.scanInstructions\n : \"\",\n orientation: options.scanOrientation\n ? options.scanOrientation\n : CapacitorBarcodeScannerScanOrientation.PORTRAIT,\n showCameraSelection: ((_a = options.web) === null || _a === void 0 ? void 0 : _a.showCameraSelection)\n ? options.web.showCameraSelection\n : 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":";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IACzE,oBAAoB,IAAI,CAAC,kBAAkB,EAAE;IAC7C,oBAAoB,OAAO,CAAC,KAAK,CAAC,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC,CAAC;IACjE,oBAAoB,MAAM,CAAC,KAAK,CAAC;IACjC,gBAAgB;IAChB,YAAY,CAAC;IACb,YAAY,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,EAAE,iBAAiB,EAAE,kCAAkC,EAAE,gCAAgC,CAAC;IACvK,QAAQ,CAAC,CAAC;IACV,IAAI;IACJ;;;;;;;;;;;;;;;;"}
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 = '&times;';\n caposbarcodescannercontainerdialoginner.appendChild(caposbarcodescannercontainerdialoginnerclose);\n const caposbarcodescannercontainerdialoginnercontainerp = document.createElement('p');\n caposbarcodescannercontainerdialoginnercontainerp.innerHTML = '&nbsp;';\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":";;;IACA;IACA;IACA;AACWA;IACX,CAAC,UAAU,sCAAsC,EAAE;IACnD,IAAI,sCAAsC,CAAC,sCAAsC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM;IACvG,IAAI,sCAAsC,CAAC,sCAAsC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO;IACzG,CAAC,EAAEA,8CAAsC,KAAKA,8CAAsC,GAAG,EAAE,CAAC,CAAC;IAC3F;IACA;IACA;AACWC;IACX,CAAC,UAAU,sCAAsC,EAAE;IACnD,IAAI,sCAAsC,CAAC,sCAAsC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU;IAC/G,IAAI,sCAAsC,CAAC,sCAAsC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW;IACjH,IAAI,sCAAsC,CAAC,sCAAsC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU;IAC/G,CAAC,EAAEA,8CAAsC,KAAKA,8CAAsC,GAAG,EAAE,CAAC,CAAC;IAC3F;IACA;IACA;AACWC;IACX,CAAC,UAAU,wCAAwC,EAAE;IACrD,IAAI,wCAAwC,CAAC,wCAAwC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK;IAC1G,CAAC,EAAEA,gDAAwC,KAAKA,gDAAwC,GAAG,EAAE,CAAC,CAAC;IAC/F;IACA;IACA;IACA;AACY,UAAC,+BAA+B,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAEC,uCAA2B,CAAC,EAAED,gDAAwC;IACrJ;IACA;IACA;AACWE;I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gBAAgB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE;IACzE,oBAAoB,IAAI,CAAC,kBAAkB,EAAE;IAC7C,oBAAoB,OAAO,CAAC,KAAK,CAAC,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC,CAAC;IACjE,oBAAoB,MAAM,CAAC,KAAK,CAAC;IACjC,gBAAgB;IAChB,YAAY,CAAC;IACb,YAAY,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,EAAE,iBAAiB,EAAE,kCAAkC,EAAE,gCAAgC,CAAC;IACvK,QAAQ,CAAC,CAAC;IACV,IAAI;IACJ;;;;;;;;;;;;;;;;"}
@@ -5,11 +5,11 @@ import OSBarcodeLib
5
5
 
6
6
  @objc(CapacitorBarcodeScannerPlugin)
7
7
  public class CapacitorBarcodeScannerPlugin: CAPPlugin, CAPBridgedPlugin {
8
- public let identifier = "CapacitorBarcodeScannerPlugin"
9
- public let jsName = "CapacitorBarcodeScanner"
8
+ public let identifier = "CapacitorBarcodeScannerPlugin"
9
+ public let jsName = "CapacitorBarcodeScanner"
10
10
  public let pluginMethods: [CAPPluginMethod] = [
11
- CAPPluginMethod(name: "scanBarcode", returnType: CAPPluginReturnPromise)
12
- ]
11
+ CAPPluginMethod(name: "scanBarcode", returnType: CAPPluginReturnPromise),
12
+ ]
13
13
  var manager: OSBARCManagerProtocol?
14
14
 
15
15
  override public func load() {
@@ -2,6 +2,15 @@ import XCTest
2
2
  @testable import Plugin
3
3
 
4
4
  class OSBarcodeTests: XCTestCase {
5
+ override func setUp() {
6
+ super.setUp()
7
+ // Put setup code here. This method is called before the invocation of each test method in the class.
8
+ }
9
+
10
+ override func tearDown() {
11
+ // Put teardown code here. This method is called after the invocation of each test method in the class.
12
+ super.tearDown()
13
+ }
5
14
 
6
15
  func testEcho() {
7
16
  // This is an example of a functional test case for a plugin.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/barcode-scanner",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "Capacitor plugin using Outsystems Barcode libs",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -41,7 +41,7 @@
41
41
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
42
42
  "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
43
43
  "eslint": "eslint . --ext ts",
44
- "prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
44
+ "prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
45
45
  "swiftlint": "node-swiftlint",
46
46
  "docgen": "docgen --api CapacitorBarcodeScannerPlugin --output-readme README.md --output-json dist/docs.json",
47
47
  "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
@@ -53,25 +53,25 @@
53
53
  "html5-qrcode": "2.3.8"
54
54
  },
55
55
  "devDependencies": {
56
- "@capacitor/android": "^8.0.0",
57
- "@capacitor/core": "^8.0.0",
58
- "@capacitor/docgen": "0.3.0",
59
- "@capacitor/ios": "^8.0.0",
60
- "@ionic/swiftlint-config": "^2.0.0",
61
- "@types/node": "^24.10.1",
62
- "@typescript-eslint/eslint-plugin": "^8.47.0",
63
- "@typescript-eslint/parser": "^8.47.0",
64
- "eslint": "^9.39.1",
65
- "eslint-config-prettier": "^10.1.8",
66
- "prettier": "^3.6.2",
67
- "prettier-plugin-java": "^2.7.7",
68
- "rimraf": "^6.1.0",
69
- "rollup": "^4.53.2",
70
- "swiftlint": "^2.0.0",
71
- "typescript": "^5.9.3"
56
+ "@capacitor/android": "^7.0.0",
57
+ "@capacitor/core": "^7.0.0",
58
+ "@capacitor/docgen": "^0.2.2",
59
+ "@capacitor/ios": "^7.0.0",
60
+ "@ionic/swiftlint-config": "^1.1.2",
61
+ "@types/node": "~20.12.4",
62
+ "@typescript-eslint/eslint-plugin": "^5.59.2",
63
+ "@typescript-eslint/parser": "^5.59.2",
64
+ "eslint": "^8.57.0",
65
+ "eslint-config-prettier": "^8.8.0",
66
+ "prettier": "^2.8.8",
67
+ "prettier-plugin-java": "~2.1.0",
68
+ "rimraf": "^3.0.2",
69
+ "rollup": "^2.78.1",
70
+ "swiftlint": "^1.0.2",
71
+ "typescript": "~5.7.2"
72
72
  },
73
73
  "peerDependencies": {
74
- "@capacitor/core": ">=8.0.0"
74
+ "@capacitor/core": ">=7.0.0"
75
75
  },
76
76
  "swiftlint": "@ionic/swiftlint-config",
77
77
  "capacitor": {
@@ -81,6 +81,5 @@
81
81
  "android": {
82
82
  "src": "android"
83
83
  }
84
- },
85
- "gitHead": "9af519ae8ff25e769b05dc265567c5695a196926"
84
+ }
86
85
  }