diff --git a/package-lock.json b/package-lock.json index 98ef3053d..7993f863f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3643,8 +3643,7 @@ "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", - "dev": true + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" }, "buffer-xor": { "version": "1.0.3", @@ -4266,7 +4265,6 @@ "version": "1.6.2", "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, "requires": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", @@ -4277,14 +4275,12 @@ "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -4299,7 +4295,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, "requires": { "safe-buffer": "~5.1.0" } @@ -5669,12 +5664,12 @@ } }, "eslint-plugin-cypress": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-2.2.1.tgz", - "integrity": "sha512-WkH81MEALKhnpeRo/wWHBHR883LdkS8aFzbGAGFxiwRwik2IKBZxb/JrxbiA6+SZskXGcmdEi6rwL7xmiqo9MA==", + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-2.10.3.tgz", + "integrity": "sha512-CvFeoCquShfO8gHNIKA1VpUTz78WtknMebLemBd1lRbcmJNjwpqCqpQYUG/XVja8GjdX/e2TJXYa+EUBxehtUg==", "dev": true, "requires": { - "globals": "^11.0.1" + "globals": "^11.12.0" }, "dependencies": { "globals": { @@ -12187,68 +12182,6 @@ "yakaa": "^1.0.1" }, "dependencies": { - "concat-stream": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.5.1.tgz", - "integrity": "sha1-87gKz54fSOOHXAaItBtsMWAu6hw=", - "requires": { - "inherits": "~2.0.1", - "readable-stream": "~2.0.0", - "typedarray": "~0.0.5" - }, - "dependencies": { - "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=" - }, - "readable-stream": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.5.tgz", - "integrity": "sha1-okJvjc1FUcd6M/lu3yiGojyClmk=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "process-nextick-args": "~1.0.6", - "string_decoder": "~0.10.x", - "util-deprecate": "~1.0.1" - }, - "dependencies": { - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "process-nextick-args": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.6.tgz", - "integrity": "sha1-D5awAc6pCxJZLOVm7bl+wR5pvQU=" - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - } - } - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" - } - } - }, "https-proxy-agent": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-0.3.6.tgz", @@ -15383,9 +15316,9 @@ } }, "redux-mock-store": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/redux-mock-store/-/redux-mock-store-1.5.3.tgz", - "integrity": "sha512-ryhkkb/4D4CUGpAV2ln1GOY/uh51aczjcRz9k2L2bPx/Xja3c5pSGJJPyR25GNVRXtKIExScdAgFdiXp68GmJA==", + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/redux-mock-store/-/redux-mock-store-1.5.4.tgz", + "integrity": "sha512-xmcA0O/tjCLXhh9Fuiq6pMrJCwFRaouA8436zcikdIpYWWCjU76CRk+i2bHx8EeiSiMGnB85/lZdU3wIJVXHTA==", "dev": true, "requires": { "lodash.isplainobject": "^4.0.6" @@ -16257,15 +16190,15 @@ } }, "scratch-gui": { - "version": "0.1.0-prerelease.20200506225657", - "resolved": "https://registry.npmjs.org/scratch-gui/-/scratch-gui-0.1.0-prerelease.20200506225657.tgz", - "integrity": "sha512-MhDIsvdMw8See61hf355CATKMO4v1y8vt3DNBjRj0of0pXF8PyagaF2+m2vMwe1/PvJkNhXmRkWbb+RwArKuyQ==", + "version": "0.1.0-prerelease.20200513040928", + "resolved": "https://registry.npmjs.org/scratch-gui/-/scratch-gui-0.1.0-prerelease.20200513040928.tgz", + "integrity": "sha512-IUGYqOntEPG8m2cj07mfifSzXVkLbPHadFbEeJk4AjW/6jqO5UufB3rTHU0j9fw3xr/DUqs5o9Ugpe2MThVo+A==", "dev": true }, "scratch-l10n": { - "version": "3.8.20200505213509", - "resolved": "https://registry.npmjs.org/scratch-l10n/-/scratch-l10n-3.8.20200505213509.tgz", - "integrity": "sha512-Vh4UQFlNuTcDgSySsR/wYzQ842IEEE8nrpqybKxd+LDVUw0fDOGFQ2aKyE8GyUWBnyDsnWQTmozU9yTmYfwKBw==", + "version": "3.9.20200512220101", + "resolved": "https://registry.npmjs.org/scratch-l10n/-/scratch-l10n-3.9.20200512220101.tgz", + "integrity": "sha512-CAUCdtecNvTIUfcUqp2OEg+pEETVvttHwObnmmV1WPXYjpubI9kHU5wHfmHSeiVj2LduoILrdHOafU1l/KAw0g==", "dev": true, "requires": { "@babel/cli": "^7.1.2", @@ -18265,8 +18198,7 @@ "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "dev": true + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, "typedarray-to-buffer": { "version": "3.1.5", diff --git a/package.json b/package.json index fafc459c0..056db4140 100644 --- a/package.json +++ b/package.json @@ -128,7 +128,7 @@ "redux-mock-store": "^1.2.3", "redux-thunk": "2.0.1", "sass-loader": "6.0.6", - "scratch-gui": "0.1.0-prerelease.20200506225657", + "scratch-gui": "0.1.0-prerelease.20200513040928", "scratch-l10n": "latest", "selenium-webdriver": "3.6.0", "slick-carousel": "1.6.0", diff --git a/src/components/registration/steps.jsx b/src/components/registration/steps.jsx index 42bdb2db4..113777ef9 100644 --- a/src/components/registration/steps.jsx +++ b/src/components/registration/steps.jsx @@ -453,7 +453,7 @@ class DemographicsStep extends React.Component { handleChooseGender (name, gender) { this.setState({otherDisabled: gender !== 'other'}); } - // look up country name using user's country code selection + // look up country name using user's country code selection ('us' -> 'United States') getCountryName (values) { if (values.countryCode) { const countryInfo = countryData.lookupCountryInfo(values.countryCode); @@ -463,6 +463,12 @@ class DemographicsStep extends React.Component { } return null; } + // look up country code from country label ('United States' -> 'us') + // if `countryName` is not found, including if it's null or undefined, then this function will return undefined. + getCountryCode (countryName) { + const country = countryData.countryInfo.find(countryItem => countryItem.name === countryName); + return country && country.code; + } handleValidSubmit (formData) { const countryName = this.getCountryName(formData); if (countryName && formData.user) { @@ -573,7 +579,7 @@ class DemographicsStep extends React.Component { validations={{ countryVal: values => this.countryValidator(values) }} - value={countryOptions[0].value} + value={this.getCountryCode(this.props.countryName) || countryOptions[0].value} /> - {!CONTACT_US_POPUP && ( -
-
- -

+

+
+ +

+ +

+

+ )}} + />

+

+ +

+

+

+
    +
  • )}} - />

    -

    -
      -
    • - )}} - />
    • -
    • - )}} - />
    • -
    • - )}} - />
    • -
    + />
  • +
  • + )}} + />
  • +
  • + )}} + />
  • +
+

+ +

+ {this.state.showForm ? (

-
-
- )} - {CONTACT_US_POPUP && ( -
-
- -

- -

-

- )}} - />

-

- -

-

-

-
    -
  • - )}} - />
  • -
  • - )}} - />
  • -
  • - )}} - />
  • -
-

- -

+ ) : (

-
+ )} +
+ {!this.state.showForm && ( -
- )} + )} + - {!CONTACT_US_POPUP && ( + {this.state.showForm && (