{"_id":"cart","_rev":"22-4a6f75f6d6b9ea1bbd3f640d35eec4b0","name":"cart","description":"Headless cart management library","dist-tags":{"latest":"1.1.2"},"versions":{"1.0.0":{"name":"cart","version":"1.0.0","description":"Connect session store using supermarket","modules":{"index":"./lib/cart.js"},"keywords":["connect","expresso","http sessions"],"maintainers":[{"name":"Peteris Krumins","email":"peteris.krumins@gmail.com","web":"http://www.catonmat.net","twitter":"pkrumins"}],"repository":{"type":"git","url":"http://github.com/pkrumins/supermarket-cart.git"},"engines":{"node":">=0.2.0"},"dependencies":{"supermarket":">=1.0.5"},"_id":"cart@1.0.0","_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"https://registry.npmjs.org/cart/-/cart-1.0.0.tgz","shasum":"e3ae7dee4377f37fff3bdcdd3fd1fef0011e279c","integrity":"sha512-rcQinbLfk61psxKZcmXEsp6dPn/7gEJ3l8oYTyqdsGgCl00St1hPqyRLDFu4vUtufME9OoohkxqsD3mjCP0eBw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCzqHQrscOv8lX1qAybEMroTro2Au+oIPO1bM+H4EF66AIgI61a7/mhVyKx2REfWeOojf8U64SpCRDlGw2DO9ejZ9Q="}]},"directories":{}},"1.0.1":{"name":"cart","version":"1.0.1","description":"Connect session store using supermarket","modules":{"index":"./lib/cart.js"},"keywords":["connect","expresso","http sessions"],"maintainers":[{"name":"Peteris Krumins","email":"peteris.krumins@gmail.com","web":"http://www.catonmat.net","twitter":"pkrumins"}],"repository":{"type":"git","url":"http://github.com/pkrumins/supermarket-cart.git"},"engines":{"node":">=0.2.0"},"dependencies":{"supermarket":">=1.0.6"},"_id":"cart@1.0.1","_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"https://registry.npmjs.org/cart/-/cart-1.0.1.tgz","shasum":"d80dae0892b4fecfbded5181463c5615b70bdf2e","integrity":"sha512-UjxPVO3HXIR67IoOAxgVY/BsaiAM7yrxBEf9AbgjsJflhbKm0RHowmRHVHbO6XfxLWbpjAW2ojB8cpeVVQm3gg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGBW/OKB+ovgiSu47jFHfwr7i88vkWLHjwRuOgXvq3jlAiAXg8BO080eIn5UMttvIeMO8Cx0iNW4ONga+0XRMTdcNg=="}]},"directories":{}},"1.0.2":{"name":"cart","version":"1.0.2","description":"Connect session store using supermarket","modules":{"index":"./lib/cart.js"},"keywords":["connect","expresso","http sessions"],"maintainers":[{"name":"Peteris Krumins","email":"peteris.krumins@gmail.com","web":"http://www.catonmat.net","twitter":"pkrumins"}],"repository":{"type":"git","url":"http://github.com/pkrumins/supermarket-cart.git"},"engines":{"node":">=0.2.0"},"dependencies":{"supermarket":">=1.0.8"},"_id":"cart@1.0.2","_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"https://registry.npmjs.org/cart/-/cart-1.0.2.tgz","shasum":"434c7cf89f5e1fdccbaba60033531945402ac0aa","integrity":"sha512-bZHvyn1Jws6VSycoNFVi3i8/JioMY5+GLrexP3jZRxwvb95f7whSJM5PPkqYQM0TG95Vx3CgTFfb6mVUxzXVPQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDuooBCi/RyUKCl+MDRmyXkEGjqlXtRqtsFCgGbFUOVuAIhALRKSlPxmFIsuribkSENjIP4K9usAik/dT+fFPGlX3bH"}]},"directories":{}},"1.0.3":{"name":"cart","version":"1.0.3","description":"Connect session store using supermarket","modules":{"index":"./lib/cart.js"},"keywords":["connect","expresso","http sessions"],"maintainers":[{"name":"Peteris Krumins","email":"peteris.krumins@gmail.com","web":"http://www.catonmat.net","twitter":"pkrumins"}],"repository":{"type":"git","url":"http://github.com/pkrumins/supermarket-cart.git"},"engines":{"node":">=0.2.0"},"dependencies":{"supermarket":">=1.1.0"},"_id":"cart@1.0.3","_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"https://registry.npmjs.org/cart/-/cart-1.0.3.tgz","shasum":"7d35b17c2396130c8336e33965363ae0cfab7775","integrity":"sha512-gSnBw7I9WVtv+jaqopt1zq5Sk49U1yBwvF5oDZhyu6KnDGfkX+ZJfE15OzdydsPrDFhnhUyjigUFgfxfRDKcQA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIES7T1WvAl4D7ihneRHaGrNzlawsLURjH0Tzw1TfcSNOAiEA6b/Atf9aamyILtdWYfMV59xQ+npNYMx0HXJfeb1lWOc="}]},"directories":{}},"1.0.4":{"name":"cart","version":"1.0.4","description":"Connect session store using supermarket","main":"./lib/cart.js","keywords":["connect","expresso","http sessions"],"author":{"name":"Peteris Krumins","email":"peteris.krumins@gmail.com","url":"http://www.catonmat.net"},"repository":{"type":"git","url":"git://github.com/pkrumins/supermarket-cart.git"},"engines":{"node":">=0.2.0"},"dependencies":{"supermarket":">=1.1.0"},"_npmUser":{"name":"pkrumins","email":"peteris.krumins@gmail.com"},"_id":"cart@1.0.4","devDependencies":{},"_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.4.8","_defaultsLoaded":true,"dist":{"shasum":"42f2d22817920e5cc7329dbe77959736a3ece842","tarball":"https://registry.npmjs.org/cart/-/cart-1.0.4.tgz","integrity":"sha512-Qs6POD+rt3MjNJVlSjTntf0jzaUyt3vOKjF/qIatXn951Q6O7jok/9F360hrui1QaSh1iKresxFA61+5CFS1CQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBWcw49JSjt7RcmAgjpaFAST/EsNk2S16HHKATKrfmsMAiAh3cSYVlyuVECvsWX+mruRoU0J6Sm3mazlo0MTG7oSlQ=="}]},"maintainers":[{"name":"pkrumins","email":"peteris.krumins@gmail.com"}],"directories":{}},"1.1.0":{"name":"cart","version":"1.1.0","description":"Headless cart management library","repository":{"type":"git","url":"git+https://github.com/mcnaveen/cart.git"},"license":"MIT","author":{"name":"mcnaveen","email":"me@mcnaveen.com"},"type":"module","main":"./lib/index.js","scripts":{"build":"tsup","format":"prettier \"**/*\" --ignore-unknown","format:write":"pnpm format --write","lint":"eslint . .*js --max-warnings 0 --report-unused-disable-directives","lint:knip":"knip","lint:md":"markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line","lint:package-json":"npmPkgJsonLint .","lint:packages":"pnpm dedupe --check","lint:spelling":"cspell \"**\" \".github/**/*\"","prepare":"husky install","should-semantic-release":"should-semantic-release --verbose","test":"vitest","tsc":"tsc"},"lint-staged":{"*":"prettier --ignore-unknown --write"},"dependencies":{"zustand":"^4.4.1"},"devDependencies":{"@release-it/conventional-changelog":"^7.0.2","@types/eslint":"^8.44.2","@types/react":"^18.2.22","@typescript-eslint/eslint-plugin":"^6.7.2","@typescript-eslint/parser":"^6.7.2","@vitest/coverage-v8":"^0.34.5","console-fail-test":"^0.2.3","cspell":"^7.3.6","eslint":"^8.49.0","eslint-plugin-deprecation":"^2.0.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-jsdoc":"^46.8.2","eslint-plugin-jsonc":"^2.9.0","eslint-plugin-markdown":"^3.0.1","eslint-plugin-n":"^16.1.0","eslint-plugin-no-only-tests":"^3.1.0","eslint-plugin-perfectionist":"^2.1.0","eslint-plugin-regexp":"^1.15.0","eslint-plugin-vitest":"^0.3.1","eslint-plugin-yml":"^1.9.0","husky":"^8.0.3","jsonc-eslint-parser":"^2.3.0","knip":"^2.25.2","lint-staged":"^14.0.1","markdownlint":"^0.31.1","markdownlint-cli":"^0.37.0","npm-package-json-lint":"^7.0.0","npm-package-json-lint-config-default":"^6.0.0","prettier":"^3.0.3","prettier-plugin-curly":"^0.1.3","prettier-plugin-packagejson":"^2.4.5","release-it":"^16.1.5","sentences-per-line":"^0.2.1","should-semantic-release":"^0.1.1","tsup":"^7.2.0","typescript":"^5.2.2","vitest":"^0.34.5","yaml-eslint-parser":"^1.2.2"},"peerDependencies":{"react":"16.x || 17.x || 18.x"},"packageManager":"pnpm@8.7.0","engines":{"node":">=18"},"publishConfig":{"provenance":true},"types":"./lib/index.d.ts","gitHead":"fa3db1e6b0e719db44ee2c6c74cc049dd9cdb630","bugs":{"url":"https://github.com/mcnaveen/cart/issues"},"homepage":"https://github.com/mcnaveen/cart#readme","_id":"cart@1.1.0","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-Toc+jfdv3lbDp+CdK1i9fqnLOhWugGVQvgMg9217ho/Krk3SIDF+WzVN2DobOGhjqGBTqSBy2ZNWCEYDl1LVQA==","shasum":"a4cafe248c750e69f5bc34b546d070072e0ac914","tarball":"https://registry.npmjs.org/cart/-/cart-1.1.0.tgz","fileCount":9,"unpackedSize":27344,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/cart@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGpdPPXHEo63cVTOmyd673p+vDdIiZMgL4zY55YqFvAoAiA2VjVBB7JN7V4vGHdwbIA5Efa5fqI+EQucjpATUN3/7w=="}]},"_npmUser":{"name":"mcnaveen","email":"funmemcn@gmail.com"},"directories":{},"maintainers":[{"name":"mcnaveen","email":"funmemcn@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cart_1.1.0_1695404919461_0.9712256263715586"},"_hasShrinkwrap":false},"1.1.1":{"name":"cart","version":"1.1.1","description":"Headless cart management library","keywords":["cart","headless-cart","cart-management","react-cart"],"repository":{"type":"git","url":"git+https://github.com/mcnaveen/cart.git"},"license":"MIT","author":{"name":"mcnaveen","email":"me@mcnaveen.com"},"type":"module","main":"./lib/index.js","scripts":{"build":"tsup","format":"prettier \"**/*\" --ignore-unknown","format:write":"pnpm format --write","lint":"eslint . .*js --max-warnings 0 --report-unused-disable-directives","lint:knip":"knip","lint:md":"markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line","lint:package-json":"npmPkgJsonLint .","lint:packages":"pnpm dedupe --check","lint:spelling":"cspell \"**\" \".github/**/*\"","prepare":"husky install","should-semantic-release":"should-semantic-release --verbose","test":"vitest","tsc":"tsc"},"lint-staged":{"*":"prettier --ignore-unknown --write"},"dependencies":{"zustand":"^4.4.1"},"devDependencies":{"@release-it/conventional-changelog":"^7.0.2","@types/eslint":"^8.44.2","@types/react":"^18.2.22","@typescript-eslint/eslint-plugin":"^6.7.2","@typescript-eslint/parser":"^6.7.2","@vitest/coverage-v8":"^0.34.5","console-fail-test":"^0.2.3","cspell":"^7.3.6","eslint":"^8.49.0","eslint-plugin-deprecation":"^2.0.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-jsdoc":"^46.8.2","eslint-plugin-jsonc":"^2.9.0","eslint-plugin-markdown":"^3.0.1","eslint-plugin-n":"^16.1.0","eslint-plugin-no-only-tests":"^3.1.0","eslint-plugin-perfectionist":"^2.1.0","eslint-plugin-regexp":"^1.15.0","eslint-plugin-vitest":"^0.3.1","eslint-plugin-yml":"^1.9.0","husky":"^8.0.3","jsonc-eslint-parser":"^2.3.0","knip":"^2.25.2","lint-staged":"^14.0.1","markdownlint":"^0.31.1","markdownlint-cli":"^0.37.0","npm-package-json-lint":"^7.0.0","npm-package-json-lint-config-default":"^6.0.0","prettier":"^3.0.3","prettier-plugin-curly":"^0.1.3","prettier-plugin-packagejson":"^2.4.5","release-it":"^16.1.5","sentences-per-line":"^0.2.1","should-semantic-release":"^0.1.1","tsup":"^7.2.0","typescript":"^5.2.2","vitest":"^0.34.5","yaml-eslint-parser":"^1.2.2"},"peerDependencies":{"react":"16.x || 17.x || 18.x"},"packageManager":"pnpm@8.7.0","engines":{"node":">=16"},"publishConfig":{"provenance":true},"types":"./lib/index.d.ts","gitHead":"0d0ff2368417e2085ab04b0b2e4a206df19ff907","bugs":{"url":"https://github.com/mcnaveen/cart/issues"},"homepage":"https://github.com/mcnaveen/cart#readme","_id":"cart@1.1.1","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-PZo4CG/fCJpYF3rowBJ3i2wRIJvfXgK25GQMJX6kBsGWLUgJ80YWXOsu5xc/rpzyYsaKi3qikxDogkHDOVhKFQ==","shasum":"14520d0b0196a8634b19eb9b78e24a8d54f1a3db","tarball":"https://registry.npmjs.org/cart/-/cart-1.1.1.tgz","fileCount":9,"unpackedSize":27639,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/cart@1.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICTNi+PGMlvJ1UL4dZLnu5ljvR4p1LaS32mptNIceNzGAiEA16hcUjozIg3h6OVT3NJ75dF2Fzbgcyjabg0MH8911IQ="}]},"_npmUser":{"name":"mcnaveen","email":"funmemcn@gmail.com"},"directories":{},"maintainers":[{"name":"mcnaveen","email":"funmemcn@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cart_1.1.1_1695464350804_0.618386607834269"},"_hasShrinkwrap":false},"1.1.2":{"name":"cart","version":"1.1.2","description":"Headless cart management library","keywords":["cart","headless-cart","cart-management","react-cart"],"repository":{"type":"git","url":"git+https://github.com/mcnaveen/cart.git"},"license":"MIT","author":{"name":"mcnaveen","email":"me@mcnaveen.com"},"type":"module","main":"./lib/index.js","scripts":{"build":"tsup","format":"prettier \"**/*\" --ignore-unknown","format:write":"pnpm format --write","lint":"eslint . .*js --max-warnings 0 --report-unused-disable-directives","lint:knip":"knip","lint:md":"markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line","lint:package-json":"npmPkgJsonLint .","lint:packages":"pnpm dedupe --check","lint:spelling":"cspell \"**\" \".github/**/*\"","prepare":"husky install","should-semantic-release":"should-semantic-release --verbose","test":"vitest","tsc":"tsc"},"lint-staged":{"*":"prettier --ignore-unknown --write"},"dependencies":{"@react-native-async-storage/async-storage":"^1.19.3","zustand":"^4.4.1"},"devDependencies":{"@release-it/conventional-changelog":"^7.0.2","@types/eslint":"^8.44.2","@types/react":"^18.2.22","@typescript-eslint/eslint-plugin":"^6.7.2","@typescript-eslint/parser":"^6.7.2","@vitest/coverage-v8":"^0.34.5","console-fail-test":"^0.2.3","cspell":"^7.3.6","eslint":"^8.49.0","eslint-plugin-deprecation":"^2.0.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-jsdoc":"^46.8.2","eslint-plugin-jsonc":"^2.9.0","eslint-plugin-markdown":"^3.0.1","eslint-plugin-n":"^16.1.0","eslint-plugin-no-only-tests":"^3.1.0","eslint-plugin-perfectionist":"^2.1.0","eslint-plugin-regexp":"^1.15.0","eslint-plugin-vitest":"^0.3.1","eslint-plugin-yml":"^1.9.0","husky":"^8.0.3","jsonc-eslint-parser":"^2.3.0","knip":"^2.25.2","lint-staged":"^14.0.1","markdownlint":"^0.31.1","markdownlint-cli":"^0.37.0","npm-package-json-lint":"^7.0.0","npm-package-json-lint-config-default":"^6.0.0","prettier":"^3.0.3","prettier-plugin-curly":"^0.1.3","prettier-plugin-packagejson":"^2.4.5","release-it":"^16.1.5","sentences-per-line":"^0.2.1","should-semantic-release":"^0.1.1","tsup":"^7.2.0","typescript":"^5.2.2","vitest":"^0.34.5","yaml-eslint-parser":"^1.2.2"},"peerDependencies":{"react":"16.x || 17.x || 18.x"},"packageManager":"pnpm@8.7.0","engines":{"node":">=16"},"publishConfig":{"provenance":true},"_id":"cart@1.1.2","gitHead":"1d063d4f0b116beef4fae43392b4a674f0efdeff","types":"./lib/index.d.ts","bugs":{"url":"https://github.com/mcnaveen/cart/issues"},"homepage":"https://github.com/mcnaveen/cart#readme","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-ONYsuxE/WZH0wOKSmK0KVgL+h3tcJg+toRdVNMd3VsZK0m1EMeGOdzJtQLkgTJuX4FZGM6nn3SIncM9SFIZRQQ==","shasum":"5a73562897c57c4f1a3906161fff6b58d57d0ea2","tarball":"https://registry.npmjs.org/cart/-/cart-1.1.2.tgz","fileCount":9,"unpackedSize":28238,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/cart@1.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDrPiDPK1nCnINKSKWqc3iydxP5Ll3xnrB+ha9eKCVSyQIhAL5NWkFBnz325Amk5Z3/3VDVWJ1b7WTY4o0kEKHOU0v6"}]},"_npmUser":{"name":"mcnaveen","email":"funmemcn@gmail.com"},"directories":{},"maintainers":[{"name":"mcnaveen","email":"funmemcn@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cart_1.1.2_1698388338792_0.9442254724738581"},"_hasShrinkwrap":false}},"maintainers":[{"name":"mcnaveen","email":"funmemcn@gmail.com"}],"repository":{"type":"git","url":"git+https://github.com/mcnaveen/cart.git"},"author":{"name":"mcnaveen","email":"me@mcnaveen.com"},"time":{"1.0.4":"2012-02-01T22:17:25.275Z","modified":"2023-10-27T06:32:19.545Z","created":"2012-02-01T22:17:25.275Z","1.0.0":"2012-02-01T22:17:25.275Z","1.0.1":"2012-02-01T22:17:25.275Z","1.0.2":"2012-02-01T22:17:25.275Z","1.0.3":"2012-02-01T22:17:25.275Z","1.1.0":"2023-09-22T17:48:39.735Z","1.1.1":"2023-09-23T10:19:10.974Z","1.1.2":"2023-10-27T06:32:18.987Z"},"readme":"<h1 align=\"center\">Cart</h1>\n\n<p align=\"center\">Headless cart management library</p>\n\n![npm i cart](image/cover.png)\n\n<p align=\"center\">\n\t<a href=\"#contributors\" target=\"_blank\">\n<!-- prettier-ignore-start -->\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n<img alt=\"All Contributors: 2\" src=\"https://img.shields.io/badge/all_contributors-2-21bb42.svg\" />\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n<!-- prettier-ignore-end -->\n</a>\n\t<a href=\"https://codecov.io/gh/mcnaveen/Cart\" target=\"_blank\">\n\t\t<img alt=\"Codecov Test Coverage\" src=\"https://codecov.io/gh/mcnaveen/Cart/branch/main/graph/badge.svg\"/>\n\t</a>\n\t<a href=\"https://github.com/mcnaveen/Cart/blob/main/.github/CODE_OF_CONDUCT.md\" target=\"_blank\">\n\t\t<img alt=\"Contributor Covenant\" src=\"https://img.shields.io/badge/code_of_conduct-enforced-21bb42\" />\n\t</a>\n\t<a href=\"https://github.com/mcnaveen/Cart/blob/main/LICENSE.md\" target=\"_blank\">\n\t\t<img alt=\"License: MIT\" src=\"https://img.shields.io/github/license/mcnaveen/Cart?color=21bb42\">\n\t</a>\n\t<img alt=\"Style: Prettier\" src=\"https://img.shields.io/badge/style-prettier-21bb42.svg\" />\n\t<img alt=\"TypeScript: Strict\" src=\"https://img.shields.io/badge/typescript-strict-21bb42.svg\" />\n</p>\n\n> ⚠️ Expect some breaking changes, Use at your own risk\n\n### 🛒 Demo\n\n- [View React Demo](https://stackblitz-starters-dt9zzc.stackblitz.io/)\n- [Nextjs App Directory Demo](https://stackblitzstarterskcruvd-uufb--3000--d6c42aca.local-credentialless.webcontainer.io/)\n\n### :package: Requirements\n\n- React or Nextjs Project ⚛️\n\n### :sparkles: Installation\n\n- Install using the below command (with your package manager of choice)\n\n```bash\n# npm\nnpm install cart --save\n\n# yarn\nyarn add cart\n\n#pnpm\npnpm add cart\n\n# bun\nbun install cart\n\n```\n\n---\n\n### :bulb: Usage Example\n\n```jsx\nimport React from \"react\";\nimport { useCart } from \"cart\";\n\nconst item = {\n  productId: \"123\",\n  name: \"Product 1\",\n  quantity: 1,\n  price: 10,\n};\n\nfunction Cart() {\n  const {\n    addToCart,\n    cartItems,\n    clearCart,\n    decreaseItem,\n    toggleCart,\n    isCartOpen,\n  } = useCart();\n\n  return (\n    <div>\n      <p>{isCartOpen ? \"Open\" : \"Closed\"}</p>\n      <button onClick={() => toggleCart()}>Toggle</button>\n      <button onClick={() => addToCart(item)}>Add</button>\n\n      <button onClick={() => clearCart()}>Clear</button>\n      <button onClick={() => decreaseItem(\"123\", 1)}>Decrease</button>\n\n      <p>{JSON.stringify(cartItems)}</p>\n    </div>\n  );\n}\n\nexport default Cart;\n```\n\n### :bulb: SSR Example\n\n```jsx\nimport { useCart, withSSR } from \"cart\";\nimport React from \"react\";\n\nconst item = {\n  productId: \"123\",\n  name: \"Product 1\",\n  quantity: 1,\n  price: 10,\n};\n\nfunction MyCart() {\n  const cart = withSSR(useCart, (state) => state);\n\n  const handleToggle = () => {\n    cart?.toggleCart();\n  };\n\n  const itemadd = () => {\n    cart?.addToCart(item);\n  };\n\n  return (\n    <div>\n      <p>{cart?.isCartOpen ? \"Open\" : \"Closed\"}</p>\n      <button onClick={() => handleToggle()}>Toggle</button>\n      <button onClick={() => itemadd()}>Add</button>\n\n      <button onClick={() => cart?.clearCart()}>Clear</button>\n      <button onClick={() => cart?.decreaseItem(\"123\", 1)}>Decrease</button>\n\n      <p>{JSON.stringify(cart?.cartItems)}</p>\n    </div>\n  );\n}\n\nexport default MyCart;\n```\n\n---\n\n### API Reference\n\n| Name             | Type       | Default Value | Description                                                                                        | Example                                                                                                                                          |\n| ---------------- | ---------- | ------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `isCartOpen`     | `boolean`  | `false`       | Indicates whether the cart is open or not.                                                         | `isCartOpen ? \"Yes\" : \"No\"`                                                                                                                      |\n| `toggleCart`     | `function` | -             | Toggles the visibility of the shopping cart.                                                       | `toggleCart();`                                                                                                                                  |\n| `openCart`       | `function` | -             | Sets the cart open state to `true`.                                                                | `openCart();`                                                                                                                                    |\n| `closeCart`      | `function` | -             | Sets the cart open state to `false`.                                                               | `closeCart();`                                                                                                                                   |\n| `cartItems`      | `array`    | `[]`          | An array of items in the cart.                                                                     | `cartItems.map((item) => ( <div key={item.productId}> <p>{item.name}</p> <p>Quantity: {item.quantity}</p> <p>Price: ${item.price}</p> </div> ))` |\n| `addToCart`      | `function` | -             | Adds an item to the shopping cart or updates its quantity if already in the cart.                  | `addToCart({ productId: 'product1', name: 'Product 1', quantity: 2, price: 20 });`                                                               |\n| `decreaseItem`   | `function` | -             | Decreases the quantity of an item in the shopping cart or removes it if the quantity becomes zero. | `decreaseItem('product1', 1);`                                                                                                                   |\n| `removeFromCart` | `function` | -             | Removes an item from the shopping cart.                                                            | `removeFromCart('product1');`                                                                                                                    |\n| `clearCart`      | `function` | -             | Clears all items from the shopping cart.                                                           | `clearCart();`                                                                                                                                   |\n\n#### :pray: Credits\n\nHuge thanks to [Peter Krumins](https://github.com/pkrumins) for the package name `cart`.\nPlease checkout [Browserling](https://www.browserling.com/) - Online cross-browser testing platform.\n\n(Btw, This is not a sponsored message, Just my way of saying thank you)\n\n#### Contributors\n\n<!-- spellchecker: disable -->\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tbody>\n    <tr>\n      <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"http://www.joshuakgoldberg.com/\"><img src=\"https://avatars.githubusercontent.com/u/3335181?v=4?s=100\" width=\"100px;\" alt=\"Josh Goldberg ✨\"/><br /><sub><b>Josh Goldberg ✨</b></sub></a><br /><a href=\"#tool-JoshuaKGoldberg\" title=\"Tools\">🔧</a></td>\n      <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"https://github.com/mcnaveen\"><img src=\"https://avatars.githubusercontent.com/u/8493007?v=4?s=100\" width=\"100px;\" alt=\"MC Naveen\"/><br /><sub><b>MC Naveen</b></sub></a><br /><a href=\"https://github.com/mcnaveen/Cart/commits?author=mcnaveen\" title=\"Code\">💻</a> <a href=\"#content-mcnaveen\" title=\"Content\">🖋</a> <a href=\"https://github.com/mcnaveen/Cart/commits?author=mcnaveen\" title=\"Documentation\">📖</a> <a href=\"#ideas-mcnaveen\" title=\"Ideas, Planning, & Feedback\">🤔</a> <a href=\"#infra-mcnaveen\" title=\"Infrastructure (Hosting, Build-Tools, etc)\">🚇</a> <a href=\"#maintenance-mcnaveen\" title=\"Maintenance\">🚧</a> <a href=\"#projectManagement-mcnaveen\" title=\"Project Management\">📆</a> <a href=\"#tool-mcnaveen\" title=\"Tools\">🔧</a></td>\n    </tr>\n  </tbody>\n</table>\n\n<!-- markdownlint-restore -->\n<!-- prettier-ignore-end -->\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n<!-- spellchecker: enable -->\n\n<!-- You can remove this notice if you don't want it 🙂 no worries! -->\n\n#### :green_heart: Message\n\nI hope you find this useful.\nIf you have any questions, please create an issue.\n\n---\n\n> 💙 This package is based on [@JoshuaKGoldberg](https://github.com/JoshuaKGoldberg)'s [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app).\n","readmeFilename":"README.md","homepage":"https://github.com/mcnaveen/cart#readme","bugs":{"url":"https://github.com/mcnaveen/cart/issues"},"license":"MIT","keywords":["cart","headless-cart","cart-management","react-cart"]}