├── .gitignore ├── package-lock.json ├── package.json ├── server.js └── store ├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt └── src ├── App.css ├── App.js ├── App.test.js ├── CartContext.js ├── components ├── CartProduct.js ├── Navbar.js └── ProductCard.js ├── index.css ├── index.js ├── logo.svg ├── pages ├── Cancel.js ├── Store.js └── Success.js ├── productsStore.js ├── reportWebVitals.js └── setupTests.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "reactecommerceproject", 3 | "version": "1.0.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "reactecommerceproject", 9 | "version": "1.0.0", 10 | "license": "ISC", 11 | "dependencies": { 12 | "cors": "^2.8.5", 13 | "express": "^4.18.1", 14 | "stripe": "^10.12.0" 15 | } 16 | }, 17 | "node_modules/@types/node": { 18 | "version": "18.7.23", 19 | "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.23.tgz", 20 | "integrity": "sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg==" 21 | }, 22 | "node_modules/accepts": { 23 | "version": "1.3.8", 24 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", 25 | "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", 26 | "dependencies": { 27 | "mime-types": "~2.1.34", 28 | "negotiator": "0.6.3" 29 | }, 30 | "engines": { 31 | "node": ">= 0.6" 32 | } 33 | }, 34 | "node_modules/array-flatten": { 35 | "version": "1.1.1", 36 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 37 | "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" 38 | }, 39 | "node_modules/body-parser": { 40 | "version": "1.20.0", 41 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz", 42 | "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", 43 | "dependencies": { 44 | "bytes": "3.1.2", 45 | "content-type": "~1.0.4", 46 | "debug": "2.6.9", 47 | "depd": "2.0.0", 48 | "destroy": "1.2.0", 49 | "http-errors": "2.0.0", 50 | "iconv-lite": "0.4.24", 51 | "on-finished": "2.4.1", 52 | "qs": "6.10.3", 53 | "raw-body": "2.5.1", 54 | "type-is": "~1.6.18", 55 | "unpipe": "1.0.0" 56 | }, 57 | "engines": { 58 | "node": ">= 0.8", 59 | "npm": "1.2.8000 || >= 1.4.16" 60 | } 61 | }, 62 | "node_modules/bytes": { 63 | "version": "3.1.2", 64 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", 65 | "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", 66 | "engines": { 67 | "node": ">= 0.8" 68 | } 69 | }, 70 | "node_modules/call-bind": { 71 | "version": "1.0.2", 72 | "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", 73 | "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", 74 | "dependencies": { 75 | "function-bind": "^1.1.1", 76 | "get-intrinsic": "^1.0.2" 77 | }, 78 | "funding": { 79 | "url": "https://github.com/sponsors/ljharb" 80 | } 81 | }, 82 | "node_modules/content-disposition": { 83 | "version": "0.5.4", 84 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", 85 | "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", 86 | "dependencies": { 87 | "safe-buffer": "5.2.1" 88 | }, 89 | "engines": { 90 | "node": ">= 0.6" 91 | } 92 | }, 93 | "node_modules/content-type": { 94 | "version": "1.0.4", 95 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", 96 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", 97 | "engines": { 98 | "node": ">= 0.6" 99 | } 100 | }, 101 | "node_modules/cookie": { 102 | "version": "0.5.0", 103 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", 104 | "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", 105 | "engines": { 106 | "node": ">= 0.6" 107 | } 108 | }, 109 | "node_modules/cookie-signature": { 110 | "version": "1.0.6", 111 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 112 | "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" 113 | }, 114 | "node_modules/cors": { 115 | "version": "2.8.5", 116 | "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", 117 | "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", 118 | "dependencies": { 119 | "object-assign": "^4", 120 | "vary": "^1" 121 | }, 122 | "engines": { 123 | "node": ">= 0.10" 124 | } 125 | }, 126 | "node_modules/debug": { 127 | "version": "2.6.9", 128 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 129 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 130 | "dependencies": { 131 | "ms": "2.0.0" 132 | } 133 | }, 134 | "node_modules/depd": { 135 | "version": "2.0.0", 136 | "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", 137 | "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", 138 | "engines": { 139 | "node": ">= 0.8" 140 | } 141 | }, 142 | "node_modules/destroy": { 143 | "version": "1.2.0", 144 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", 145 | "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", 146 | "engines": { 147 | "node": ">= 0.8", 148 | "npm": "1.2.8000 || >= 1.4.16" 149 | } 150 | }, 151 | "node_modules/ee-first": { 152 | "version": "1.1.1", 153 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 154 | "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" 155 | }, 156 | "node_modules/encodeurl": { 157 | "version": "1.0.2", 158 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 159 | "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", 160 | "engines": { 161 | "node": ">= 0.8" 162 | } 163 | }, 164 | "node_modules/escape-html": { 165 | "version": "1.0.3", 166 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 167 | "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" 168 | }, 169 | "node_modules/etag": { 170 | "version": "1.8.1", 171 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 172 | "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", 173 | "engines": { 174 | "node": ">= 0.6" 175 | } 176 | }, 177 | "node_modules/express": { 178 | "version": "4.18.1", 179 | "resolved": "https://registry.npmjs.org/express/-/express-4.18.1.tgz", 180 | "integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==", 181 | "dependencies": { 182 | "accepts": "~1.3.8", 183 | "array-flatten": "1.1.1", 184 | "body-parser": "1.20.0", 185 | "content-disposition": "0.5.4", 186 | "content-type": "~1.0.4", 187 | "cookie": "0.5.0", 188 | "cookie-signature": "1.0.6", 189 | "debug": "2.6.9", 190 | "depd": "2.0.0", 191 | "encodeurl": "~1.0.2", 192 | "escape-html": "~1.0.3", 193 | "etag": "~1.8.1", 194 | "finalhandler": "1.2.0", 195 | "fresh": "0.5.2", 196 | "http-errors": "2.0.0", 197 | "merge-descriptors": "1.0.1", 198 | "methods": "~1.1.2", 199 | "on-finished": "2.4.1", 200 | "parseurl": "~1.3.3", 201 | "path-to-regexp": "0.1.7", 202 | "proxy-addr": "~2.0.7", 203 | "qs": "6.10.3", 204 | "range-parser": "~1.2.1", 205 | "safe-buffer": "5.2.1", 206 | "send": "0.18.0", 207 | "serve-static": "1.15.0", 208 | "setprototypeof": "1.2.0", 209 | "statuses": "2.0.1", 210 | "type-is": "~1.6.18", 211 | "utils-merge": "1.0.1", 212 | "vary": "~1.1.2" 213 | }, 214 | "engines": { 215 | "node": ">= 0.10.0" 216 | } 217 | }, 218 | "node_modules/finalhandler": { 219 | "version": "1.2.0", 220 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", 221 | "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", 222 | "dependencies": { 223 | "debug": "2.6.9", 224 | "encodeurl": "~1.0.2", 225 | "escape-html": "~1.0.3", 226 | "on-finished": "2.4.1", 227 | "parseurl": "~1.3.3", 228 | "statuses": "2.0.1", 229 | "unpipe": "~1.0.0" 230 | }, 231 | "engines": { 232 | "node": ">= 0.8" 233 | } 234 | }, 235 | "node_modules/forwarded": { 236 | "version": "0.2.0", 237 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", 238 | "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", 239 | "engines": { 240 | "node": ">= 0.6" 241 | } 242 | }, 243 | "node_modules/fresh": { 244 | "version": "0.5.2", 245 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 246 | "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", 247 | "engines": { 248 | "node": ">= 0.6" 249 | } 250 | }, 251 | "node_modules/function-bind": { 252 | "version": "1.1.1", 253 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 254 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" 255 | }, 256 | "node_modules/get-intrinsic": { 257 | "version": "1.1.3", 258 | "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", 259 | "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", 260 | "dependencies": { 261 | "function-bind": "^1.1.1", 262 | "has": "^1.0.3", 263 | "has-symbols": "^1.0.3" 264 | }, 265 | "funding": { 266 | "url": "https://github.com/sponsors/ljharb" 267 | } 268 | }, 269 | "node_modules/has": { 270 | "version": "1.0.3", 271 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 272 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 273 | "dependencies": { 274 | "function-bind": "^1.1.1" 275 | }, 276 | "engines": { 277 | "node": ">= 0.4.0" 278 | } 279 | }, 280 | "node_modules/has-symbols": { 281 | "version": "1.0.3", 282 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", 283 | "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", 284 | "engines": { 285 | "node": ">= 0.4" 286 | }, 287 | "funding": { 288 | "url": "https://github.com/sponsors/ljharb" 289 | } 290 | }, 291 | "node_modules/http-errors": { 292 | "version": "2.0.0", 293 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", 294 | "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", 295 | "dependencies": { 296 | "depd": "2.0.0", 297 | "inherits": "2.0.4", 298 | "setprototypeof": "1.2.0", 299 | "statuses": "2.0.1", 300 | "toidentifier": "1.0.1" 301 | }, 302 | "engines": { 303 | "node": ">= 0.8" 304 | } 305 | }, 306 | "node_modules/iconv-lite": { 307 | "version": "0.4.24", 308 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 309 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 310 | "dependencies": { 311 | "safer-buffer": ">= 2.1.2 < 3" 312 | }, 313 | "engines": { 314 | "node": ">=0.10.0" 315 | } 316 | }, 317 | "node_modules/inherits": { 318 | "version": "2.0.4", 319 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 320 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 321 | }, 322 | "node_modules/ipaddr.js": { 323 | "version": "1.9.1", 324 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", 325 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", 326 | "engines": { 327 | "node": ">= 0.10" 328 | } 329 | }, 330 | "node_modules/media-typer": { 331 | "version": "0.3.0", 332 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 333 | "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", 334 | "engines": { 335 | "node": ">= 0.6" 336 | } 337 | }, 338 | "node_modules/merge-descriptors": { 339 | "version": "1.0.1", 340 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 341 | "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" 342 | }, 343 | "node_modules/methods": { 344 | "version": "1.1.2", 345 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 346 | "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", 347 | "engines": { 348 | "node": ">= 0.6" 349 | } 350 | }, 351 | "node_modules/mime": { 352 | "version": "1.6.0", 353 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 354 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", 355 | "bin": { 356 | "mime": "cli.js" 357 | }, 358 | "engines": { 359 | "node": ">=4" 360 | } 361 | }, 362 | "node_modules/mime-db": { 363 | "version": "1.52.0", 364 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", 365 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", 366 | "engines": { 367 | "node": ">= 0.6" 368 | } 369 | }, 370 | "node_modules/mime-types": { 371 | "version": "2.1.35", 372 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", 373 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", 374 | "dependencies": { 375 | "mime-db": "1.52.0" 376 | }, 377 | "engines": { 378 | "node": ">= 0.6" 379 | } 380 | }, 381 | "node_modules/ms": { 382 | "version": "2.0.0", 383 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 384 | "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" 385 | }, 386 | "node_modules/negotiator": { 387 | "version": "0.6.3", 388 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", 389 | "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", 390 | "engines": { 391 | "node": ">= 0.6" 392 | } 393 | }, 394 | "node_modules/object-assign": { 395 | "version": "4.1.1", 396 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 397 | "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", 398 | "engines": { 399 | "node": ">=0.10.0" 400 | } 401 | }, 402 | "node_modules/object-inspect": { 403 | "version": "1.12.2", 404 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", 405 | "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", 406 | "funding": { 407 | "url": "https://github.com/sponsors/ljharb" 408 | } 409 | }, 410 | "node_modules/on-finished": { 411 | "version": "2.4.1", 412 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", 413 | "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", 414 | "dependencies": { 415 | "ee-first": "1.1.1" 416 | }, 417 | "engines": { 418 | "node": ">= 0.8" 419 | } 420 | }, 421 | "node_modules/parseurl": { 422 | "version": "1.3.3", 423 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 424 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", 425 | "engines": { 426 | "node": ">= 0.8" 427 | } 428 | }, 429 | "node_modules/path-to-regexp": { 430 | "version": "0.1.7", 431 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 432 | "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" 433 | }, 434 | "node_modules/proxy-addr": { 435 | "version": "2.0.7", 436 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", 437 | "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", 438 | "dependencies": { 439 | "forwarded": "0.2.0", 440 | "ipaddr.js": "1.9.1" 441 | }, 442 | "engines": { 443 | "node": ">= 0.10" 444 | } 445 | }, 446 | "node_modules/qs": { 447 | "version": "6.10.3", 448 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", 449 | "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", 450 | "dependencies": { 451 | "side-channel": "^1.0.4" 452 | }, 453 | "engines": { 454 | "node": ">=0.6" 455 | }, 456 | "funding": { 457 | "url": "https://github.com/sponsors/ljharb" 458 | } 459 | }, 460 | "node_modules/range-parser": { 461 | "version": "1.2.1", 462 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 463 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", 464 | "engines": { 465 | "node": ">= 0.6" 466 | } 467 | }, 468 | "node_modules/raw-body": { 469 | "version": "2.5.1", 470 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", 471 | "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", 472 | "dependencies": { 473 | "bytes": "3.1.2", 474 | "http-errors": "2.0.0", 475 | "iconv-lite": "0.4.24", 476 | "unpipe": "1.0.0" 477 | }, 478 | "engines": { 479 | "node": ">= 0.8" 480 | } 481 | }, 482 | "node_modules/safe-buffer": { 483 | "version": "5.2.1", 484 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 485 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", 486 | "funding": [ 487 | { 488 | "type": "github", 489 | "url": "https://github.com/sponsors/feross" 490 | }, 491 | { 492 | "type": "patreon", 493 | "url": "https://www.patreon.com/feross" 494 | }, 495 | { 496 | "type": "consulting", 497 | "url": "https://feross.org/support" 498 | } 499 | ] 500 | }, 501 | "node_modules/safer-buffer": { 502 | "version": "2.1.2", 503 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 504 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 505 | }, 506 | "node_modules/send": { 507 | "version": "0.18.0", 508 | "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", 509 | "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", 510 | "dependencies": { 511 | "debug": "2.6.9", 512 | "depd": "2.0.0", 513 | "destroy": "1.2.0", 514 | "encodeurl": "~1.0.2", 515 | "escape-html": "~1.0.3", 516 | "etag": "~1.8.1", 517 | "fresh": "0.5.2", 518 | "http-errors": "2.0.0", 519 | "mime": "1.6.0", 520 | "ms": "2.1.3", 521 | "on-finished": "2.4.1", 522 | "range-parser": "~1.2.1", 523 | "statuses": "2.0.1" 524 | }, 525 | "engines": { 526 | "node": ">= 0.8.0" 527 | } 528 | }, 529 | "node_modules/send/node_modules/ms": { 530 | "version": "2.1.3", 531 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 532 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" 533 | }, 534 | "node_modules/serve-static": { 535 | "version": "1.15.0", 536 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", 537 | "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", 538 | "dependencies": { 539 | "encodeurl": "~1.0.2", 540 | "escape-html": "~1.0.3", 541 | "parseurl": "~1.3.3", 542 | "send": "0.18.0" 543 | }, 544 | "engines": { 545 | "node": ">= 0.8.0" 546 | } 547 | }, 548 | "node_modules/setprototypeof": { 549 | "version": "1.2.0", 550 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", 551 | "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" 552 | }, 553 | "node_modules/side-channel": { 554 | "version": "1.0.4", 555 | "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", 556 | "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", 557 | "dependencies": { 558 | "call-bind": "^1.0.0", 559 | "get-intrinsic": "^1.0.2", 560 | "object-inspect": "^1.9.0" 561 | }, 562 | "funding": { 563 | "url": "https://github.com/sponsors/ljharb" 564 | } 565 | }, 566 | "node_modules/statuses": { 567 | "version": "2.0.1", 568 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", 569 | "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", 570 | "engines": { 571 | "node": ">= 0.8" 572 | } 573 | }, 574 | "node_modules/stripe": { 575 | "version": "10.12.0", 576 | "resolved": "https://registry.npmjs.org/stripe/-/stripe-10.12.0.tgz", 577 | "integrity": "sha512-4ijMsbTVSy6rzWIkal+/dFGeTXtjqLeZ/oo/jc2jhICbf3Dby0CBTPxAg6ZhBPXQL96TJxI613C/NhhE7LvrWw==", 578 | "dependencies": { 579 | "@types/node": ">=8.1.0", 580 | "qs": "^6.10.3" 581 | }, 582 | "engines": { 583 | "node": "^8.1 || >=10.*" 584 | } 585 | }, 586 | "node_modules/toidentifier": { 587 | "version": "1.0.1", 588 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", 589 | "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", 590 | "engines": { 591 | "node": ">=0.6" 592 | } 593 | }, 594 | "node_modules/type-is": { 595 | "version": "1.6.18", 596 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", 597 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", 598 | "dependencies": { 599 | "media-typer": "0.3.0", 600 | "mime-types": "~2.1.24" 601 | }, 602 | "engines": { 603 | "node": ">= 0.6" 604 | } 605 | }, 606 | "node_modules/unpipe": { 607 | "version": "1.0.0", 608 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 609 | "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", 610 | "engines": { 611 | "node": ">= 0.8" 612 | } 613 | }, 614 | "node_modules/utils-merge": { 615 | "version": "1.0.1", 616 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 617 | "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", 618 | "engines": { 619 | "node": ">= 0.4.0" 620 | } 621 | }, 622 | "node_modules/vary": { 623 | "version": "1.1.2", 624 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 625 | "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", 626 | "engines": { 627 | "node": ">= 0.8" 628 | } 629 | } 630 | }, 631 | "dependencies": { 632 | "@types/node": { 633 | "version": "18.7.23", 634 | "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.23.tgz", 635 | "integrity": "sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg==" 636 | }, 637 | "accepts": { 638 | "version": "1.3.8", 639 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", 640 | "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", 641 | "requires": { 642 | "mime-types": "~2.1.34", 643 | "negotiator": "0.6.3" 644 | } 645 | }, 646 | "array-flatten": { 647 | "version": "1.1.1", 648 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 649 | "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" 650 | }, 651 | "body-parser": { 652 | "version": "1.20.0", 653 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz", 654 | "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", 655 | "requires": { 656 | "bytes": "3.1.2", 657 | "content-type": "~1.0.4", 658 | "debug": "2.6.9", 659 | "depd": "2.0.0", 660 | "destroy": "1.2.0", 661 | "http-errors": "2.0.0", 662 | "iconv-lite": "0.4.24", 663 | "on-finished": "2.4.1", 664 | "qs": "6.10.3", 665 | "raw-body": "2.5.1", 666 | "type-is": "~1.6.18", 667 | "unpipe": "1.0.0" 668 | } 669 | }, 670 | "bytes": { 671 | "version": "3.1.2", 672 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", 673 | "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" 674 | }, 675 | "call-bind": { 676 | "version": "1.0.2", 677 | "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", 678 | "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", 679 | "requires": { 680 | "function-bind": "^1.1.1", 681 | "get-intrinsic": "^1.0.2" 682 | } 683 | }, 684 | "content-disposition": { 685 | "version": "0.5.4", 686 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", 687 | "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", 688 | "requires": { 689 | "safe-buffer": "5.2.1" 690 | } 691 | }, 692 | "content-type": { 693 | "version": "1.0.4", 694 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", 695 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" 696 | }, 697 | "cookie": { 698 | "version": "0.5.0", 699 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", 700 | "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" 701 | }, 702 | "cookie-signature": { 703 | "version": "1.0.6", 704 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 705 | "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" 706 | }, 707 | "cors": { 708 | "version": "2.8.5", 709 | "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", 710 | "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", 711 | "requires": { 712 | "object-assign": "^4", 713 | "vary": "^1" 714 | } 715 | }, 716 | "debug": { 717 | "version": "2.6.9", 718 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 719 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 720 | "requires": { 721 | "ms": "2.0.0" 722 | } 723 | }, 724 | "depd": { 725 | "version": "2.0.0", 726 | "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", 727 | "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" 728 | }, 729 | "destroy": { 730 | "version": "1.2.0", 731 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", 732 | "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" 733 | }, 734 | "ee-first": { 735 | "version": "1.1.1", 736 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 737 | "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" 738 | }, 739 | "encodeurl": { 740 | "version": "1.0.2", 741 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 742 | "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" 743 | }, 744 | "escape-html": { 745 | "version": "1.0.3", 746 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 747 | "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" 748 | }, 749 | "etag": { 750 | "version": "1.8.1", 751 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 752 | "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==" 753 | }, 754 | "express": { 755 | "version": "4.18.1", 756 | "resolved": "https://registry.npmjs.org/express/-/express-4.18.1.tgz", 757 | "integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==", 758 | "requires": { 759 | "accepts": "~1.3.8", 760 | "array-flatten": "1.1.1", 761 | "body-parser": "1.20.0", 762 | "content-disposition": "0.5.4", 763 | "content-type": "~1.0.4", 764 | "cookie": "0.5.0", 765 | "cookie-signature": "1.0.6", 766 | "debug": "2.6.9", 767 | "depd": "2.0.0", 768 | "encodeurl": "~1.0.2", 769 | "escape-html": "~1.0.3", 770 | "etag": "~1.8.1", 771 | "finalhandler": "1.2.0", 772 | "fresh": "0.5.2", 773 | "http-errors": "2.0.0", 774 | "merge-descriptors": "1.0.1", 775 | "methods": "~1.1.2", 776 | "on-finished": "2.4.1", 777 | "parseurl": "~1.3.3", 778 | "path-to-regexp": "0.1.7", 779 | "proxy-addr": "~2.0.7", 780 | "qs": "6.10.3", 781 | "range-parser": "~1.2.1", 782 | "safe-buffer": "5.2.1", 783 | "send": "0.18.0", 784 | "serve-static": "1.15.0", 785 | "setprototypeof": "1.2.0", 786 | "statuses": "2.0.1", 787 | "type-is": "~1.6.18", 788 | "utils-merge": "1.0.1", 789 | "vary": "~1.1.2" 790 | } 791 | }, 792 | "finalhandler": { 793 | "version": "1.2.0", 794 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", 795 | "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", 796 | "requires": { 797 | "debug": "2.6.9", 798 | "encodeurl": "~1.0.2", 799 | "escape-html": "~1.0.3", 800 | "on-finished": "2.4.1", 801 | "parseurl": "~1.3.3", 802 | "statuses": "2.0.1", 803 | "unpipe": "~1.0.0" 804 | } 805 | }, 806 | "forwarded": { 807 | "version": "0.2.0", 808 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", 809 | "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==" 810 | }, 811 | "fresh": { 812 | "version": "0.5.2", 813 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 814 | "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==" 815 | }, 816 | "function-bind": { 817 | "version": "1.1.1", 818 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 819 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" 820 | }, 821 | "get-intrinsic": { 822 | "version": "1.1.3", 823 | "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", 824 | "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", 825 | "requires": { 826 | "function-bind": "^1.1.1", 827 | "has": "^1.0.3", 828 | "has-symbols": "^1.0.3" 829 | } 830 | }, 831 | "has": { 832 | "version": "1.0.3", 833 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 834 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 835 | "requires": { 836 | "function-bind": "^1.1.1" 837 | } 838 | }, 839 | "has-symbols": { 840 | "version": "1.0.3", 841 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", 842 | "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" 843 | }, 844 | "http-errors": { 845 | "version": "2.0.0", 846 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", 847 | "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", 848 | "requires": { 849 | "depd": "2.0.0", 850 | "inherits": "2.0.4", 851 | "setprototypeof": "1.2.0", 852 | "statuses": "2.0.1", 853 | "toidentifier": "1.0.1" 854 | } 855 | }, 856 | "iconv-lite": { 857 | "version": "0.4.24", 858 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 859 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 860 | "requires": { 861 | "safer-buffer": ">= 2.1.2 < 3" 862 | } 863 | }, 864 | "inherits": { 865 | "version": "2.0.4", 866 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 867 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 868 | }, 869 | "ipaddr.js": { 870 | "version": "1.9.1", 871 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", 872 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" 873 | }, 874 | "media-typer": { 875 | "version": "0.3.0", 876 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 877 | "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==" 878 | }, 879 | "merge-descriptors": { 880 | "version": "1.0.1", 881 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 882 | "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" 883 | }, 884 | "methods": { 885 | "version": "1.1.2", 886 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 887 | "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==" 888 | }, 889 | "mime": { 890 | "version": "1.6.0", 891 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 892 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" 893 | }, 894 | "mime-db": { 895 | "version": "1.52.0", 896 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", 897 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" 898 | }, 899 | "mime-types": { 900 | "version": "2.1.35", 901 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", 902 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", 903 | "requires": { 904 | "mime-db": "1.52.0" 905 | } 906 | }, 907 | "ms": { 908 | "version": "2.0.0", 909 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 910 | "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" 911 | }, 912 | "negotiator": { 913 | "version": "0.6.3", 914 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", 915 | "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" 916 | }, 917 | "object-assign": { 918 | "version": "4.1.1", 919 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 920 | "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" 921 | }, 922 | "object-inspect": { 923 | "version": "1.12.2", 924 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", 925 | "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==" 926 | }, 927 | "on-finished": { 928 | "version": "2.4.1", 929 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", 930 | "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", 931 | "requires": { 932 | "ee-first": "1.1.1" 933 | } 934 | }, 935 | "parseurl": { 936 | "version": "1.3.3", 937 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 938 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" 939 | }, 940 | "path-to-regexp": { 941 | "version": "0.1.7", 942 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 943 | "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" 944 | }, 945 | "proxy-addr": { 946 | "version": "2.0.7", 947 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", 948 | "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", 949 | "requires": { 950 | "forwarded": "0.2.0", 951 | "ipaddr.js": "1.9.1" 952 | } 953 | }, 954 | "qs": { 955 | "version": "6.10.3", 956 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", 957 | "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", 958 | "requires": { 959 | "side-channel": "^1.0.4" 960 | } 961 | }, 962 | "range-parser": { 963 | "version": "1.2.1", 964 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 965 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" 966 | }, 967 | "raw-body": { 968 | "version": "2.5.1", 969 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", 970 | "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", 971 | "requires": { 972 | "bytes": "3.1.2", 973 | "http-errors": "2.0.0", 974 | "iconv-lite": "0.4.24", 975 | "unpipe": "1.0.0" 976 | } 977 | }, 978 | "safe-buffer": { 979 | "version": "5.2.1", 980 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 981 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" 982 | }, 983 | "safer-buffer": { 984 | "version": "2.1.2", 985 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 986 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 987 | }, 988 | "send": { 989 | "version": "0.18.0", 990 | "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", 991 | "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", 992 | "requires": { 993 | "debug": "2.6.9", 994 | "depd": "2.0.0", 995 | "destroy": "1.2.0", 996 | "encodeurl": "~1.0.2", 997 | "escape-html": "~1.0.3", 998 | "etag": "~1.8.1", 999 | "fresh": "0.5.2", 1000 | "http-errors": "2.0.0", 1001 | "mime": "1.6.0", 1002 | "ms": "2.1.3", 1003 | "on-finished": "2.4.1", 1004 | "range-parser": "~1.2.1", 1005 | "statuses": "2.0.1" 1006 | }, 1007 | "dependencies": { 1008 | "ms": { 1009 | "version": "2.1.3", 1010 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 1011 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" 1012 | } 1013 | } 1014 | }, 1015 | "serve-static": { 1016 | "version": "1.15.0", 1017 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", 1018 | "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", 1019 | "requires": { 1020 | "encodeurl": "~1.0.2", 1021 | "escape-html": "~1.0.3", 1022 | "parseurl": "~1.3.3", 1023 | "send": "0.18.0" 1024 | } 1025 | }, 1026 | "setprototypeof": { 1027 | "version": "1.2.0", 1028 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", 1029 | "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" 1030 | }, 1031 | "side-channel": { 1032 | "version": "1.0.4", 1033 | "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", 1034 | "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", 1035 | "requires": { 1036 | "call-bind": "^1.0.0", 1037 | "get-intrinsic": "^1.0.2", 1038 | "object-inspect": "^1.9.0" 1039 | } 1040 | }, 1041 | "statuses": { 1042 | "version": "2.0.1", 1043 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", 1044 | "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" 1045 | }, 1046 | "stripe": { 1047 | "version": "10.12.0", 1048 | "resolved": "https://registry.npmjs.org/stripe/-/stripe-10.12.0.tgz", 1049 | "integrity": "sha512-4ijMsbTVSy6rzWIkal+/dFGeTXtjqLeZ/oo/jc2jhICbf3Dby0CBTPxAg6ZhBPXQL96TJxI613C/NhhE7LvrWw==", 1050 | "requires": { 1051 | "@types/node": ">=8.1.0", 1052 | "qs": "^6.10.3" 1053 | } 1054 | }, 1055 | "toidentifier": { 1056 | "version": "1.0.1", 1057 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", 1058 | "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" 1059 | }, 1060 | "type-is": { 1061 | "version": "1.6.18", 1062 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", 1063 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", 1064 | "requires": { 1065 | "media-typer": "0.3.0", 1066 | "mime-types": "~2.1.24" 1067 | } 1068 | }, 1069 | "unpipe": { 1070 | "version": "1.0.0", 1071 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 1072 | "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" 1073 | }, 1074 | "utils-merge": { 1075 | "version": "1.0.1", 1076 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 1077 | "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" 1078 | }, 1079 | "vary": { 1080 | "version": "1.1.2", 1081 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 1082 | "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==" 1083 | } 1084 | } 1085 | } 1086 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "reactecommerceproject", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "server.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node server.js" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "cors": "^2.8.5", 15 | "express": "^4.18.1", 16 | "stripe": "^10.12.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | // sk_test_51LnUKJDM1jwCEz8OJG69szv032rIo4X0WrFMaXrqxu9g8fdohsL1y54JEUhFUKrqoBquVjN3AzpIFyrbN915bgcd00O5hqoGCJ 2 | // Coffee: price_1LnUTFDM1jwCEz8OGoOSXiSM 3 | // Sunglasses: price_1LnUTxDM1jwCEz8OAqHYTwKQ 4 | // Camera: price_1LnUUoDM1jwCEz8OvxIcJ7to 5 | const express = require('express'); 6 | var cors = require('cors'); 7 | const stripe = require('stripe')('sk_test_51LnUKJDM1jwCEz8OJG69szv032rIo4X0WrFMaXrqxu9g8fdohsL1y54JEUhFUKrqoBquVjN3AzpIFyrbN915bgcd00O5hqoGCJ'); 8 | 9 | const app = express(); 10 | app.use(cors()); 11 | app.use(express.static("public")); 12 | app.use(express.json()); 13 | 14 | app.post("/checkout", async (req, res) => { 15 | /* 16 | req.body.items 17 | [ 18 | { 19 | id: 1, 20 | quantity: 3 21 | } 22 | ] 23 | 24 | stripe wants 25 | [ 26 | { 27 | price: 1, 28 | quantity: 3 29 | } 30 | ] 31 | */ 32 | console.log(req.body); 33 | const items = req.body.items; 34 | let lineItems = []; 35 | items.forEach((item)=> { 36 | lineItems.push( 37 | { 38 | price: item.id, 39 | quantity: item.quantity 40 | } 41 | ) 42 | }); 43 | 44 | const session = await stripe.checkout.sessions.create({ 45 | line_items: lineItems, 46 | mode: 'payment', 47 | success_url: "http://localhost:3000/success", 48 | cancel_url: "http://localhost:3000/cancel" 49 | }); 50 | 51 | res.send(JSON.stringify({ 52 | url: session.url 53 | })); 54 | }); 55 | 56 | app.listen(4000, () => console.log("Listening on port 4000!")); -------------------------------------------------------------------------------- /store/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /store/README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. 13 | 14 | The page will reload when you make changes.\ 15 | You may also see any lint errors in the console. 16 | 17 | ### `npm test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `npm run build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `npm run eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!** 35 | 36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. 39 | 40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | 48 | ### Code Splitting 49 | 50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) 51 | 52 | ### Analyzing the Bundle Size 53 | 54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) 55 | 56 | ### Making a Progressive Web App 57 | 58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) 59 | 60 | ### Advanced Configuration 61 | 62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) 63 | 64 | ### Deployment 65 | 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 67 | 68 | ### `npm run build` fails to minify 69 | 70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) 71 | -------------------------------------------------------------------------------- /store/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "store", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.16.5", 7 | "@testing-library/react": "^13.4.0", 8 | "@testing-library/user-event": "^13.5.0", 9 | "bootstrap": "^5.2.1", 10 | "react": "^18.2.0", 11 | "react-bootstrap": "^2.5.0", 12 | "react-dom": "^18.2.0", 13 | "react-router-dom": "^6.4.1", 14 | "react-scripts": "5.0.1", 15 | "web-vitals": "^2.1.4" 16 | }, 17 | "scripts": { 18 | "start": "react-scripts start", 19 | "build": "react-scripts build", 20 | "test": "react-scripts test", 21 | "eject": "react-scripts eject" 22 | }, 23 | "eslintConfig": { 24 | "extends": [ 25 | "react-app", 26 | "react-app/jest" 27 | ] 28 | }, 29 | "browserslist": { 30 | "production": [ 31 | ">0.2%", 32 | "not dead", 33 | "not op_mini all" 34 | ], 35 | "development": [ 36 | "last 1 chrome version", 37 | "last 1 firefox version", 38 | "last 1 safari version" 39 | ] 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /store/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coopercodes/ReactEcommerceStoreWithStripeAPI/1d39dae72d4f9c55ae921731e8128581bfb123b4/store/public/favicon.ico -------------------------------------------------------------------------------- /store/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /store/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coopercodes/ReactEcommerceStoreWithStripeAPI/1d39dae72d4f9c55ae921731e8128581bfb123b4/store/public/logo192.png -------------------------------------------------------------------------------- /store/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coopercodes/ReactEcommerceStoreWithStripeAPI/1d39dae72d4f9c55ae921731e8128581bfb123b4/store/public/logo512.png -------------------------------------------------------------------------------- /store/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /store/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /store/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /store/src/App.js: -------------------------------------------------------------------------------- 1 | import logo from './logo.svg'; 2 | import './App.css'; 3 | import 'bootstrap/dist/css/bootstrap.min.css'; 4 | import NavbarComponent from './components/Navbar'; 5 | import { Container } from 'react-bootstrap'; 6 | import { BrowserRouter, Routes, Route} from "react-router-dom"; 7 | import Cancel from './pages/Cancel'; 8 | import Store from './pages/Store'; 9 | import Success from './pages/Success'; 10 | import CartProvider from './CartContext'; 11 | // localhost:3000 -> Home 12 | // localhost:3000/success -> Success 13 | 14 | function App() { 15 | return ( 16 | 17 | 18 | 19 | 20 | 21 | } /> 22 | } /> 23 | } /> 24 | 25 | 26 | 27 | 28 | ); 29 | } 30 | 31 | export default App; 32 | -------------------------------------------------------------------------------- /store/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /store/src/CartContext.js: -------------------------------------------------------------------------------- 1 | import { createContext, useState } from "react"; 2 | import { productsArray, getProductData } from "./productsStore"; 3 | 4 | 5 | export const CartContext = createContext({ 6 | items: [], 7 | getProductQuantity: () => {}, 8 | addOneToCart: () => {}, 9 | removeOneFromCart: () => {}, 10 | deleteFromCart: () => {}, 11 | getTotalCost: () => {} 12 | }); 13 | 14 | export function CartProvider({children}) { 15 | const [cartProducts, setCartProducts] = useState([]); 16 | 17 | // [ { id: 1 , quantity: 3 }, { id: 2, quantity: 1 } ] 18 | 19 | function getProductQuantity(id) { 20 | const quantity = cartProducts.find(product => product.id === id)?.quantity; 21 | 22 | if (quantity === undefined) { 23 | return 0; 24 | } 25 | 26 | return quantity; 27 | } 28 | 29 | function addOneToCart(id) { 30 | const quantity = getProductQuantity(id); 31 | 32 | if (quantity === 0) { // product is not in cart 33 | setCartProducts( 34 | [ 35 | ...cartProducts, 36 | { 37 | id: id, 38 | quantity: 1 39 | } 40 | ] 41 | ) 42 | } else { // product is in cart 43 | // [ { id: 1 , quantity: 3 }, { id: 2, quantity: 1 } ] add to product id of 2 44 | setCartProducts( 45 | cartProducts.map( 46 | product => 47 | product.id === id // if condition 48 | ? { ...product, quantity: product.quantity + 1 } // if statement is true 49 | : product // if statement is false 50 | ) 51 | ) 52 | } 53 | } 54 | 55 | function removeOneFromCart(id) { 56 | const quantity = getProductQuantity(id); 57 | 58 | if(quantity == 1) { 59 | deleteFromCart(id); 60 | } else { 61 | setCartProducts( 62 | cartProducts.map( 63 | product => 64 | product.id === id // if condition 65 | ? { ...product, quantity: product.quantity - 1 } // if statement is true 66 | : product // if statement is false 67 | ) 68 | ) 69 | } 70 | } 71 | 72 | function deleteFromCart(id) { 73 | // [] if an object meets a condition, add the object to array 74 | // [product1, product2, product3] 75 | // [product1, product3] 76 | setCartProducts( 77 | cartProducts => 78 | cartProducts.filter(currentProduct => { 79 | return currentProduct.id != id; 80 | }) 81 | ) 82 | } 83 | 84 | function getTotalCost() { 85 | let totalCost = 0; 86 | cartProducts.map((cartItem) => { 87 | const productData = getProductData(cartItem.id); 88 | totalCost += (productData.price * cartItem.quantity); 89 | }); 90 | return totalCost; 91 | } 92 | 93 | const contextValue = { 94 | items: cartProducts, 95 | getProductQuantity, 96 | addOneToCart, 97 | removeOneFromCart, 98 | deleteFromCart, 99 | getTotalCost 100 | } 101 | 102 | return ( 103 | 104 | {children} 105 | 106 | ) 107 | } 108 | 109 | export default CartProvider; 110 | 111 | 112 | // CODE DOWN HERE 113 | 114 | // Context (cart, addToCart, removeCart) 115 | // Provider -> gives your React app access to all the things in your context -------------------------------------------------------------------------------- /store/src/components/CartProduct.js: -------------------------------------------------------------------------------- 1 | import Button from 'react-bootstrap/Button'; 2 | import { CartContext } from "../CartContext"; 3 | import { useContext } from "react"; 4 | import { getProductData } from "../productsStore"; 5 | 6 | function CartProduct(props) { 7 | const cart = useContext(CartContext); 8 | const id = props.id; 9 | const quantity = props.quantity; 10 | const productData = getProductData(id); 11 | 12 | return ( 13 | <> 14 |

{productData.title}

15 |

{quantity} total

16 |

${ (quantity * productData.price).toFixed(2) }

17 | 18 |
19 | 20 | ) 21 | } 22 | 23 | export default CartProduct; -------------------------------------------------------------------------------- /store/src/components/Navbar.js: -------------------------------------------------------------------------------- 1 | import {Button, Container, Navbar, Modal} from 'react-bootstrap'; 2 | import { useState, useContext } from 'react'; 3 | import { CartContext } from "../CartContext"; 4 | import CartProduct from './CartProduct'; 5 | 6 | function NavbarComponent() { 7 | const cart = useContext(CartContext); 8 | 9 | const [show, setShow] = useState(false); 10 | const handleClose = () => setShow(false); 11 | const handleShow = () => setShow(true); 12 | 13 | const checkout = async () => { 14 | await fetch('http://localhost:4000/checkout', { 15 | method: "POST", 16 | headers: { 17 | 'Content-Type': 'application/json' 18 | }, 19 | body: JSON.stringify({items: cart.items}) 20 | }).then((response) => { 21 | return response.json(); 22 | }).then((response) => { 23 | if(response.url) { 24 | window.location.assign(response.url); // Forwarding user to Stripe 25 | } 26 | }); 27 | } 28 | 29 | const productsCount = cart.items.reduce((sum, product) => sum + product.quantity, 0); 30 | 31 | return ( 32 | <> 33 | 34 | Ecommerce Store 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | Shopping Cart 43 | 44 | 45 | {productsCount > 0 ? 46 | <> 47 |

Items in your cart:

48 | {cart.items.map( (currentProduct, idx) => ( 49 | 50 | ))} 51 | 52 |

Total: {cart.getTotalCost().toFixed(2)}

53 | 54 | 57 | 58 | : 59 |

There are no items in your cart!

60 | } 61 |
62 |
63 | 64 | ) 65 | } 66 | 67 | export default NavbarComponent; -------------------------------------------------------------------------------- /store/src/components/ProductCard.js: -------------------------------------------------------------------------------- 1 | import { Card, Button, Form, Row, Col } from 'react-bootstrap'; 2 | import { CartContext } from '../CartContext'; 3 | import { useContext } from 'react'; 4 | 5 | function ProductCard(props) { // props.product is the product we are selling 6 | const product = props.product; 7 | const cart = useContext(CartContext); 8 | const productQuantity = cart.getProductQuantity(product.id); 9 | console.log(cart.items); 10 | return ( 11 | 12 | 13 | {product.title} 14 | ${product.price} 15 | { productQuantity > 0 ? 16 | <> 17 |
18 | In Cart: {productQuantity} 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | : 27 | 28 | } 29 |
30 |
31 | ) 32 | } 33 | 34 | export default ProductCard; -------------------------------------------------------------------------------- /store/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /store/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | const root = ReactDOM.createRoot(document.getElementById('root')); 8 | root.render( 9 | 10 | 11 | 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /store/src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /store/src/pages/Cancel.js: -------------------------------------------------------------------------------- 1 | 2 | function Cancel() { 3 | return ( 4 |

Sorry to see you cancelled your Stripe payment!

5 | ) 6 | } 7 | 8 | export default Cancel; -------------------------------------------------------------------------------- /store/src/pages/Store.js: -------------------------------------------------------------------------------- 1 | import {Row, Col} from 'react-bootstrap'; 2 | import { productsArray } from '../productsStore'; 3 | import ProductCard from '../components/ProductCard'; 4 | // [{... }, {... }, {... }] 5 | function Store() { 6 | 7 | return ( 8 | <> 9 |

Welcome to the store!

10 | 11 | {productsArray.map((product, idx) => ( 12 | 13 | 14 | 15 | ))} 16 | 17 | 18 | ) 19 | } 20 | 21 | export default Store; -------------------------------------------------------------------------------- /store/src/pages/Success.js: -------------------------------------------------------------------------------- 1 | 2 | function Success() { 3 | return ( 4 |

Thank you for your purchase!

5 | ) 6 | } 7 | 8 | export default Success; -------------------------------------------------------------------------------- /store/src/productsStore.js: -------------------------------------------------------------------------------- 1 | // Coffee: price_1LnUTFDM1jwCEz8OGoOSXiSM 2 | // Sunglasses: price_1LnUTxDM1jwCEz8OAqHYTwKQ 3 | // Camera: price_1LnUUoDM1jwCEz8OvxIcJ7to 4 | 5 | const productsArray = [ 6 | { 7 | id: "price_1LnUTFDM1jwCEz8OGoOSXiSM", 8 | title: "Coffee", 9 | price: 4.99 10 | }, 11 | { 12 | id: "price_1LnUTxDM1jwCEz8OAqHYTwKQ", 13 | title: "Sunglasses", 14 | price: 9.99 15 | }, 16 | { 17 | id: "price_1LnUUoDM1jwCEz8OvxIcJ7to", 18 | title: "Camera", 19 | price: 39.99 20 | } 21 | ]; 22 | 23 | function getProductData(id) { 24 | let productData = productsArray.find(product => product.id === id); 25 | 26 | if (productData == undefined) { 27 | console.log("Product data does not exist for ID: " + id); 28 | return undefined; 29 | } 30 | 31 | return productData; 32 | } 33 | 34 | export { productsArray, getProductData }; -------------------------------------------------------------------------------- /store/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /store/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | --------------------------------------------------------------------------------