{"_id":"@caisy/posthog-js","_rev":"1-0b253ceb9f2d47a7af75158af4bcbf91","name":"@caisy/posthog-js","dist-tags":{"latest":"1.33.0-caisy"},"versions":{"1.33.0-caisy":{"name":"@caisy/posthog-js","version":"1.33.0-caisy","description":"Posthog-js allows you to automatically capture usage and send events to PostHog.","repository":{"type":"git","url":"https://github.com/PostHog/posthog-js"},"author":{"name":"hey@posthog.com"},"license":"MIT","scripts":{"start":"yarn build-rollup -w","build":"yarn build-rollup && yarn build-react","build-rollup":"yarn build:prepare-types && rollup -c","build-react":"cd react; yarn; yarn build;","lint":"eslint src","build:prepare-types":"yarn build:prepare-types:tsc && yarn build:prepare-types:copy && yarn build:prepare-types:fix && yarn build:prepare-types:rename-1 && yarn build:prepare-types:rename-2 && yarn build:prepare-types:rename-3 && yarn build:prepare-types:rename-4 && yarn build:prepare-types:rename-5 && yarn build:prepare-types:rename-6","build:prepare-types:tsc":"rm -rf lib && tsc -b","build:prepare-types:copy":"rm -rf lib/rrweb && rm -rf lib/rrweb-snapshot && cp -a node_modules/rrweb lib/rrweb; cp -a node_modules/rrweb-snapshot/typings lib/rrweb-snapshot","build:prepare-types:fix":"cd lib/rrweb/typings/replay && cat index.d.ts |grep -v 'styles/style.css' > x && mv x index.d.ts","build:prepare-types:rename-1":"cd lib/rrweb/typings/record && sed 's/rrweb-snapshot/..\\/..\\/..\\/rrweb-snapshot/g' iframe-manager.d.ts > x && mv x iframe-manager.d.ts","build:prepare-types:rename-2":"cd lib/rrweb/typings/replay && sed 's/rrweb-snapshot/..\\/..\\/..\\/rrweb-snapshot/g' virtual-styles.d.ts > x && mv x virtual-styles.d.ts","build:prepare-types:rename-3":"cd lib/rrweb/typings && sed 's/rrweb-snapshot/..\\/..\\/rrweb-snapshot/g' types.d.ts > x && mv x types.d.ts","build:prepare-types:rename-4":"cd lib/rrweb/typings && sed 's/rrweb-snapshot/..\\/..\\/rrweb-snapshot/g' utils.d.ts > x && mv x utils.d.ts","build:prepare-types:rename-5":"cd lib/src/extensions && sed 's/rrweb\\/typings/..\\/..\\/rrweb\\/typings/g' sessionrecording.d.ts > x && mv x sessionrecording.d.ts","build:prepare-types:rename-6":"cd lib/src && sed 's/rrweb-snapshot/..\\/rrweb-snapshot/g' types.d.ts > x && mv x types.d.ts","prettier":"prettier --write src/**/*","prepublishOnly":"yarn lint && yarn test && yarn build && yarn test-react","test":"jest src","test-react":"cd react; yarn test","test-watch":"jest --watch src","cypress":"cypress open","prepare":"husky install"},"main":"dist/module.js","module":"dist/es.js","types":"dist/module.d.ts","dependencies":{"@sentry/types":"^7.2.0","fflate":"^0.4.1","rrweb-snapshot":"^1.1.14"},"devDependencies":{"@babel/core":"7.18.9","@babel/preset-env":"7.18.9","@babel/preset-typescript":"^7.18.6","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.3.0","@rollup/plugin-typescript":"^8.3.3","@typescript-eslint/eslint-plugin":"^5.30.7","@typescript-eslint/parser":"^5.30.7","babel-eslint":"10.1.0","babel-jest":"^26.6.3","cypress":"10.3.1","eslint":"8.20.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-react":"^7.30.1","eslint-plugin-react-hooks":"^4.6.0","fast-check":"^2.17.0","given2":"^2.1.7","husky":"^8.0.1","jest":"^27.5.1","jsdom":"16.5.0","jsdom-global":"3.0.2","lint-staged":"^10.2.11","localStorage":"1.0.4","node-fetch":"^2.6.1","posthog-js":"link:.","prettier":"^2.7.1","rollup":"^2.77.0","rollup-plugin-dts":"^4.2.2","rollup-plugin-terser":"^7.0.2","rrweb":"^1.1.3","sinon":"9.0.2","testcafe":"^1.19.0","testcafe-browser-provider-browserstack":"^1.14.0","tslib":"^2.4.0","typescript":"^4.7.4"},"lint-staged":{"*.{ts,tsx,js,json}":"prettier --write","*.js":"eslint src --fix","*.{ts,tsx}":["eslint src --fix"]},"licenseText":"Copyright 2020 Posthog / Hiberly, Inc.\n\nCopyright 2015 Mixpanel, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this work except in compliance with the License.\nYou may obtain a copy of the License below, or at:\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@caisy/posthog-js@1.33.0-caisy","dist":{"shasum":"d50168f04e91d4e2fa92b685a0892a39c484b036","integrity":"sha512-PIJiWTyrg9CYg/eXX9uF67hjApysSCoG3pP0NeH9g+EOCw8FQdiog/7jNAXQlfTbqtKsU/5t9Ti3XudrmMMvjg==","tarball":"https://registry.npmjs.org/@caisy/posthog-js/-/posthog-js-1.33.0-caisy.tgz","fileCount":312,"unpackedSize":8538327,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDkhnc89OQd9N1fHqa617rsdGITLK0C1Jc/qmD/YucOaAiB0/PCjLqiTWy7INQMKJhVBzvaj+9cMyef6Fy1iQ38ZQA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjWCcDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoIKBAAkLa1Gb0jCZstL34/n8e57Bnb1x5gI+lztSWCwVIXI7IAXUTw\r\nI5pTL4mA/7sC9j8RrNG9pPjgpkUoa/gKQ/GiMitZuVQxprdLgB6I1gpBLOy4\r\nxss2TX+vguwrSJGV0kePXzG837CMRMmZBmCLrJHhrWKsTuZl86kdt1zR0FGZ\r\nD28bb9pvuUJiIvsLMyXpeqZXPw1omKXGfI8nf3phTwvOTrafOBQVRMWxlEMy\r\n3DDHCMPbTIiJmxSNaoHXRet9iD1kmNNU5pkySrRVpWl3iyH+mQbNMTcUf4Kh\r\nZA8S1Q9dJCFOzitDWNt8/j3fGmCglqs0BoItrgX8AhCAvW3XnO0UZL4dphHK\r\na+7mt4mdFpQKRQ6gqdU9XJ8XpOZgcRrt3CR4Yr8okd3W75FcYnyDuRqOye+7\r\ne1UTCbe2d5izPkmcD0HBg98RZWd3Kk4mwD1HwSg0ZjPALEdT55YK3Z9Id0vG\r\nqBNDb2u3Ct/MDoWKYv5j0EvaroNt/xbERpKXRqjy3ut2XkPMVg/8OGxkYpqq\r\nirJDLdqhZ8c8AqvzuZNVtDtEPvIW/2qAr6hnytklcHkPHtiKIwHFFUxA7pn1\r\n++IG9jTF+mGvfN/nJ8SwGt970lqIImTfoRAaRe62S5TfSZ9/+/xSvozOxbYD\r\nvH4JeTLWLwFxJr68ipZLrUG6DA5eWFQz+0Q=\r\n=kizO\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"m.gruber","email":"m.gruber@cyclus.digital"},"directories":{},"maintainers":[{"name":"radicaa","email":"a.radic@cyclus.digital"},{"name":"m.gruber","email":"m.gruber@cyclus.digital"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/posthog-js_1.33.0-caisy_1666721538762_0.8121815486596031"},"_hasShrinkwrap":false}},"time":{"created":"2022-10-25T18:12:18.703Z","1.33.0-caisy":"2022-10-25T18:12:18.975Z","modified":"2023-01-26T14:20:44.125Z"},"maintainers":[{"email":"m.gruber@cyclus.digital","name":"m.gruber"}],"description":"Posthog-js allows you to automatically capture usage and send events to PostHog.","repository":{"type":"git","url":"https://github.com/PostHog/posthog-js"},"author":{"name":"hey@posthog.com"},"license":"MIT","readme":"# PostHog Browser JS Library\n\n[![npm package](https://img.shields.io/npm/v/posthog-js?style=flat-square)](https://www.npmjs.com/package/posthog-js)\n[![MIT License](https://img.shields.io/badge/License-MIT-red.svg?style=flat-square)](https://opensource.org/licenses/MIT)\n\nPlease see [PostHog Docs](https://posthog.com/docs).\nSpecifically, [browser JS library details](https://posthog.com/docs/libraries/js).\n\n## Testing\n\nUnit tests: run `yarn test`.\nCypress: run `yarn serve` to have a test server running and separately `yarn cypress` to launch Cypress test engine.\n\n### Running TestCafe E2E tests with BrowserStack\n\nTesting on IE11 requires a bit more setup.\n\n1. Run `posthog` locally on port 8000 (`DEBUG=1 TEST=1 ./bin/start`).\n2. Run `python manage.py setup_dev --no-data` on posthog repo, which sets up a demo account.\n3. Optional: rebuild array.js on changes: `nodemon -w src/ --exec bash -c \"yarn build-rollup\"`.\n4. Export browserstack credentials: `export BROWSERSTACK_USERNAME=xxx BROWSERSTACK_ACCESS_KEY=xxx`.\n5. Run tests: `npx testcafe \"browserstack:ie\" testcafe/e2e.spec.js`.\n\n### Tiers of testing\n\n1. Unit tests - this verifies the behavior of the library in bite-sized chunks. Keep this coverage close to 100%, test corner cases and internal behavior here\n2. Cypress tests - integrates with a real chrome browser and is capable of testing timing, browser requests, etc. Useful for testing high-level library behavior, ordering and verifying requests. We shouldn't aim for 100% coverage here as it's impossible to test all possible combinations.\n3. TestCafe E2E tests - integrates with a real posthog instance sends data to it. Hardest to write and maintain - keep these very high level\n\n## Developing together with another repo\n\n### Using Yarn link\nUse [`yarn link`](https://classic.yarnpkg.com/en/docs/cli/link/). Run `yarn link` in `posthog-js`, and then `yarn link posthog-js` in `posthog`. Once you're done, remember to `yarn unlink posthog-js` in `posthog`, and `yarn unlink` in `posthog-js`.\n\nAn alternative is to update dependency in package.json to e.g. `\"posthog-js\": \"link:../posthog-js\"`, `yarn` and run `yarn build && yarn build-module`\n\n#### Developing with main PostHog repo\n\nThe `posthog-js` snippet for a website loads static js from the main `PostHog/posthog` repo. Which means, when testing the snippet with a website, there's a bit of extra setup required:\n\n1. Run `PostHog/posthog` locally\n2. Link the `posthog-js` dependency to your local version (see above)\n3. Run `yarn serve` in `posthog-js`. (This ensures `dist/array.js` is being generated)\n4. In your locally running `PostHog/posthog` build, run `yarn copy-scripts`. (This copies the scripts generated in step 3 to the static assets folder for `PostHog/posthog`)\n\nFurther, it's a good idea to modify `start-http` script to add development mode: `webpack serve --mode development`, which doesn't minify the resulting js (which you can then read in your browser).\n\n### Using Yalc (Alternative to yarn link)\n\nRun `npm install -g yalc`\n\n* In the posthog-js repo\n    * Run `yalc publish`\n* In the posthog repo\n    * Run `yalc add posthog-js`\n    * Run `yarn`\n    * Run `yarn copy-scripts`\n\n#### When making changes\n\n* In the posthog-js repo\n    * Run `yalc publish`\n* In the posthog repo\n    * Run `yalc update`\n    * Run `yarn`\n    * Run `yarn copy-scripts`\n\n#### To remove the local package\n\n* In the posthog repo\n    * run `yalc remove posthog-js`\n    * run `yarn install`\n\n\n## Releasing a new version\n\nJust bump up `version` in `package.json` on the main branch and the new version will be published automatically,\nwith a matching PR in the [main PostHog repo](https://github.com/posthog/posthog) created.\n\nIt's advised to use `bump patch/minor/major` label on PRs - that way the above will be done automatically\nwhen the PR is merged.\n\nCourtesy of GitHub Actions.\n\n### Manual steps\n\nTo release a new version, make sure you're logged into npm (`npm login`).\n\nWe tend to follow the following steps:\n\n1. Merge your changes into master.\n2. Release changes as a beta version:\n    - `npm version 1.x.x-beta.0`\n    - `npm publish --tag beta`\n    - `git push --tags`\n3. Create a PR linking to this version in the [main PostHog repo](https://github.com/posthog/posthog).\n4. Once deployed and tested, write up CHANGELOG.md, and commit.\n5. Release a new version:\n    - `npm version 1.x.x`\n    - `npm publish`\n    - `git push --tags`\n6. Create a PR linking to this version in the [main PostHog repo](https://github.com/posthog/posthog).\n\n## Questions?\n\n### [Join our Slack community.](https://posthog.com/slack)\n","readmeFilename":"README.md"}