{"_id":"@arsdiamonds/saleor-sdk","_rev":"3-9606c0e360460b45ce166888c991f7f5","name":"@arsdiamonds/saleor-sdk","dist-tags":{"latest":"0.3.0-12"},"versions":{"0.3.0-10":{"name":"@arsdiamonds/saleor-sdk","version":"0.3.0-10","description":"This package contains all queries and mutations that are used in our sample storefront. It can be used for semi-custom or fully-custom (with ability to extend existing queries) storefront solutions.","homepage":"https://github.com/arsdiamonds/saleor-sdk","main":"./lib/index.js","license":"BSD-3-Clause","engines":{"node":">=12.16.3"},"repository":{"type":"git","url":"git://github.com/arsdiamonds/saleor-sdk.git"},"scripts":{"build":"tsc","build-types":"apollo codegen:generate --target=typescript gqlTypes && rm -rf src/gqlTypes && move-file gqlTypes src/gqlTypes && jscodeshift -t scripts/fixImportPaths.ts src/**/gqlTypes/* --parser=tsx","clean":"rimraf lib","lint":"eslint \"src/**/*.@(tsx|ts|jsx|js)\" --fix && prettier --check \"src/**/*.@(tsx|ts|jsx|js)\" --write","prepare":"npm run clean && npm run build","release":"np","start":"tsc --watch","test":"jest"},"keywords":[],"author":{"name":"arsdiamonds"},"dependencies":{"apollo-cache":"^1.3.5","apollo-cache-inmemory":"^1.6.6","apollo-cache-persist":"^0.1.1","apollo-link-batch-http":"^1.2.14","apollo-link-context":"^1.0.20","apollo-link-error":"^1.1.13","apollo-link-retry":"^2.2.16","apollo-upload-client":"^9.1.0","apollo-utilities":"^1.3.4","lodash":"^4.17.21","lodash-es":"^4.17.15"},"devDependencies":{"@pollyjs/adapter-node-http":"^4.3.0","@pollyjs/core":"^4.3.0","@pollyjs/persister-fs":"^4.3.0","@testing-library/react-hooks":"^3.4.1","@types/apollo-upload-client":"^14.1.0","@types/jest":"^25.2.3","@types/jscodeshift":"^0.7.1","@types/lodash":"^4.14.155","@types/pollyjs__adapter-node-http":"^2.0.0","@types/pollyjs__persister-fs":"^2.0.0","@types/react":"^16.9.35","@types/react-dom":"^16.9.8","@types/setup-polly-jest":"^0.5.0","@types/webappsec-credential-management":"^0.5.1","@typescript-eslint/eslint-plugin":"^2.34.0","@typescript-eslint/parser":"^2.34.0","apollo":"^2.27.4","apollo-client":"^2.6.10","apollo-link":"^1.2.14","eslint":"^7.0.0","eslint-config-airbnb":"^18.1.0","eslint-config-airbnb-typescript":"^7.2.1","eslint-config-prettier":"^6.11.0","eslint-plugin-import":"^2.20.2","eslint-plugin-jsx-a11y":"^6.2.3","eslint-plugin-prettier":"^3.1.3","eslint-plugin-react":"^7.20.0","eslint-plugin-react-hooks":"^4.0.2","graphql":"^14.5.8","graphql-tag":"^2.10.3","husky":"^4.2.5","jest":"^26.0.1","jscodeshift":"^0.9.0","lint-staged":"^10.2.4","move-file-cli":"^1.0.0","node-fetch":"^2.6.0","np":"^7.0.0","prettier":"^2.0.5","react":"^16.9.9","react-apollo":"^3.1.5","react-dom":"^16.12.0","react-test-renderer":"^16.13.1","rimraf":"^3.0.2","setup-polly-jest":"^0.8.0","ts-jest":"^26.0.0","typescript":"^3.9.2"},"lint-staged":{"*.{js,ts}":["eslint --fix","prettier --write","git add"]},"peerDependencies":{"apollo-client":"^2.6.10","apollo-link":"^1.2.14","graphql":"^14.5.8","graphql-tag":"^2.10.3","react":"^16.9.9","react-dom":"^16.9.0","react-apollo":"^3.1.5"},"type":"commonjs","typings":"./lib/index.d.ts","bugs":{"url":"https://github.com/arsdiamonds/saleor-sdk/issues"},"_id":"@arsdiamonds/saleor-sdk@0.3.0-10","_nodeVersion":"14.18.3","_npmVersion":"6.14.15","dist":{"integrity":"sha512-rRExBgpgMSmRsZ7Zi1juA6T7cv8DeYRy8U1neuYcacWVdtVYnKyuIoYn8sXEuu88jL02RLRzjqKSNctQLg9boQ==","shasum":"fdb2df9ba92dc2d752346ae72387c10fc01a0105","tarball":"https://registry.npmjs.org/@arsdiamonds/saleor-sdk/-/saleor-sdk-0.3.0-10.tgz","fileCount":638,"unpackedSize":1640124,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiCQNpCRA9TVsSAnZWagAA434QAJGowH8qCEbQKtpZRt3x\nDUIaGlyI87iBHJiXdD+KLX7qNRykgraMoXOzwK4PUkmEEioUuN4bEbpUfQIy\nfAY2gikowS+mcHQz48Qx1SugILEbpN2XZ1Mp1P9woL9pGiLpcH/5JGvaaOef\n3Gvb/v/vO8zb8cVGSZzX8QfL53e7LEC9iKeAxDifBvUqTvKS9lwUbG/g9Tgf\nAQigh8lZbB4kmAFrSBTDDyAZdNJp2vq3eDqaktFN64cYpa75Uv5r3TEaBMdR\nFmES6Y1KZN4vGfP/0QY5M8b3ifpceLhKa/Tv+OW4/4B9W35JMd4zjwPUy2QF\nDWjyoa3Zn63AekJJtD2FyvJRz8tGpt7yEg8E2uJLggvPTzqOHUUV2QC4J7Gu\noS+hE8vcFqN/yDAW1JbTv/eMqCWjdkRmSE5br3RIvhwUubp0lViWFbXhM7E4\nWLcB5kzeFtnS/lp/WYLmqhTZoTeGwWzFcvaIxAErJ83pl2+wGt2vdGQy1bFF\nltc9kkaU+7fKhgKZP28oSnnIsFs5XP4i0WP40VhqOdvr0ouQnJgRsqvkhSNi\nTBHpnh86COMblfMIgq7GUl4J8N84wORICwCOaBeXecSPfZKZ+DBm9bvBFfbd\nQmHcNgvZ+dGtwYgs63A+qCF6xGfoqsHK/hR+2lR4x5ErYfyw0ORK2wB/vDcD\ntBhs\r\n=NjBm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICkwga0fnRyhGXvsx4fNbg+puwgdcWoNlArBpNxHMzufAiBB7KStaOtXkCxn9hGoYrGouul9O9NMB8BVaHMek0tUWQ=="}]},"_npmUser":{"name":"arsdiamonds","email":"arsdiamonds@yahoo.com"},"directories":{},"maintainers":[{"name":"arsdiamonds","email":"arsdiamonds@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/saleor-sdk_0.3.0-10_1644757865469_0.37151134704370015"},"_hasShrinkwrap":false},"0.3.0-11":{"name":"@arsdiamonds/saleor-sdk","version":"0.3.0-11","description":"This package contains all queries and mutations that are used in our sample storefront. It can be used for semi-custom or fully-custom (with ability to extend existing queries) storefront solutions.","homepage":"https://github.com/arsdiamonds/saleor-sdk","main":"./lib/index.js","license":"BSD-3-Clause","engines":{"node":">=12.16.3"},"repository":{"type":"git","url":"git://github.com/arsdiamonds/saleor-sdk.git"},"scripts":{"build":"tsc","build-types":"apollo codegen:generate --target=typescript gqlTypes && rm -rf src/gqlTypes && move-file gqlTypes src/gqlTypes && jscodeshift -t scripts/fixImportPaths.ts src/**/gqlTypes/* --parser=tsx","clean":"rimraf lib","lint":"eslint \"src/**/*.@(tsx|ts|jsx|js)\" --fix && prettier --check \"src/**/*.@(tsx|ts|jsx|js)\" --write","prepare":"npm run clean && npm run build","release":"np","start":"tsc --watch","test":"jest"},"keywords":[],"author":{"name":"arsdiamonds"},"dependencies":{"apollo-cache":"^1.3.5","apollo-cache-inmemory":"^1.6.6","apollo-cache-persist":"^0.1.1","apollo-link-batch-http":"^1.2.14","apollo-link-context":"^1.0.20","apollo-link-error":"^1.1.13","apollo-link-retry":"^2.2.16","apollo-upload-client":"^9.1.0","apollo-utilities":"^1.3.4","lodash":"^4.17.21","lodash-es":"^4.17.15"},"devDependencies":{"@pollyjs/adapter-node-http":"^4.3.0","@pollyjs/core":"^4.3.0","@pollyjs/persister-fs":"^4.3.0","@testing-library/react-hooks":"^3.4.1","@types/apollo-upload-client":"^14.1.0","@types/jest":"^25.2.3","@types/jscodeshift":"^0.7.1","@types/lodash":"^4.14.155","@types/pollyjs__adapter-node-http":"^2.0.0","@types/pollyjs__persister-fs":"^2.0.0","@types/react":"^16.9.35","@types/react-dom":"^16.9.8","@types/setup-polly-jest":"^0.5.0","@types/webappsec-credential-management":"^0.5.1","@typescript-eslint/eslint-plugin":"^2.34.0","@typescript-eslint/parser":"^2.34.0","apollo":"^2.27.4","apollo-client":"^2.6.10","apollo-link":"^1.2.14","eslint":"^7.0.0","eslint-config-airbnb":"^18.1.0","eslint-config-airbnb-typescript":"^7.2.1","eslint-config-prettier":"^6.11.0","eslint-plugin-import":"^2.20.2","eslint-plugin-jsx-a11y":"^6.2.3","eslint-plugin-prettier":"^3.1.3","eslint-plugin-react":"^7.20.0","eslint-plugin-react-hooks":"^4.0.2","graphql":"^14.5.8","graphql-tag":"^2.10.3","husky":"^4.2.5","jest":"^26.0.1","jscodeshift":"^0.9.0","lint-staged":"^10.2.4","move-file-cli":"^1.0.0","node-fetch":"^2.6.0","np":"^7.0.0","prettier":"^2.0.5","react":"^16.9.9","react-apollo":"^3.1.5","react-dom":"^16.12.0","react-test-renderer":"^16.13.1","rimraf":"^3.0.2","setup-polly-jest":"^0.8.0","ts-jest":"^26.0.0","typescript":"^3.9.2"},"lint-staged":{"*.{js,ts}":["eslint --fix","prettier --write","git add"]},"peerDependencies":{"apollo-client":"^2.6.10","apollo-link":"^1.2.14","graphql":"^14.5.8","graphql-tag":"^2.10.3","react":"^16.9.9","react-dom":"^16.9.0","react-apollo":"^3.1.5"},"type":"commonjs","typings":"./lib/index.d.ts","bugs":{"url":"https://github.com/arsdiamonds/saleor-sdk/issues"},"_id":"@arsdiamonds/saleor-sdk@0.3.0-11","_nodeVersion":"14.18.3","_npmVersion":"6.14.15","dist":{"integrity":"sha512-BhOTJ/VED3htruklly1W7/BGHGZk9cXYPqilw9xTQ2npoXyFw/+NavfzM7rr8FEj0gdTMftlJyeJZKhgDTO+4Q==","shasum":"c4ce97cc47bcff2e0e458e0ce018bf1c1e3574eb","tarball":"https://registry.npmjs.org/@arsdiamonds/saleor-sdk/-/saleor-sdk-0.3.0-11.tgz","fileCount":638,"unpackedSize":1640124,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiCQY4CRA9TVsSAnZWagAA2TEP/icX+sKbCIPULrWMtHxv\nXnHQYvYLlIaaKTvsKt/vbuswPRNqDKhi3GBt7FhuU8341VnKsLNpX8dnYznZ\n/xLJTUnNcXpcXmpLb8KEs/x25wa0MoKTTHSjcKki5/acVmn7QpXSxkTHOgYG\nw6KP+X6HJPh+3yZ1qHHsgkaaIDDG2QPoKxca5BICyIECPYuIfhSV/AXMcVBc\nwXtauCFwrrrYBkEjNLFM7EXNN9APvZRGNgPcyWIx7dOcyEUOeGRFKWgHXQQu\ngwF4QO9XOhrHxCD4ZUtoMftm8I2Nto2MhrmVTpHjqzVc9FbfXKpw2aRBLHNw\nwOXEZZ/MlmIYuSErPoa8OdioVtkTSexjqMGVyGm962uAJp/vkr0CQjs5eQnU\nj6WbRe6ugPD821R1NfaLXaELKBV+ycVHE2KzdRRv7GFHEgfqackSJQdV4kg/\n4I4eaBSnBefB/dNzmcfZyIXIoPAMzWE5P4yaRwpAXJ7bxqcwu3e7A3V53ci/\nF7xxpCKesKxe3EsJOo2Kax3CeYabjmOhqsOxsadiqOn+K/6a51UGHyZkZllv\nG8DpGTHsMSr1z+XOgm3d6TxeFxgZoq+30wTDhHwgOSvs5udJLC6w3xvYsTGU\nyWiko06nChVcD5XvtWQq7rbA6w/3LJEXvRy8S/nhFst6mr+O9/ThxKeG0a9C\npgKx\r\n=9FhH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDOUtkePpasRADdkkWaFV5VSwaRgKlx3/kCxrvJWSn/NgIgW0Q+6eyoHkciDiInfb/YQsJm+lZ+oGlKD66iNfmy6JA="}]},"_npmUser":{"name":"arsdiamonds","email":"arsdiamonds@yahoo.com"},"directories":{},"maintainers":[{"name":"arsdiamonds","email":"arsdiamonds@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/saleor-sdk_0.3.0-11_1644758584529_0.3300660047133308"},"_hasShrinkwrap":false},"0.3.0-12":{"name":"@arsdiamonds/saleor-sdk","version":"0.3.0-12","description":"This package contains all queries and mutations that are used in our sample storefront. It can be used for semi-custom or fully-custom (with ability to extend existing queries) storefront solutions.","homepage":"https://github.com/arsdiamonds/saleor-sdk","main":"./lib/index.js","license":"BSD-3-Clause","engines":{"node":">=12.16.3"},"repository":{"type":"git","url":"git://github.com/arsdiamonds/saleor-sdk.git"},"scripts":{"build":"tsc","build-types":"apollo codegen:generate --target=typescript gqlTypes && rm -rf src/gqlTypes && move-file gqlTypes src/gqlTypes && jscodeshift -t scripts/fixImportPaths.ts src/**/gqlTypes/* --parser=tsx","clean":"rimraf lib","lint":"eslint \"src/**/*.@(tsx|ts|jsx|js)\" --fix && prettier --check \"src/**/*.@(tsx|ts|jsx|js)\" --write","prepare":"npm run clean && npm run build","release":"np","start":"tsc --watch","test":"jest"},"keywords":[],"author":{"name":"arsdiamonds"},"dependencies":{"apollo-cache":"^1.3.5","apollo-cache-inmemory":"^1.6.6","apollo-cache-persist":"^0.1.1","apollo-link-batch-http":"^1.2.14","apollo-link-context":"^1.0.20","apollo-link-error":"^1.1.13","apollo-link-retry":"^2.2.16","apollo-upload-client":"^9.1.0","apollo-utilities":"^1.3.4","lodash":"^4.17.21","lodash-es":"^4.17.15"},"devDependencies":{"@pollyjs/adapter-node-http":"^4.3.0","@pollyjs/core":"^4.3.0","@pollyjs/persister-fs":"^4.3.0","@testing-library/react-hooks":"^3.4.1","@types/apollo-upload-client":"^14.1.0","@types/jest":"^25.2.3","@types/jscodeshift":"^0.7.1","@types/lodash":"^4.14.155","@types/pollyjs__adapter-node-http":"^2.0.0","@types/pollyjs__persister-fs":"^2.0.0","@types/react":"^16.9.35","@types/react-dom":"^16.9.8","@types/setup-polly-jest":"^0.5.0","@types/webappsec-credential-management":"^0.5.1","@typescript-eslint/eslint-plugin":"^2.34.0","@typescript-eslint/parser":"^2.34.0","apollo":"^2.27.4","apollo-client":"^2.6.10","apollo-link":"^1.2.14","eslint":"^7.0.0","eslint-config-airbnb":"^18.1.0","eslint-config-airbnb-typescript":"^7.2.1","eslint-config-prettier":"^6.11.0","eslint-plugin-import":"^2.20.2","eslint-plugin-jsx-a11y":"^6.2.3","eslint-plugin-prettier":"^3.1.3","eslint-plugin-react":"^7.20.0","eslint-plugin-react-hooks":"^4.0.2","graphql":"^14.5.8","graphql-tag":"^2.10.3","husky":"^4.2.5","jest":"^26.0.1","jscodeshift":"^0.9.0","lint-staged":"^10.2.4","move-file-cli":"^1.0.0","node-fetch":"^2.6.0","np":"^7.0.0","prettier":"^2.0.5","react":"^16.9.9","react-apollo":"^3.1.5","react-dom":"^16.12.0","react-test-renderer":"^16.13.1","rimraf":"^3.0.2","setup-polly-jest":"^0.8.0","ts-jest":"^26.0.0","typescript":"^3.9.2"},"lint-staged":{"*.{js,ts}":["eslint --fix","prettier --write","git add"]},"peerDependencies":{"apollo-client":"^2.6.10","apollo-link":"^1.2.14","graphql":"^14.5.8","graphql-tag":"^2.10.3","react":"^16.9.9","react-dom":"^16.9.0","react-apollo":"^3.1.5"},"type":"commonjs","typings":"./lib/index.d.ts","bugs":{"url":"https://github.com/arsdiamonds/saleor-sdk/issues"},"_id":"@arsdiamonds/saleor-sdk@0.3.0-12","_nodeVersion":"14.18.3","_npmVersion":"6.14.15","dist":{"integrity":"sha512-QQJujOoFvgo83ntaB3ZmwzSwQR0p6zOgWfLRTTKSX6oyBwPGgPiW250rVU8v0cIvft477MT/78kihctZWSZVUA==","shasum":"d51959ddaa64bafdd83685e6f5d950a0620e4094","tarball":"https://registry.npmjs.org/@arsdiamonds/saleor-sdk/-/saleor-sdk-0.3.0-12.tgz","fileCount":638,"unpackedSize":1640403,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiEQIOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqtiA//Yaianbw2awfd+EHZTqI5FpMBeUnKWoRM+JxjY28z0UXY8lhB\r\nBxK0VlPS2LYF7G89HV/O0NZAobjxkBYN6wMpar9IGEvs28AeEByIhmRt7r1f\r\nuHO4gYyfQ8KwOPtG91GYV7/N6dVKo93Lauok0exvgs908TzXiTLxNOliytfm\r\nG1B+xO+L4LjAkKCimv5Ew+sfvJdc3bZp/NMxGszQcP7R+baTR5GxGXg4l6nl\r\n6Ab6v0JCrGChJ40QCRRPjLFsX/og1t53iQgwdSe4vs60iQOYff0iyV9RV5u2\r\nKL8JTzGYSajg4hAVtLdFUceRKJeM2rw2QU2CWcAp3Hd8VQi1lLH1wvSsAUCc\r\nCoRciDxxwubePcIrwPZ9FtTKr0f4LM2xXtPKY9livPdUTuxkaAVpkf2jVobr\r\nCZNHxWUZCdhCeDvj/xkyqvxERElpsFrNOQKKXt5nCTz6vfbmFEH6bE2ij/Ng\r\nShVJ4GvtA1ekngBdUaz+dm0u/KHEbPm3r4JcK/P5c/CEyCDufBcmccpubWoL\r\n31TqVVCr9vIVB9SCazlyTtYYLGwTubIAzp7vzKmi42wTb5RiNU8OYDIG85Nr\r\n+bp7WkcxQWuu8awcdWgGxDECS4SjrRB4iLvC6PClImCtpD3lgDx0hlrpo2ld\r\nFc9gXEbARBbvUHZ+8QgoHhQSIO1nmlvh/b0=\r\n=e853\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDee2I9nQcvUCc+3MxdG3PK7py3muusgntPm3xD64krUAiEAw7G3e70g8o+4spMUbZ7TMwSpc1fKRUrTuomh0OEzO8I="}]},"_npmUser":{"name":"arsdiamonds","email":"arsdiamonds@yahoo.com"},"directories":{},"maintainers":[{"name":"arsdiamonds","email":"arsdiamonds@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/saleor-sdk_0.3.0-12_1645281806114_0.4881231024319628"},"_hasShrinkwrap":false}},"time":{"created":"2022-02-13T13:11:05.401Z","0.3.0-10":"2022-02-13T13:11:05.704Z","modified":"2022-04-04T15:35:21.757Z","0.3.0-11":"2022-02-13T13:23:04.687Z","0.3.0-12":"2022-02-19T14:43:26.351Z"},"maintainers":[{"name":"arsdiamonds","email":"arsdiamonds@yahoo.com"}],"description":"This package contains all queries and mutations that are used in our sample storefront. It can be used for semi-custom or fully-custom (with ability to extend existing queries) storefront solutions.","homepage":"https://github.com/arsdiamonds/saleor-sdk","keywords":[],"repository":{"type":"git","url":"git://github.com/arsdiamonds/saleor-sdk.git"},"author":{"name":"arsdiamonds"},"bugs":{"url":"https://github.com/arsdiamonds/saleor-sdk/issues"},"license":"BSD-3-Clause","readme":"<div align=\"center\">\n  <h1>Saleor SDK</h1>\n</div>\n\nThis package contains methods providing Saleor business logic for storefront. It handles Saleor GraphQL queries and mutations, manages Apollo cache and provides internal state to manage popular storefront use cases, like user authentication or checkout process.\n\nPlease take a look at [sample storefront](https://github.com/mirumee/saleor-storefront) which already uses Saleor SDK. For specific use cases you may also refer to [saleor-sdk/examples](https://github.com/mirumee/saleor-sdk/tree/add/examples/examples/react/typescript/src).\n\n> :warning: **Note: Saleor SDK is still under heavy development and its API may change.**\n\n## Table of Contents\n\n- [Setup](#setup)\n- [Features](#features)\n- [Local development](#local-development)\n\n## Setup\n\nThere are two ways to use SDK - making custom implementation or using React components and hooks, which already has that implementation ready.\n\n### Using React\n\nFirst install SDK as dependency to your project\n\n```bash\nnpm install @saleor/sdk\n```\n\nUse `SaleorProvider` with passed custom config in a prop. Then use React hooks in any component passed as child to `SaleorProvider`.\n\n```tsx\nimport { SaleorProvider, useAuth } from \"@saleor/sdk\";\n\nconst config = { apiUrl: \"http://localhost:8000/graphql/\", channel: \"\" };\nconst apolloConfig = {\n  /* \n    Optional custom Apollo client config.\n    Here you may append custom Apollo cache, links or the whole client. \n    You may also use import { createSaleorCache, createSaleorClient, createSaleorLinks } from \"@saleor/sdk\" to create semi-custom implementation of Apollo.\n  */\n};\n\nconst rootElement = document.getElementById(\"root\");\nReactDOM.render(\n  <SaleorProvider config={config} apolloConfig={apolloConfig}>\n    <App />\n  </SaleorProvider>,\n  rootElement\n);\n\nconst App = () => {\n  const { authenticated, user, signIn } = useAuth();\n\n  const handleSignIn = async () => {\n    const { data, dataError } = await signIn(\"admin@example.com\", \"admin\");\n\n    if (dataError) {\n      /**\n       * Unable to sign in.\n       **/\n    } else if (data) {\n      /**\n       * User signed in successfully.\n       **/\n    }\n  };\n\n  if (authenticated && user) {\n    return <span>Signed in as {user.firstName}</span>;\n  } else {\n    return <button onClick={handleSignIn}>Sign in</button>;\n  }\n};\n```\n\n### Custom implementation\n\n```bash\nnpm install @saleor/sdk\n```\n\nThen use SaleorManager to get `SaleorAPI` from `connect` method. This method may also take optional function as an argument, which will be executed every time the `SaleorAPI` state changes.\n\n```tsx\nconst config = { apiUrl: \"http://localhost:8000/graphql/\", channel: \"\" };\nconst apolloConfig = {\n  /* \n    Optional custom Apollo client config.\n    Here you may append custom Apollo cache, links or the whole client. \n    You may also use import { createSaleorCache, createSaleorClient, createSaleorLinks } from \"@saleor/sdk\" to create semi-custom implementation of Apollo.\n  */\n};\nconst manager = new SaleorManager(config, apolloConfig);\n\nconst { api, apolloClient } = await manager.connect(saleorAPI => {\n  /* Optional listener to API state change. You may use it to update your app state reactively - e.g. trigger the React context update. */\n});\n```\n\nFinally, methods from `api` might be used:\n\n```tsx\nconst { data, dataError } = await api.auth.signIn(\"admin@example.com\", \"admin\");\n\nif (dataError) {\n  /**\n   * Unable to sign in.\n   **/\n} else if (data) {\n  /**\n   * User signed in successfully. Read user object from data or from api.auth.\n   **/\n  const userData = api.auth.user;\n}\n```\n\n## Features\n\nWe provide an API with methods and fields, performing one, scoped type of work. You may access them straight from `SaleorAPI` or use React hooks, depending on [which setup do you select](#setup).\n\n| API object              | React hook                                                                                             | Description                                                                     |\n| :---------------------- | :----------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------ |\n| `SaleorAPI.auth`        | `useAuth()`                                                                                            | Handles user authentication and stores data about the currently signed in user. |\n| `SaleorAPI.cart`        | `useCart()`                                                                                            | Collects products to cart and calculates their prices.                          |\n| `SaleorAPI.checkout`    | `useCheckout()`                                                                                        | Uses cart and handles the whole checkout process.                               |\n| `SaleorAPI.products`    | `useProductDetails()`, `useProductList()`                                                              | Obtains products.                                                               |\n| `SaleorAPI.collections` | `useCollectionDetails()`, `useCollectionList()`                                                        | Obtains collections.                                                            |\n| `SaleorAPI.categories`  | `useCategoryDetails()`, `useCategoryList()`, `useCategoryAncestorsList()`, `useCategoryChildrenList()` | Obtains categories.                                                             |\n\n## Local development\n\nOur aim it to build SDK, highly configurable, as a separate package, which you will not require modifications. Although if you want to alter the project, especially if you want to contribute, it is possible to develop storefront and SDK simultaneously. To do this, you need\nto link it to the storefront's project.\n\n```bash\n$ cd lib\n$ npm link\n$ cd <your storefront path>\n$ npm link @saleor/sdk\n```\n\nNotice that in [our example storefront](https://github.com/mirumee/saleor-storefront)\nwebpack is configured to always resolve `react` to `./node_modules/react`. It may\nseem redundant for the most use cases, but helps in sdk's local development, because\nit overcomes `npm`'s limitations regarding peer dependencies hoisting, explicitly\ntelling webpack to always have one and only copy of `react`.\n","readmeFilename":"README.md"}