diff --git a/README.md b/README.md index b6e4a64..16cee1b 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ This may take up to and over an hour to complete, mostly on the deployment of in * GetRecommendations * GetRecommendationsByItem 3. In the environment section and replace the ARN with the one create from jupyter notebook. -4. Goto ``/webui``, Open config.tsx file and edit the following varible +4. Goto ``/webui/src/``, Open [confix.tsx](/webui/src/index.tsx) file and edit the following varible. These varible can be found in cloudformation output. * Apitree * AnonymousPoolId * StreamName diff --git a/deploy.sh b/deploy.sh index cf47353..a754dc6 100755 --- a/deploy.sh +++ b/deploy.sh @@ -75,6 +75,7 @@ sam deploy \ --parameter-overrides BucketName=$SRCS3 ProjectName=$STACKNAME # --disable-rollback +#TODO: edit webui/src/config.tsx to point to the same API echo "Getting web bucket name from stack output..." WEBBUCKETNAME=`aws cloudformation describe-stacks --stack-name $STACKNAME \ diff --git a/functions/APIs/PostClickEvent/index.py b/functions/APIs/PostClickEvent/index.py index ca5141c..d6edfec 100644 --- a/functions/APIs/PostClickEvent/index.py +++ b/functions/APIs/PostClickEvent/index.py @@ -21,6 +21,8 @@ def handler(event, context): def send_clickEvent(clickEvent): try: session_ID = clickEvent['sessionID'] + if session_ID == None: + session_ID = str(uuid.uuid1()) except: session_ID = str(uuid.uuid1()) diff --git a/webui/package-lock.json b/webui/package-lock.json index 0f43cd8..0fd4d07 100644 --- a/webui/package-lock.json +++ b/webui/package-lock.json @@ -4,262 +4,6 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "@aws-amplify/analytics": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@aws-amplify/analytics/-/analytics-2.2.0.tgz", - "integrity": "sha512-EFv5hf175lxnRRhqUpCKgDVv0zjI7v05DNd68pjSRAT1MK0v81KzLkeCcTLkb4K7QBpqopcRMxMStsyD7EiPMA==", - "requires": { - "@aws-amplify/cache": "^2.1.1", - "@aws-amplify/core": "^2.2.0", - "uuid": "^3.2.1" - } - }, - "@aws-amplify/api": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@aws-amplify/api/-/api-2.1.1.tgz", - "integrity": "sha512-hjo09hKhOS9QNADhPnkLVJyzP8cxNvnzF/zdA7SATw9BwrDjH8t1QUpdUXCKZrNfXoETCjD4bm83owNHfzF6ag==", - "requires": { - "@aws-amplify/auth": "^2.1.1", - "@aws-amplify/cache": "^2.1.1", - "@aws-amplify/core": "^2.2.0", - "@types/zen-observable": "^0.5.3", - "axios": "^0.19.0", - "graphql": "14.0.0", - "uuid": "^3.2.1", - "zen-observable": "^0.8.6" - }, - "dependencies": { - "graphql": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-14.0.0.tgz", - "integrity": "sha512-HGVcnO6B25YZcSt6ZsH6/N+XkYuPA7yMqJmlJ4JWxWlS4Tr8SHI56R1Ocs8Eor7V7joEZPRXPDH8RRdll1w44Q==", - "requires": { - "iterall": "^1.2.2" - } - } - } - }, - "@aws-amplify/auth": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@aws-amplify/auth/-/auth-2.1.1.tgz", - "integrity": "sha512-tjlKeVbGA/WiMJrY9uSxd5nS0H0Aykf4weQaWdm72c1+4/DEfVP8U9w/km3mIUI4cNk1/A8D0E1dBvJDHppGNg==", - "requires": { - "@aws-amplify/cache": "^2.1.1", - "@aws-amplify/core": "^2.2.0", - "amazon-cognito-identity-js": "^3.2.0", - "crypto-js": "^3.1.9-1" - } - }, - "@aws-amplify/cache": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@aws-amplify/cache/-/cache-2.1.1.tgz", - "integrity": "sha512-Vlg4IArsGlmsEu9WxrmuS3Qsr2Ne8OvoiTm1BhVog9RbtXpllFVvujBjJYHsTPKi+CGzfM9c/Jlq61dfbKicqg==", - "requires": { - "@aws-amplify/core": "^2.2.0" - } - }, - "@aws-amplify/core": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@aws-amplify/core/-/core-2.2.0.tgz", - "integrity": "sha512-roKXGCUy3tVtVcxemsvBEtVvQmob4gPlUa1pWba6/MRXzUHT29YW1IY/mVMlmBIMXz5gdeq6n7kvCoMZg3oGXA==", - "requires": { - "aws-sdk": "2.518.0", - "url": "^0.11.0" - }, - "dependencies": { - "aws-sdk": { - "version": "2.518.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.518.0.tgz", - "integrity": "sha512-hwtKKf93TFyd3qugDW54ElpkUXhPe+ArPIHadre6IAFjCJiv08L8DaZKLRyclDnKfTavKe+f/PhdSEYo1QUHiA==", - "requires": { - "buffer": "4.9.1", - "events": "1.1.1", - "ieee754": "1.1.8", - "jmespath": "0.15.0", - "querystring": "0.2.0", - "sax": "1.2.1", - "url": "0.10.3", - "uuid": "3.3.2", - "xml2js": "0.4.19" - }, - "dependencies": { - "url": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", - "integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=", - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - } - } - }, - "buffer": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", - "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" - } - }, - "events": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", - "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=" - }, - "ieee754": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.8.tgz", - "integrity": "sha1-vjPUCsEO8ZJnAfbwii2G+/0a0+Q=" - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" - }, - "sax": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", - "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" - }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" - } - } - }, - "@aws-amplify/interactions": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@aws-amplify/interactions/-/interactions-2.1.1.tgz", - "integrity": "sha512-hRuiwtycpIb7+J5UrYrfe+4y9dYt4CjlNOLV9OZ+rIOqvlrhcUeCWEBdUoY2/IwNX5UofP7WMmg2X6W9c43xXg==", - "requires": { - "@aws-amplify/core": "^2.2.0" - } - }, - "@aws-amplify/predictions": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@aws-amplify/predictions/-/predictions-2.1.1.tgz", - "integrity": "sha512-UuCY8jUcPeoc2Wud1/XFJQzd0Fi5ANSgTAvZlhvgIdkXV7DMYQZmputMJALv8eKqRkLsMSd6RoUS4PKf25SOZQ==", - "requires": { - "@aws-amplify/core": "^2.2.0", - "@aws-amplify/storage": "^2.1.1", - "@aws-sdk/eventstream-marshaller": "0.1.0-preview.2", - "@aws-sdk/util-utf8-node": "0.1.0-preview.1", - "uuid": "^3.2.1" - } - }, - "@aws-amplify/pubsub": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@aws-amplify/pubsub/-/pubsub-2.1.1.tgz", - "integrity": "sha512-c6GH5H0ZvpWo9PjjOe1NLi/m6IGIDPsUUO71LdTY8diBp8liVts1yV0iHfbn8QBiUqtrgsYneL/aufDntk2v7A==", - "requires": { - "@aws-amplify/auth": "^2.1.1", - "@aws-amplify/cache": "^2.1.1", - "@aws-amplify/core": "^2.2.0", - "@types/zen-observable": "^0.5.3", - "graphql": "14.0.0", - "paho-mqtt": "^1.1.0", - "uuid": "^3.2.1", - "zen-observable": "^0.8.6" - }, - "dependencies": { - "graphql": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-14.0.0.tgz", - "integrity": "sha512-HGVcnO6B25YZcSt6ZsH6/N+XkYuPA7yMqJmlJ4JWxWlS4Tr8SHI56R1Ocs8Eor7V7joEZPRXPDH8RRdll1w44Q==", - "requires": { - "iterall": "^1.2.2" - } - } - } - }, - "@aws-amplify/storage": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@aws-amplify/storage/-/storage-2.1.1.tgz", - "integrity": "sha512-Q5CXVQNd8prMS+ouq+K5cwwtsYU1hFYEsyJnzCMnwMD4rgPEHluaXYnEjv66AdWW/GzvyAN8WC7rrImcDxE2iA==", - "requires": { - "@aws-amplify/core": "^2.2.0" - } - }, - "@aws-amplify/ui": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@aws-amplify/ui/-/ui-1.1.3.tgz", - "integrity": "sha512-XSGsCTJKgrwRTYUjnGIkVhy+pEZ8DiNCxelJyj0mkst7PStqZG+TkaixA/OSFHscRRxTsO2CXFgVGFcgKWLAVA==" - }, - "@aws-amplify/xr": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@aws-amplify/xr/-/xr-1.1.1.tgz", - "integrity": "sha512-gymmdI37eaEhPYDEMAmFxo/3lxiLN+RioOLde/h9tuXhJOHdKOpiRY+LNWs4kpe7srjx+qnJU1OYM/gjMsQrWQ==", - "requires": { - "@aws-amplify/core": "^2.2.0" - } - }, - "@aws-crypto/crc32": { - "version": "0.1.0-preview.3", - "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-0.1.0-preview.3.tgz", - "integrity": "sha512-zFTrBn6zsfzSLRYld7AcyvQBd1+Fl+8io7AHFgCMlcYxVaeMXsVrP+QKzJZADsi/XYB0XavI9Dh9GucSjsiW4Q==", - "requires": { - "tslib": "^1.9.3" - } - }, - "@aws-sdk/eventstream-marshaller": { - "version": "0.1.0-preview.2", - "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-marshaller/-/eventstream-marshaller-0.1.0-preview.2.tgz", - "integrity": "sha512-StNivqLMGk+6Blp7eBYgLvidD9HEhthzNz7dBBAQPELx3Nd3imodzSvckDw5ZkuWt6ViP+aAl8HgQvJmD71M5Q==", - "requires": { - "@aws-crypto/crc32": "^0.1.0-preview.1", - "@aws-sdk/types": "^0.1.0-preview.1", - "@aws-sdk/util-hex-encoding": "^0.1.0-preview.1", - "tslib": "^1.8.0" - } - }, - "@aws-sdk/is-array-buffer": { - "version": "0.1.0-preview.1", - "resolved": "https://registry.npmjs.org/@aws-sdk/is-array-buffer/-/is-array-buffer-0.1.0-preview.1.tgz", - "integrity": "sha512-9Qrr9w6sNX19N0eO7JBYjp86OPcOyjDPe580L5ISDKo7XfuzK20IC2TeGTZ77okhRTsm8rF5UgP9scBu59jwoA==", - "requires": { - "tslib": "^1.8.0" - } - }, - "@aws-sdk/types": { - "version": "0.1.0-preview.1", - "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-0.1.0-preview.1.tgz", - "integrity": "sha512-CcZpxyN2G0I7+Jyj0om3LafYX7d30JWJAAQ+53Ysjau7jyL/xLMMkLZgniQPV8BMV7uKLXyf4hwu8JSs0Ejb+w==" - }, - "@aws-sdk/util-buffer-from": { - "version": "0.1.0-preview.1", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-buffer-from/-/util-buffer-from-0.1.0-preview.1.tgz", - "integrity": "sha512-i46iuFQA05+92L/epK7befgoxw6DM38LnaHjHNxRoJeIYUllZvpJst74FRCJ5UvVOaMDvHO3woWG+dY8/KVABw==", - "requires": { - "@aws-sdk/is-array-buffer": "^0.1.0-preview.1", - "tslib": "^1.8.0" - } - }, - "@aws-sdk/util-hex-encoding": { - "version": "0.1.0-preview.1", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-hex-encoding/-/util-hex-encoding-0.1.0-preview.1.tgz", - "integrity": "sha512-97ZMVcJpIXwOQN2RntPimav6G5iod/QHEbqGrmaECXyjXzSrexKHRYjpQAtmJ7geZTMsofoRSdj3qZCymjn7Uw==", - "requires": { - "tslib": "^1.8.0" - } - }, - "@aws-sdk/util-utf8-node": { - "version": "0.1.0-preview.1", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-utf8-node/-/util-utf8-node-0.1.0-preview.1.tgz", - "integrity": "sha512-PSUsSJ0nnMPS389f0R3kIVR0BElnEb22Ofj40iO5HCtw9gZ1ot+enFdbOmW4m1e5+ED9U/Hqxqc7QhFWWF4NUQ==", - "requires": { - "@aws-sdk/util-buffer-from": "^0.1.0-preview.1", - "tslib": "^1.8.0" - } - }, "@babel/code-frame": { "version": "7.5.5", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", @@ -1928,6 +1672,12 @@ "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", "integrity": "sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==" }, + "@types/uuid": { + "version": "3.4.7", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.7.tgz", + "integrity": "sha512-C2j2FWgQkF1ru12SjZJyMaTPxs/f6n90+5G5qNakBxKXjTBc/YTSelHh4Pz1HUDwxFXD9WvpQhOGCDC+/Y4mIQ==", + "dev": true + }, "@types/yargs": { "version": "13.0.3", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.3.tgz", @@ -1941,11 +1691,6 @@ "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-13.1.0.tgz", "integrity": "sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg==" }, - "@types/zen-observable": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/@types/zen-observable/-/zen-observable-0.5.4.tgz", - "integrity": "sha512-sW6xN96wUak4tgc89d0tbTg7QDGYhGv5hvQIS6h4mRCd8h2btiZ80loPU8cyLwsBbA4ZeQt0FjvUhJ4rNhdsGg==" - }, "@typescript-eslint/eslint-plugin": { "version": "2.12.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.12.0.tgz", @@ -2265,33 +2010,6 @@ "resolved": "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz", "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=" }, - "amazon-cognito-identity-js": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/amazon-cognito-identity-js/-/amazon-cognito-identity-js-3.2.0.tgz", - "integrity": "sha512-JAvKVW8lVCaOFl6H3NpQrwjIsg/6nbKMXwaPATmpbRkS0aVCTjluijsg3jANBKcBByscU5eIyh8l4Vc1+gmRyw==", - "requires": { - "buffer": "4.9.1", - "crypto-js": "^3.1.9-1", - "js-cookie": "^2.1.4" - }, - "dependencies": { - "buffer": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", - "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - } - } - }, "ansi-colors": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", @@ -2509,24 +2227,6 @@ "postcss-value-parser": "^4.0.2" } }, - "aws-amplify": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/aws-amplify/-/aws-amplify-2.2.0.tgz", - "integrity": "sha512-3eG/qRzl29y4Ro5PHZrmzRB64eg0+/xYU9w1Kb3iJG8CdMux3W5+1fQnfjKOFSSImlUdgDos2Wlrm243NRb+Nw==", - "requires": { - "@aws-amplify/analytics": "^2.2.0", - "@aws-amplify/api": "^2.1.1", - "@aws-amplify/auth": "^2.1.1", - "@aws-amplify/cache": "^2.1.1", - "@aws-amplify/core": "^2.2.0", - "@aws-amplify/interactions": "^2.1.1", - "@aws-amplify/predictions": "^2.1.1", - "@aws-amplify/pubsub": "^2.1.1", - "@aws-amplify/storage": "^2.1.1", - "@aws-amplify/ui": "^1.1.3", - "@aws-amplify/xr": "^1.1.1" - } - }, "aws-sdk": { "version": "2.608.0", "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.608.0.tgz", @@ -2599,43 +2299,6 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.0.tgz", "integrity": "sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A==" }, - "axios": { - "version": "0.19.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz", - "integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==", - "requires": { - "follow-redirects": "1.5.10", - "is-buffer": "^2.0.2" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - }, - "follow-redirects": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", - "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", - "requires": { - "debug": "=3.1.0" - } - }, - "is-buffer": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", - "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - } - } - }, "axobject-query": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.1.1.tgz", @@ -4515,11 +4178,6 @@ "randomfill": "^1.0.3" } }, - "crypto-js": { - "version": "3.1.9-1", - "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.9-1.tgz", - "integrity": "sha1-/aGedh/Ad+Af+/3G6f38WeiAbNg=" - }, "css": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/css/-/css-2.2.4.tgz", @@ -8634,11 +8292,6 @@ "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=" }, - "js-cookie": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz", - "integrity": "sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ==" - }, "js-levenshtein": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", @@ -10106,11 +9759,6 @@ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" }, - "paho-mqtt": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/paho-mqtt/-/paho-mqtt-1.1.0.tgz", - "integrity": "sha512-KPbL9KAB0ASvhSDbOrZBaccXS+/s7/LIofbPyERww8hM5Ko71GUJQ6Nmg0BWqj8phAIT8zdf/Sd/RftHU9i2HA==" - }, "pako": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz", @@ -11982,11 +11630,6 @@ "react-lifecycles-compat": "^3.0.4" } }, - "react-uid": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/react-uid/-/react-uid-2.2.0.tgz", - "integrity": "sha512-z+g5+hFOQ08hCfrGcJ1PNs+cmvH8Uq2CVzCmPeWBsUi5A4W4NWXR5jouledzy3oSKGMU9HOzf8zFuGi15TXJoQ==" - }, "read-pkg": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", @@ -12270,6 +11913,11 @@ "psl": "^1.1.24", "punycode": "^1.4.1" } + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" } } }, @@ -12966,6 +12614,13 @@ "requires": { "faye-websocket": "^0.10.0", "uuid": "^3.0.1" + }, + "dependencies": { + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + } } }, "sockjs-client": { @@ -14098,9 +13753,9 @@ "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, "uuid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", - "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==" + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.0.tgz", + "integrity": "sha512-LNUrNsXdI/fUsypJbWM8Jt4DgQdFAZh41p9C7WE9Cn+CULOEkoG2lgQyH68v3wnIy5K3fN4jdSt270K6IFA3MQ==" }, "v8-compile-cache": { "version": "2.1.0", @@ -14536,6 +14191,13 @@ "requires": { "ansi-colors": "^3.0.0", "uuid": "^3.3.2" + }, + "dependencies": { + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + } } }, "webpack-manifest-plugin": { @@ -14977,11 +14639,6 @@ "camelcase": "^5.0.0", "decamelize": "^1.2.0" } - }, - "zen-observable": { - "version": "0.8.15", - "resolved": "https://registry.npmjs.org/zen-observable/-/zen-observable-0.8.15.tgz", - "integrity": "sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==" } } } diff --git a/webui/package.json b/webui/package.json index 489f3d1..1cd17f9 100644 --- a/webui/package.json +++ b/webui/package.json @@ -13,19 +13,18 @@ "@types/react-dom": "^16.0.11", "@types/react-router-bootstrap": "^0.24.5", "@types/react-router-dom": "^4.3.1", - "aws-amplify": "^2.2.0", "aws-sdk": "^2.608.0", - "bootstrap": "^3.3.7", "html-entities": "^1.2.1", "query-string": "^6.9.0", "react": "^16.12.0", "react-bootstrap": "^0.32.4", + "bootstrap": "^3.3.7", "react-dom": "^16.12.0", "react-router-bootstrap": "^0.24.4", "react-router-dom": "^5.1.2", "react-scripts": "^3.3.0", - "react-uid": "^2.2.0", - "typescript": "^3.2.1" + "typescript": "^3.2.1", + "uuid": "^7.0.0" }, "scripts": { "start": "react-scripts start", @@ -33,7 +32,9 @@ "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" }, - "devDependencies": {}, + "devDependencies": { + "@types/uuid": "^3.4.7" + }, "browserslist": [ ">0.2%", "not dead", diff --git a/webui/src/App.css b/webui/src/App.css index aa5d1b7..0c102ed 100644 --- a/webui/src/App.css +++ b/webui/src/App.css @@ -54,7 +54,7 @@ overflow-x: auto; white-space: nowrap; } -.testimonial-group > .row > .col-xs-4 { +.testimonial-group > .row > .col-xs-6 { display: inline-block; float: none; } diff --git a/webui/src/App.tsx b/webui/src/App.tsx index ef64c59..e9b55da 100644 --- a/webui/src/App.tsx +++ b/webui/src/App.tsx @@ -6,6 +6,7 @@ import RecommendationList from "./modules/recommendationList/recommendationList" import notFound from "./modules/notFound/notFound"; import ProductDetail from "./modules/productDetail/productDetail"; import SearchBar from "./modules/searchBar/searchBar"; +import uuid, { v4 as uuidv4 } from 'uuid'; import "./App.css"; const userList = [ @@ -48,7 +49,8 @@ interface User { interface AppState { selectedUser: User | undefined; - userSelectedName : string + userSelectedName : string; + SID : string | null; } class App extends Component, AppState> { @@ -59,12 +61,14 @@ class App extends Component, AppState> { let userobj = JSON.parse(user) this.state = { selectedUser: userobj, - userSelectedName : `${userobj.firstName} ${userobj.lastName}` + userSelectedName : `${userobj.firstName} ${userobj.lastName}`, + SID : localStorage.getItem('SID') }; }else{ this.state = { selectedUser: undefined, - userSelectedName : '' + userSelectedName : '', + SID : null }; } this.renderSelectOptions = this.renderSelectOptions.bind(this); @@ -74,16 +78,21 @@ class App extends Component, AppState> { renderSelectOptions(eventKey : any) { console.log('eventKey',eventKey) + let SID = uuidv4() if(eventKey === 'anonymous'){ this.setState({ userSelectedName: 'anonymous'}); this.setState({ selectedUser: undefined}); + this.setState({ SID: null}); localStorage.removeItem('user'); + localStorage.removeItem('SID'); }else{ this.setState({ userSelectedName: `${userList[eventKey].firstName} ${userList[eventKey].lastName}` }); this.setState({ selectedUser: userList[eventKey]}); + this.setState({ SID: SID}); localStorage.setItem('user', JSON.stringify(userList[eventKey])); + localStorage.setItem('SID', SID); } } @@ -110,9 +119,9 @@ class App extends Component, AppState> {