{"_id":"@asutrick/react-dymo-hooks","_rev":"1-d34f5a3e1b0ed6df0314f9f6f75b488e","name":"@asutrick/react-dymo-hooks","dist-tags":{"latest":"3.0.0"},"versions":{"2.0.5":{"name":"@asutrick/react-dymo-hooks","version":"2.0.5","author":{"name":"apenab"},"license":"MIT","_id":"@asutrick/react-dymo-hooks@2.0.5","maintainers":[{"name":"asutrick","email":"austindsutrick@gmail.com"}],"homepage":"https://github.com/asutrick/react-dymo#readme","bugs":{"url":"https://github.com/asutrick/react-dymo/issues"},"dist":{"shasum":"7e64f7887077c9bf0a17b073731f8bf81d9672f4","tarball":"https://registry.npmjs.org/@asutrick/react-dymo-hooks/-/react-dymo-hooks-2.0.5.tgz","fileCount":6,"integrity":"sha512-n1ZUxJr3EOQ8UAr9400RRYm65zdWXw/KiXlSeVW14tCAMkPJSEK0na/mFh/7i5qR6DWn8/Xz90zWUvqv9v0DkA==","signatures":[{"sig":"MEUCIQDyf1BqwyhiMikzW+ENZAEulaYP38hjutIw/temwwxhCgIgUwmRNgUNXnG59kSmfo6vPoP4O4ecfO013huEa4gDrgE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":136344},"main":"dist/index.js","module":"dist/index.modern.js","source":"src/index.js","engines":{"node":">=10"},"gitHead":"11b98a79263ff3f7dfee000fd68808169b87be29","scripts":{"test":"run-s test:unit test:lint test:build","build":"microbundle-crl --no-compress --format modern,cjs","start":"microbundle-crl watch --no-compress --format modern,cjs","deploy":"gh-pages -d example/build","prepare":"run-s build","predeploy":"cd example && yarn install && yarn run build","test:lint":"eslint .","test:unit":"cross-env CI=1 react-scripts test --env=jsdom","test:build":"run-s build","test:watch":"react-scripts test --env=jsdom"},"_npmUser":{"name":"asutrick","email":"austindsutrick@gmail.com"},"repository":{"url":"git+https://github.com/asutrick/react-dymo.git","type":"git"},"_npmVersion":"8.5.5","description":"Collections of react hooks to handle the Dymo LabelWriter web service.","directories":{},"_nodeVersion":"16.15.0","dependencies":{"axios":"^0.21.1","react":"^16.13.1","react-dom":"^16.13.1","react-xml-parser":"^1.1.6"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^6.8.0","gh-pages":"^2.2.0","prettier":"^2.0.4","cross-env":"^7.0.2","npm-run-all":"^4.1.5","babel-eslint":"^10.0.3","react-scripts":"^3.4.1","microbundle-crl":"^0.13.10","eslint-plugin-node":"^11.0.0","eslint-plugin-react":"^7.17.0","eslint-plugin-import":"^2.18.2","eslint-plugin-promise":"^4.2.1","eslint-config-prettier":"^6.7.0","eslint-config-standard":"^14.1.0","eslint-plugin-prettier":"^3.1.1","eslint-plugin-standard":"^4.0.1","eslint-plugin-react-hooks":"^4.0.4","eslint-config-standard-react":"^9.2.0"},"peerDependencies":{"react":"^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/react-dymo-hooks_2.0.5_1694102422157_0.8660481899864709","host":"s3://npm-registry-packages"}},"3.0.0":{"name":"@asutrick/react-dymo-hooks","version":"3.0.0","description":"Collections of react hooks to handle the Dymo LabelWriter web service.","author":{"name":"apenab"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ASutrick/react-dymo.git"},"main":"dist/index.js","module":"dist/index.modern.js","source":"src/index.js","engines":{"node":">=10"},"scripts":{"build":"microbundle-crl --no-compress --format modern,cjs","start":"microbundle-crl watch --no-compress --format modern,cjs","prepare":"run-s build","test":"run-s test:unit test:lint test:build","test:build":"run-s build","test:lint":"eslint .","test:unit":"cross-env CI=1 react-scripts test --env=jsdom","test:watch":"react-scripts test --env=jsdom","predeploy":"cd example && yarn install && yarn run build","deploy":"gh-pages -d example/build"},"devDependencies":{"@babel/eslint-parser":"^7.25.1","cross-env":"^7.0.3","eslint":"^8.48.0","eslint-config-prettier":"^9.1.0","eslint-config-standard":"^17.1.0","eslint-config-standard-react":"^13.0.0","eslint-plugin-import":"^2.29.1","eslint-plugin-node":"^11.1.0","eslint-plugin-prettier":"^5.2.1","eslint-plugin-promise":"^6.0.0","eslint-plugin-react":"^7.35.0","eslint-plugin-react-hooks":"^4.6.2","eslint-plugin-standard":"^5.0.0","gh-pages":"^6.1.1","microbundle-crl":"^0.13.11","npm-run-all":"^4.1.5","prettier":"^3.3.3","react-scripts":"^5.0.1"},"dependencies":{"axios":"^1.7.4","react":"^18.3.1","react-dom":"^18.3.1","react-xml-parser":"^1.1.8"},"_id":"@asutrick/react-dymo-hooks@3.0.0","gitHead":"3e8243cbfda6dcad1fd51ee5921885bdc6a315fa","bugs":{"url":"https://github.com/ASutrick/react-dymo/issues"},"homepage":"https://github.com/ASutrick/react-dymo#readme","_nodeVersion":"20.13.1","_npmVersion":"10.5.2","dist":{"integrity":"sha512-IU64GZ1nB+va4HxiWMGWa2V2a21f39WZzkjyn8qQi4NywnbkmLw2lMjXQQmNFtt2qlgOTJi3YdIB8dRQ57Y4YQ==","shasum":"86e35c56a3e0817c8fd8f2ec90c439ce9314d7f6","tarball":"https://registry.npmjs.org/@asutrick/react-dymo-hooks/-/react-dymo-hooks-3.0.0.tgz","fileCount":6,"unpackedSize":138494,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAhek4bULkVoWzozxZU8WSFVqTG0EYz4Aj3P4UY0ctSHAiBQ0G87LUvW9P6gWxNELq3V9TjNPKau1lAOHe3Ksy8oQQ=="}]},"_npmUser":{"name":"asutrick","email":"austindsutrick@gmail.com"},"directories":{},"maintainers":[{"name":"asutrick","email":"austindsutrick@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-dymo-hooks_3.0.0_1724091822166_0.22275295586648935"},"_hasShrinkwrap":false}},"time":{"created":"2023-09-07T16:00:22.076Z","modified":"2024-08-19T18:23:42.551Z","2.0.5":"2023-09-07T16:00:22.401Z","3.0.0":"2024-08-19T18:23:42.352Z"},"bugs":{"url":"https://github.com/ASutrick/react-dymo/issues"},"author":{"name":"apenab"},"license":"MIT","homepage":"https://github.com/ASutrick/react-dymo#readme","repository":{"type":"git","url":"git+https://github.com/ASutrick/react-dymo.git"},"description":"Collections of react hooks to handle the Dymo LabelWriter web service.","maintainers":[{"name":"asutrick","email":"austindsutrick@gmail.com"}],"readme":"# react-dymo\r\n\r\n> Collections of javascript and react utilities to handle the Dymo LabelWriter web service.\r\n\r\n[![NPM](https://img.shields.io/npm/v/react-dymo-hooks.svg)](https://www.npmjs.com/package/react-dymo-hooks) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\r\n\r\n## Install\r\n\r\n```bash\r\nnpm install --save react-dymo-hooks\r\n```\r\n\r\nor\r\n\r\n```bash\r\nyarn add react-dymo-hooks\r\n```\r\n\r\n## API\r\n\r\n### `printLabel()`\r\n\r\nPrint Dymo labels\r\n\r\n#### Arguments\r\n\r\n- {string} printerName - The Dymo Printer to print on\r\n- {string} labelXml - Label XML parsed to string\r\n- {string} labelSetXml - LabelSet to print. LabelSet is used to print multiple labels with same layout but different data, e.g. multiple addresses.\r\n\r\n### `useDymoCheckService()`\r\n\r\nReturn the status of DYMO Label Web Service\r\n\r\n#### Arguments\r\n\r\n- port: The port of running DYMO Label Web Service. (For defualt is the 41951)\r\n\r\n#### Returns\r\n\r\n- status: `\"initial\" | \"loading\" | \"success\" | \"error\"` Status of DYMO Label Web Service.\r\n\r\n### `useDymoFetchPrinters()`\r\n\r\nReturns the available DYMO Labelwriter Printer\r\n\r\n#### Arguments\r\n\r\n- statusDymoService: The status of DYMO Label Web Service. (Use the status returned fot the `useDymoCheckService()` hook)\r\n- modelPrinter: The model of label writer printer.\r\n- port: The port of running DYMO Label Web Service. (For defualt is the 41951)\r\n\r\n#### Returns\r\n\r\nObject containing:\r\n\r\n- statusFetchPrinters: `\"initial\" | \"loading\" | \"success\" | \"error\"` Status of loading printers.\r\n- printers: The list of available DYMO Printer.\r\n- error.\r\n\r\n### `useDymoOpenLabel()`\r\n\r\nRender Label\r\n\r\n#### Arguments\r\n\r\n- statusDymoService: The status of DYMO Label Web Service. (Use the status returned fot the `useDymoCheckService()` hook)\r\n- labelXML: XML file.\r\n- port: The port of running DYMO Label Web Service. (For defualt is the 41951)\r\n\r\n#### Returns\r\n\r\nObject containing:\r\n\r\n- statusOpenLabel: `\"initial\" | \"loading\" | \"success\" | \"error\"` Status of open label.\r\n- label.\r\n- error.\r\n\r\n## Run examples\r\n\r\n> Inside the root directory project\r\n\r\n1. Switch to the directory `example/`\r\n2. `yarn install` or `npm install`\r\n3. `yarn run start` or `npm run-script start`\r\n\r\n## Examples\r\n\r\n### Print a Dymo Label\r\n\r\n```jsx\r\nimport {printLabel} from \"react-dymo-hooks\";\r\n\r\nasync function handlePrintSingleLabel(printerName, labelXml) {\r\n  try {\r\n    const response = await printLabel(printerName, labelXml);\r\n    console.info(response);\r\n  } catch (error) {\r\n    console.error(error);\r\n  }\r\n}\r\n\r\n<button onClick={() => handlePrintLabel(printer, xml)} />;\r\n```\r\n\r\n```jsx\r\nimport {useDymoOpenLabel, useDymoCheckService} from \"react-dymo-hooks\";\r\n\r\nconst DymoLabelPreview = () => {\r\n  const statusDymoService = useDymoCheckService();\r\n  const {label, statusOpenLabel, errorOpenLabel} = useDymoOpenLabel(statusDymoService, xmlFile);\r\n\r\n  if (label) {\r\n    return <img src={\"data:image/png;base64,\" + label} alt=\"dymo label preview\" />;\r\n  } else {\r\n    return null;\r\n  }\r\n};\r\n```\r\n\r\n## License\r\n\r\nMIT © [apenab](https://github.com/apenab)\r\n","readmeFilename":"README.md"}