From 75d0365a5adadaa480e592273a441197c6419a28 Mon Sep 17 00:00:00 2001 From: Reid Kuttler Date: Wed, 26 Sep 2018 15:41:48 -0700 Subject: [PATCH 1/4] feat(warranties in react): initial push --- .angular-cli.json | 62 - .editorconfig | 13 - .env.build | 2 + .gitignore | 47 +- .travis.yml | 88 - README.md | 2487 ++- e2e/app.e2e-spec.ts | 14 - e2e/app.po.ts | 11 - e2e/tsconfig.e2e.json | 14 - karma.conf.js | 33 - package-lock.json | 17019 ++++++++-------- package.json | 97 +- protractor.conf.js | 28 - public/favicon.ico | Bin 0 -> 3870 bytes public/index.html | 40 + public/manifest.json | 15 + src/App.css | 28 + src/App.js | 14 + src/App.test.js | 9 + src/app/additional/additional.component.html | 121 - .../additional/additional.component.spec.ts | 27 - src/app/additional/additional.component.ts | 174 - src/app/app.component.css | 0 src/app/app.component.html | 22 - src/app/app.component.spec.ts | 52 - src/app/app.component.ts | 49 - src/app/app.module.ts | 74 - src/app/config/app-config.module.ts | 22 - src/app/config/index.ts | 2 - src/app/config/models/app-config.interface.ts | 8 - src/app/config/models/index.ts | 1 - .../country-select.component.css | 0 .../country-select.component.html | 30 - .../country-select.component.spec.ts | 31 - .../country-select.component.ts | 25 - .../serial-modal.component.css | 0 .../serial-modal.component.html | 16 - .../serial-modal.component.spec.ts | 43 - .../serial-modal.component.ts | 20 - src/app/models/address.interface.ts | 10 - src/app/models/contact.interface.ts | 4 - src/app/models/country.interface.ts | 4 - src/app/models/date.interface.ts | 10 - src/app/models/index.ts | 7 - src/app/models/personal.interface.ts | 14 - src/app/models/purchase.interface.ts | 7 - src/app/models/retailer.interface.ts | 4 - src/app/models/serial.interface.ts | 4 - src/app/models/state.interface.ts | 7 - src/app/models/warranties.command.ts | 51 - src/app/personal/personal.component.css | 0 src/app/personal/personal.component.html | 246 - src/app/personal/personal.component.spec.ts | 69 - src/app/personal/personal.component.ts | 177 - src/app/product/product.component.css | 0 src/app/product/product.component.html | 193 - src/app/product/product.component.spec.ts | 27 - src/app/product/product.component.ts | 170 - src/app/services/country.service.spec.ts | 55 - src/app/services/country.service.ts | 17 - src/app/services/get-asset.service.spec.ts | 35 - src/app/services/get-asset.service.ts | 17 - .../services/image-resizer.service.spec.ts | 15 - src/app/services/image-resizer.service.ts | 20 - src/app/services/index.ts | 6 - src/app/services/retailer.service.spec.ts | 55 - src/app/services/retailer.service.ts | 17 - src/app/services/store.service.spec.ts | 15 - src/app/services/store.service.ts | 53 - src/app/services/warranties.service.spec.ts | 31 - src/app/services/warranties.service.ts | 14 - src/app/services/window.service.spec.ts | 15 - src/app/services/window.service.ts | 13 - .../state-tracker/state-tracker.component.css | 6 - .../state-tracker.component.html | 175 - .../state-tracker.component.spec.ts | 27 - .../state-tracker/state-tracker.component.ts | 33 - src/app/validators/captcha.validator.ts | 9 - src/app/validators/has-states.validator.ts | 22 - src/app/validators/index.ts | 3 - .../validators/other-purchase.validator.ts | 12 - src/assets/.gitkeep | 0 src/assets/i18n/de.json | 51 - src/assets/i18n/en.json | 68 - src/assets/i18n/fr-ca.json | 51 - src/assets/i18n/it.json | 51 - src/assets/i18n/jpn.json | 51 - src/assets/i18n/ko.json | 51 - src/assets/i18n/spa.json | 51 - src/assets/i18n/zh-tw.json | 51 - src/assets/i18n/zh.json | 51 - src/assets/img/Ajax-loader.gif | Bin 3208 -> 0 bytes src/assets/img/Loading_icon.gif | Bin 17490 -> 0 bytes src/assets/img/flags/ca.png | Bin 628 -> 0 bytes src/assets/img/flags/ca.png.1 | Bin 628 -> 0 bytes src/assets/img/flags/de.png | Bin 545 -> 0 bytes src/assets/img/flags/en.png | Bin 609 -> 0 bytes src/assets/img/flags/es.png | Bin 469 -> 0 bytes src/assets/img/flags/it.png | Bin 420 -> 0 bytes src/assets/img/flags/ja.png | Bin 420 -> 0 bytes src/assets/img/flags/ko.png | Bin 592 -> 0 bytes src/assets/img/flags/tw.png | Bin 465 -> 0 bytes src/assets/img/flags/zh.png | Bin 472 -> 0 bytes src/components/Backdrop/backdrop.jsx | 7 + src/components/Backdrop/backdrop.test.jsx | 30 + .../Form/Form.css} | 0 src/components/Form/Form.jsx | 351 + src/components/Form/Form.test.jsx | 105 + src/components/PopUp/popup.jsx | 27 + src/components/PopUp/popup.test.jsx | 27 + src/components/Recaptcha/recaptcha.jsx | 17 + src/components/Recaptcha/recaptcha.test.jsx | 20 + src/components/SuccessPage/successPage.jsx | 265 + .../SuccessPage/successPage.test.jsx | 24 + src/components/UI/Button/Button.css | 29 + src/components/UI/Button/Button.jsx | 12 + src/components/UI/Input/Input.jsx | 74 + src/components/UI/Input/input.test.jsx | 57 + src/components/UI/Spinner/Spinner.css | 67 + src/components/UI/Spinner/Spinner.jsx | 9 + src/components/UI/Spinner/Spinner.test.jsx | 23 + src/components/UI/States/States.jsx | 1 + src/components/selectCountry/countries.jsx | 35 + .../selectCountry/countries.test.jsx | 30 + .../selectCountry/country/country.jsx | 11 + .../selectCountry/country/country.test.jsx | 20 + src/containers/Registration/Registration.css | 28 + src/containers/Registration/Registration.jsx | 73 + .../Registration/Registration.test.jsx | 74 + src/enum/info-files.jsx | 8 + src/enum/orderForm.jsx | 261 + src/environments/environment.develop.ts | 14 - src/environments/environment.prod.ts | 14 - src/environments/environment.stage.ts | 14 - src/environments/environment.ts | 14 - src/favicon.ico | Bin 5430 -> 0 bytes src/hoc/Aux/Aux.jsx | 3 + src/hoc/Aux/Aux.test.jsx | 19 + src/index.css | 5 + src/index.html | 12 - src/index.js | 8 + src/main.ts | 15 - src/polyfills.ts | 60 - src/registerServiceWorker.js | 117 + src/styles.css | 1169 -- src/test.ts | 36 - src/tsconfig.app.json | 13 - src/tsconfig.spec.json | 20 - src/typings.d.ts | 5 - tsconfig.json | 19 - tslint.json | 12 - yarn.lock | 6112 +++--- 152 files changed, 15491 insertions(+), 16758 deletions(-) delete mode 100644 .angular-cli.json delete mode 100644 .editorconfig create mode 100644 .env.build delete mode 100644 .travis.yml delete mode 100644 e2e/app.e2e-spec.ts delete mode 100644 e2e/app.po.ts delete mode 100644 e2e/tsconfig.e2e.json delete mode 100644 karma.conf.js delete mode 100644 protractor.conf.js create mode 100644 public/favicon.ico create mode 100644 public/index.html create mode 100644 public/manifest.json create mode 100644 src/App.css create mode 100644 src/App.js create mode 100644 src/App.test.js delete mode 100644 src/app/additional/additional.component.html delete mode 100644 src/app/additional/additional.component.spec.ts delete mode 100644 src/app/additional/additional.component.ts delete mode 100644 src/app/app.component.css delete mode 100644 src/app/app.component.html delete mode 100644 src/app/app.component.spec.ts delete mode 100644 src/app/app.component.ts delete mode 100644 src/app/app.module.ts delete mode 100644 src/app/config/app-config.module.ts delete mode 100644 src/app/config/index.ts delete mode 100644 src/app/config/models/app-config.interface.ts delete mode 100644 src/app/config/models/index.ts delete mode 100644 src/app/directives/country-select/country-select.component.css delete mode 100644 src/app/directives/country-select/country-select.component.html delete mode 100644 src/app/directives/country-select/country-select.component.spec.ts delete mode 100644 src/app/directives/country-select/country-select.component.ts delete mode 100644 src/app/directives/serial-modal.component/serial-modal.component.css delete mode 100644 src/app/directives/serial-modal.component/serial-modal.component.html delete mode 100644 src/app/directives/serial-modal.component/serial-modal.component.spec.ts delete mode 100644 src/app/directives/serial-modal.component/serial-modal.component.ts delete mode 100644 src/app/models/address.interface.ts delete mode 100644 src/app/models/contact.interface.ts delete mode 100644 src/app/models/country.interface.ts delete mode 100644 src/app/models/date.interface.ts delete mode 100644 src/app/models/index.ts delete mode 100644 src/app/models/personal.interface.ts delete mode 100644 src/app/models/purchase.interface.ts delete mode 100644 src/app/models/retailer.interface.ts delete mode 100644 src/app/models/serial.interface.ts delete mode 100644 src/app/models/state.interface.ts delete mode 100644 src/app/models/warranties.command.ts delete mode 100644 src/app/personal/personal.component.css delete mode 100644 src/app/personal/personal.component.html delete mode 100644 src/app/personal/personal.component.spec.ts delete mode 100644 src/app/personal/personal.component.ts delete mode 100644 src/app/product/product.component.css delete mode 100644 src/app/product/product.component.html delete mode 100644 src/app/product/product.component.spec.ts delete mode 100644 src/app/product/product.component.ts delete mode 100644 src/app/services/country.service.spec.ts delete mode 100644 src/app/services/country.service.ts delete mode 100644 src/app/services/get-asset.service.spec.ts delete mode 100644 src/app/services/get-asset.service.ts delete mode 100644 src/app/services/image-resizer.service.spec.ts delete mode 100644 src/app/services/image-resizer.service.ts delete mode 100644 src/app/services/index.ts delete mode 100644 src/app/services/retailer.service.spec.ts delete mode 100644 src/app/services/retailer.service.ts delete mode 100644 src/app/services/store.service.spec.ts delete mode 100644 src/app/services/store.service.ts delete mode 100644 src/app/services/warranties.service.spec.ts delete mode 100644 src/app/services/warranties.service.ts delete mode 100644 src/app/services/window.service.spec.ts delete mode 100644 src/app/services/window.service.ts delete mode 100644 src/app/state-tracker/state-tracker.component.css delete mode 100644 src/app/state-tracker/state-tracker.component.html delete mode 100644 src/app/state-tracker/state-tracker.component.spec.ts delete mode 100644 src/app/state-tracker/state-tracker.component.ts delete mode 100644 src/app/validators/captcha.validator.ts delete mode 100644 src/app/validators/has-states.validator.ts delete mode 100644 src/app/validators/index.ts delete mode 100644 src/app/validators/other-purchase.validator.ts delete mode 100644 src/assets/.gitkeep delete mode 100644 src/assets/i18n/de.json delete mode 100644 src/assets/i18n/en.json delete mode 100644 src/assets/i18n/fr-ca.json delete mode 100644 src/assets/i18n/it.json delete mode 100644 src/assets/i18n/jpn.json delete mode 100644 src/assets/i18n/ko.json delete mode 100644 src/assets/i18n/spa.json delete mode 100644 src/assets/i18n/zh-tw.json delete mode 100644 src/assets/i18n/zh.json delete mode 100644 src/assets/img/Ajax-loader.gif delete mode 100644 src/assets/img/Loading_icon.gif delete mode 100644 src/assets/img/flags/ca.png delete mode 100644 src/assets/img/flags/ca.png.1 delete mode 100644 src/assets/img/flags/de.png delete mode 100644 src/assets/img/flags/en.png delete mode 100644 src/assets/img/flags/es.png delete mode 100644 src/assets/img/flags/it.png delete mode 100644 src/assets/img/flags/ja.png delete mode 100644 src/assets/img/flags/ko.png delete mode 100644 src/assets/img/flags/tw.png delete mode 100644 src/assets/img/flags/zh.png create mode 100644 src/components/Backdrop/backdrop.jsx create mode 100644 src/components/Backdrop/backdrop.test.jsx rename src/{app/additional/additional.component.css => components/Form/Form.css} (100%) create mode 100644 src/components/Form/Form.jsx create mode 100644 src/components/Form/Form.test.jsx create mode 100644 src/components/PopUp/popup.jsx create mode 100644 src/components/PopUp/popup.test.jsx create mode 100644 src/components/Recaptcha/recaptcha.jsx create mode 100644 src/components/Recaptcha/recaptcha.test.jsx create mode 100644 src/components/SuccessPage/successPage.jsx create mode 100644 src/components/SuccessPage/successPage.test.jsx create mode 100644 src/components/UI/Button/Button.css create mode 100644 src/components/UI/Button/Button.jsx create mode 100644 src/components/UI/Input/Input.jsx create mode 100644 src/components/UI/Input/input.test.jsx create mode 100644 src/components/UI/Spinner/Spinner.css create mode 100644 src/components/UI/Spinner/Spinner.jsx create mode 100644 src/components/UI/Spinner/Spinner.test.jsx create mode 100644 src/components/UI/States/States.jsx create mode 100644 src/components/selectCountry/countries.jsx create mode 100644 src/components/selectCountry/countries.test.jsx create mode 100644 src/components/selectCountry/country/country.jsx create mode 100644 src/components/selectCountry/country/country.test.jsx create mode 100644 src/containers/Registration/Registration.css create mode 100644 src/containers/Registration/Registration.jsx create mode 100644 src/containers/Registration/Registration.test.jsx create mode 100644 src/enum/info-files.jsx create mode 100644 src/enum/orderForm.jsx delete mode 100644 src/environments/environment.develop.ts delete mode 100644 src/environments/environment.prod.ts delete mode 100644 src/environments/environment.stage.ts delete mode 100644 src/environments/environment.ts delete mode 100644 src/favicon.ico create mode 100644 src/hoc/Aux/Aux.jsx create mode 100644 src/hoc/Aux/Aux.test.jsx create mode 100644 src/index.css delete mode 100644 src/index.html create mode 100644 src/index.js delete mode 100644 src/main.ts delete mode 100644 src/polyfills.ts create mode 100644 src/registerServiceWorker.js delete mode 100644 src/styles.css delete mode 100644 src/test.ts delete mode 100644 src/tsconfig.app.json delete mode 100644 src/tsconfig.spec.json delete mode 100644 src/typings.d.ts delete mode 100644 tsconfig.json delete mode 100644 tslint.json diff --git a/.angular-cli.json b/.angular-cli.json deleted file mode 100644 index db98b07..0000000 --- a/.angular-cli.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "$schema": "./node_modules/@angular/cli/lib/config/schema.json", - "project": { - "name": "warranties" - }, - "apps": [ - { - "root": "src", - "outDir": "dist", - "assets": [ - "assets", - "favicon.ico" - ], - "index": "index.html", - "main": "main.ts", - "polyfills": "polyfills.ts", - "test": "test.ts", - "tsconfig": "tsconfig.app.json", - "testTsconfig": "tsconfig.spec.json", - "prefix": "app", - "styles": [ - "styles.css" - ], - "scripts": [], - "environmentSource": "environments/environment.ts", - "environments": { - "dev": "environments/environment.ts", - "prod": "environments/environment.prod.ts", - "develop": "environments/environment.develop.ts", - "stage": "environments/environment.stage.ts" - } - } - ], - "e2e": { - "protractor": { - "config": "./protractor.conf.js" - } - }, - "lint": [ - { - "project": "src/tsconfig.app.json", - "exclude": "**/node_modules/**" - }, - { - "project": "src/tsconfig.spec.json", - "exclude": "**/node_modules/**" - }, - { - "project": "e2e/tsconfig.e2e.json", - "exclude": "**/node_modules/**" - } - ], - "test": { - "karma": { - "config": "./karma.conf.js" - } - }, - "defaults": { - "styleExt": "css", - "component": {} - } -} diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 6e87a00..0000000 --- a/.editorconfig +++ /dev/null @@ -1,13 +0,0 @@ -# Editor configuration, see http://editorconfig.org -root = true - -[*] -charset = utf-8 -indent_style = space -indent_size = 2 -insert_final_newline = true -trim_trailing_whitespace = true - -[*.md] -max_line_length = off -trim_trailing_whitespace = false diff --git a/.env.build b/.env.build new file mode 100644 index 0000000..a8176a6 --- /dev/null +++ b/.env.build @@ -0,0 +1,2 @@ +REACT_APP_DEALERURL=https://transit.blendtec.com/ +REACT_APP_INFOURL=https://s3-us-west-1.amazonaws.com/data.blendtec.com/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 54bfd20..d30f40e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,42 +1,21 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. - -# compiled output -/dist -/tmp -/out-tsc +# See https://help.github.com/ignore-files/ for more about ignoring files. # dependencies /node_modules -# IDEs and editors -/.idea -.project -.classpath -.c9/ -*.launch -.settings/ -*.sublime-workspace - -# IDE - VSCode -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - -# misc -/.sass-cache -/connect.lock +# testing /coverage -/libpeerconnection.log -npm-debug.log -testem.log -/typings -# e2e -/e2e/*.js -/e2e/*.map +# production +/build -# System Files +# misc .DS_Store -Thumbs.db +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7ec6637..0000000 --- a/.travis.yml +++ /dev/null @@ -1,88 +0,0 @@ -sudo: required -dist: trusty -git: - depth: 1 -language: node_js -node_js: -- '6' -cache: - directories: - - node_modules -addons: - apt: - sources: - - google-chrome - packages: - - google-chrome-stable -matrix: - fast_finish: true -install: -- yarn -before_script: -- export DBUS_SESSION_BUS_ADDRESS=/dev/null -- export DISPLAY=:99.0 -- sh -e /etc/init.d/xvfb start -script: -- yarn test:ci -- echo $TRAVIS_BRANCH -- if [ $TRAVIS_BRANCH = 'master' ]; then npm run env && ng build --aot --prod --base-href /pages/$APP_NAME --deploy-url $S3_REGION/$S3_BUCKET/$APP_NAME/; fi -- if [ $TRAVIS_BRANCH = 'stage' ]; then npm run env && ng build --aot --environment=stage --base-href /pages/$APP_NAME --deploy-url $S3_REGION/$S3_STAGE_BUCKET/$APP_NAME/; fi -- if [ $TRAVIS_BRANCH = 'develop' ]; then npm run env && ng build --aot --environment=develop --base-href /pages/$APP_NAME --deploy-url $S3_REGION/$S3_DEV_BUCKET/$APP_NAME/; fi -after_success: -- "./node_modules/.bin/codecov" -notifications: - slack: blendtec:a5Z5i4z3iuWbHHDdlMRSMkiB -deploy: -- provider: s3 - region: us-west-1 - access_key_id: $AMAZON_ACCESS_KEY_ID - secret_access_key: - secure: $AMAZON_SECRET_ACCESS_KEY - bucket: $S3_BUCKET - local-dir: dist - upload-dir: $APP_NAME - skip_cleanup: true - acl: public_read - on: - branch: master -- provider: script - skip_cleanup: true - script: node ./.travis/shopify.js $SHOPIFY_SHOP $SHOPIFY_API_KEY $SHOPIFY_API_PASSWORD $SHOPIFY_PAGE_ID - on: - branch: master - -- provider: s3 - region: us-west-1 - access_key_id: $AMAZON_ACCESS_KEY_ID - secret_access_key: - secure: $AMAZON_SECRET_ACCESS_KEY - bucket: $S3_STAGE_BUCKET - local-dir: dist - upload-dir: $APP_NAME - skip_cleanup: true - acl: public_read - on: - branch: stage -- provider: script - skip_cleanup: true - script: node ./.travis/shopify.js $SHOPIFY_STAGE_SHOP $SHOPIFY_STAGE_API_KEY $SHOPIFY_STAGE_API_PASSWORD $SHOPIFY_STAGE_PAGE_ID - on: - branch: stage - -- provider: s3 - region: us-west-1 - access_key_id: $AMAZON_ACCESS_KEY_ID - secret_access_key: - secure: $AMAZON_SECRET_ACCESS_KEY - bucket: $S3_DEV_BUCKET - local-dir: dist - upload-dir: $APP_NAME - skip_cleanup: true - acl: public_read - on: - branch: develop -- provider: script - skip_cleanup: true - script: node ./.travis/shopify.js $SHOPIFY_DEV_SHOP $SHOPIFY_DEV_API_KEY $SHOPIFY_DEV_API_PASSWORD $SHOPIFY_DEV_PAGE_ID - on: - branch: develop diff --git a/README.md b/README.md index 1e773f0..5bbfc5f 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,2486 @@ -# Warranties +This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app). -This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.6.1. +Below you will find some information on how to perform common tasks.
+You can find the most recent version of this guide [here](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md). -## Development server +## Table of Contents -Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. +- [Updating to New Releases](#updating-to-new-releases) +- [Sending Feedback](#sending-feedback) +- [Folder Structure](#folder-structure) +- [Available Scripts](#available-scripts) + - [npm start](#npm-start) + - [npm test](#npm-test) + - [npm run build](#npm-run-build) + - [npm run eject](#npm-run-eject) +- [Supported Browsers](#supported-browsers) +- [Supported Language Features and Polyfills](#supported-language-features-and-polyfills) +- [Syntax Highlighting in the Editor](#syntax-highlighting-in-the-editor) +- [Displaying Lint Output in the Editor](#displaying-lint-output-in-the-editor) +- [Debugging in the Editor](#debugging-in-the-editor) +- [Formatting Code Automatically](#formatting-code-automatically) +- [Changing the Page ``](#changing-the-page-title) +- [Installing a Dependency](#installing-a-dependency) +- [Importing a Component](#importing-a-component) +- [Code Splitting](#code-splitting) +- [Adding a Stylesheet](#adding-a-stylesheet) +- [Post-Processing CSS](#post-processing-css) +- [Adding a CSS Preprocessor (Sass, Less etc.)](#adding-a-css-preprocessor-sass-less-etc) +- [Adding Images, Fonts, and Files](#adding-images-fonts-and-files) +- [Using the `public` Folder](#using-the-public-folder) + - [Changing the HTML](#changing-the-html) + - [Adding Assets Outside of the Module System](#adding-assets-outside-of-the-module-system) + - [When to Use the `public` Folder](#when-to-use-the-public-folder) +- [Using Global Variables](#using-global-variables) +- [Adding Bootstrap](#adding-bootstrap) + - [Using a Custom Theme](#using-a-custom-theme) +- [Adding Flow](#adding-flow) +- [Adding a Router](#adding-a-router) +- [Adding Custom Environment Variables](#adding-custom-environment-variables) + - [Referencing Environment Variables in the HTML](#referencing-environment-variables-in-the-html) + - [Adding Temporary Environment Variables In Your Shell](#adding-temporary-environment-variables-in-your-shell) + - [Adding Development Environment Variables In `.env`](#adding-development-environment-variables-in-env) +- [Can I Use Decorators?](#can-i-use-decorators) +- [Fetching Data with AJAX Requests](#fetching-data-with-ajax-requests) +- [Integrating with an API Backend](#integrating-with-an-api-backend) + - [Node](#node) + - [Ruby on Rails](#ruby-on-rails) +- [Proxying API Requests in Development](#proxying-api-requests-in-development) + - ["Invalid Host Header" Errors After Configuring Proxy](#invalid-host-header-errors-after-configuring-proxy) + - [Configuring the Proxy Manually](#configuring-the-proxy-manually) + - [Configuring a WebSocket Proxy](#configuring-a-websocket-proxy) +- [Using HTTPS in Development](#using-https-in-development) +- [Generating Dynamic `<meta>` Tags on the Server](#generating-dynamic-meta-tags-on-the-server) +- [Pre-Rendering into Static HTML Files](#pre-rendering-into-static-html-files) +- [Injecting Data from the Server into the Page](#injecting-data-from-the-server-into-the-page) +- [Running Tests](#running-tests) + - [Filename Conventions](#filename-conventions) + - [Command Line Interface](#command-line-interface) + - [Version Control Integration](#version-control-integration) + - [Writing Tests](#writing-tests) + - [Testing Components](#testing-components) + - [Using Third Party Assertion Libraries](#using-third-party-assertion-libraries) + - [Initializing Test Environment](#initializing-test-environment) + - [Focusing and Excluding Tests](#focusing-and-excluding-tests) + - [Coverage Reporting](#coverage-reporting) + - [Continuous Integration](#continuous-integration) + - [Disabling jsdom](#disabling-jsdom) + - [Snapshot Testing](#snapshot-testing) + - [Editor Integration](#editor-integration) +- [Debugging Tests](#debugging-tests) + - [Debugging Tests in Chrome](#debugging-tests-in-chrome) + - [Debugging Tests in Visual Studio Code](#debugging-tests-in-visual-studio-code) +- [Developing Components in Isolation](#developing-components-in-isolation) + - [Getting Started with Storybook](#getting-started-with-storybook) + - [Getting Started with Styleguidist](#getting-started-with-styleguidist) +- [Publishing Components to npm](#publishing-components-to-npm) +- [Making a Progressive Web App](#making-a-progressive-web-app) + - [Opting Out of Caching](#opting-out-of-caching) + - [Offline-First Considerations](#offline-first-considerations) + - [Progressive Web App Metadata](#progressive-web-app-metadata) +- [Analyzing the Bundle Size](#analyzing-the-bundle-size) +- [Deployment](#deployment) + - [Static Server](#static-server) + - [Other Solutions](#other-solutions) + - [Serving Apps with Client-Side Routing](#serving-apps-with-client-side-routing) + - [Building for Relative Paths](#building-for-relative-paths) + - [Azure](#azure) + - [Firebase](#firebase) + - [GitHub Pages](#github-pages) + - [Heroku](#heroku) + - [Netlify](#netlify) + - [Now](#now) + - [S3 and CloudFront](#s3-and-cloudfront) + - [Surge](#surge) +- [Advanced Configuration](#advanced-configuration) +- [Troubleshooting](#troubleshooting) + - [`npm start` doesn’t detect changes](#npm-start-doesnt-detect-changes) + - [`npm test` hangs on macOS Sierra](#npm-test-hangs-on-macos-sierra) + - [`npm run build` exits too early](#npm-run-build-exits-too-early) + - [`npm run build` fails on Heroku](#npm-run-build-fails-on-heroku) + - [`npm run build` fails to minify](#npm-run-build-fails-to-minify) + - [Moment.js locales are missing](#momentjs-locales-are-missing) +- [Alternatives to Ejecting](#alternatives-to-ejecting) +- [Something Missing?](#something-missing) -## Code scaffolding +## Updating to New Releases -Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. +Create React App is divided into two packages: -## Build +* `create-react-app` is a global command-line utility that you use to create new projects. +* `react-scripts` is a development dependency in the generated projects (including this one). -Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build. +You almost never need to update `create-react-app` itself: it delegates all the setup to `react-scripts`. -## Running unit tests +When you run `create-react-app`, it always creates the project with the latest version of `react-scripts` so you’ll get all the new features and improvements in newly created apps automatically. -Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). +To update an existing project to a new version of `react-scripts`, [open the changelog](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md), find the version you’re currently on (check `package.json` in this folder if you’re not sure), and apply the migration instructions for the newer versions. -## Running end-to-end tests +In most cases bumping the `react-scripts` version in `package.json` and running `npm install` in this folder should be enough, but it’s good to consult the [changelog](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md) for potential breaking changes. -Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). +We commit to keeping the breaking changes minimal so you can upgrade `react-scripts` painlessly. -## Further help +## Sending Feedback -To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). +We are always open to [your feedback](https://github.com/facebookincubator/create-react-app/issues). + +## Folder Structure + +After creation, your project should look like this: + +``` +my-app/ + README.md + node_modules/ + package.json + public/ + index.html + favicon.ico + src/ + App.css + App.js + App.test.js + index.css + index.js + logo.svg +``` + +For the project to build, **these files must exist with exact filenames**: + +* `public/index.html` is the page template; +* `src/index.js` is the JavaScript entry point. + +You can delete or rename the other files. + +You may create subdirectories inside `src`. For faster rebuilds, only files inside `src` are processed by Webpack.<br> +You need to **put any JS and CSS files inside `src`**, otherwise Webpack won’t see them. + +Only files inside `public` can be used from `public/index.html`.<br> +Read instructions below for using assets from JavaScript and HTML. + +You can, however, create more top-level directories.<br> +They will not be included in the production build so you can use them for things like documentation. + +## Available Scripts + +In the project directory, you can run: + +### `npm start` + +Runs the app in the development mode.<br> +Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.<br> +You will also see any lint errors in the console. + +### `npm test` + +Launches the test runner in the interactive watch mode.<br> +See the section about [running tests](#running-tests) for more information. + +### `npm run build` + +Builds the app for production to the `build` folder.<br> +It correctly bundles React in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.<br> +Your app is ready to be deployed! + +See the section about [deployment](#deployment) for more information. + +### `npm run eject` + +**Note: this is a one-way operation. Once you `eject`, you can’t go back!** + +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. + +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. + +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. + +## Supported Browsers + +By default, the generated project uses the latest version of React. + +You can refer [to the React documentation](https://reactjs.org/docs/react-dom.html#browser-support) for more information about supported browsers. + +## Supported Language Features and Polyfills + +This project supports a superset of the latest JavaScript standard.<br> +In addition to [ES6](https://github.com/lukehoban/es6features) syntax features, it also supports: + +* [Exponentiation Operator](https://github.com/rwaldron/exponentiation-operator) (ES2016). +* [Async/await](https://github.com/tc39/ecmascript-asyncawait) (ES2017). +* [Object Rest/Spread Properties](https://github.com/sebmarkbage/ecmascript-rest-spread) (stage 3 proposal). +* [Dynamic import()](https://github.com/tc39/proposal-dynamic-import) (stage 3 proposal) +* [Class Fields and Static Properties](https://github.com/tc39/proposal-class-public-fields) (part of stage 3 proposal). +* [JSX](https://facebook.github.io/react/docs/introducing-jsx.html) and [Flow](https://flowtype.org/) syntax. + +Learn more about [different proposal stages](https://babeljs.io/docs/plugins/#presets-stage-x-experimental-presets-). + +While we recommend using experimental proposals with some caution, Facebook heavily uses these features in the product code, so we intend to provide [codemods](https://medium.com/@cpojer/effective-javascript-codemods-5a6686bb46fb) if any of these proposals change in the future. + +Note that **the project only includes a few ES6 [polyfills](https://en.wikipedia.org/wiki/Polyfill)**: + +* [`Object.assign()`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) via [`object-assign`](https://github.com/sindresorhus/object-assign). +* [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) via [`promise`](https://github.com/then/promise). +* [`fetch()`](https://developer.mozilla.org/en/docs/Web/API/Fetch_API) via [`whatwg-fetch`](https://github.com/github/fetch). + +If you use any other ES6+ features that need **runtime support** (such as `Array.from()` or `Symbol`), make sure you are including the appropriate polyfills manually, or that the browsers you are targeting already support them. + +Also note that using some newer syntax features like `for...of` or `[...nonArrayValue]` causes Babel to emit code that depends on ES6 runtime features and might not work without a polyfill. When in doubt, use [Babel REPL](https://babeljs.io/repl/) to see what any specific syntax compiles down to. + +## Syntax Highlighting in the Editor + +To configure the syntax highlighting in your favorite text editor, head to the [relevant Babel documentation page](https://babeljs.io/docs/editors) and follow the instructions. Some of the most popular editors are covered. + +## Displaying Lint Output in the Editor + +>Note: this feature is available with `react-scripts@0.2.0` and higher.<br> +>It also only works with npm 3 or higher. + +Some editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint. + +They are not required for linting. You should see the linter output right in your terminal as well as the browser console. However, if you prefer the lint results to appear right in your editor, there are some extra steps you can do. + +You would need to install an ESLint plugin for your editor first. Then, add a file called `.eslintrc` to the project root: + +```js +{ + "extends": "react-app" +} +``` + +Now your editor should report the linting warnings. + +Note that even if you edit your `.eslintrc` file further, these changes will **only affect the editor integration**. They won’t affect the terminal and in-browser lint output. This is because Create React App intentionally provides a minimal set of rules that find common mistakes. + +If you want to enforce a coding style for your project, consider using [Prettier](https://github.com/jlongster/prettier) instead of ESLint style rules. + +## Debugging in the Editor + +**This feature is currently only supported by [Visual Studio Code](https://code.visualstudio.com) and [WebStorm](https://www.jetbrains.com/webstorm/).** + +Visual Studio Code and WebStorm support debugging out of the box with Create React App. This enables you as a developer to write and debug your React code without leaving the editor, and most importantly it enables you to have a continuous development workflow, where context switching is minimal, as you don’t have to switch between tools. + +### Visual Studio Code + +You would need to have the latest version of [VS Code](https://code.visualstudio.com) and VS Code [Chrome Debugger Extension](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome) installed. + +Then add the block below to your `launch.json` file and put it inside the `.vscode` folder in your app’s root directory. + +```json +{ + "version": "0.2.0", + "configurations": [{ + "name": "Chrome", + "type": "chrome", + "request": "launch", + "url": "http://localhost:3000", + "webRoot": "${workspaceRoot}/src", + "sourceMapPathOverrides": { + "webpack:///src/*": "${webRoot}/*" + } + }] +} +``` +>Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](#advanced-configuration). + +Start your app by running `npm start`, and start debugging in VS Code by pressing `F5` or by clicking the green debug icon. You can now write code, set breakpoints, make changes to the code, and debug your newly modified code—all from your editor. + +Having problems with VS Code Debugging? Please see their [troubleshooting guide](https://github.com/Microsoft/vscode-chrome-debug/blob/master/README.md#troubleshooting). + +### WebStorm + +You would need to have [WebStorm](https://www.jetbrains.com/webstorm/) and [JetBrains IDE Support](https://chrome.google.com/webstore/detail/jetbrains-ide-support/hmhgeddbohgjknpmjagkdomcpobmllji) Chrome extension installed. + +In the WebStorm menu `Run` select `Edit Configurations...`. Then click `+` and select `JavaScript Debug`. Paste `http://localhost:3000` into the URL field and save the configuration. + +>Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](#advanced-configuration). + +Start your app by running `npm start`, then press `^D` on macOS or `F9` on Windows and Linux or click the green debug icon to start debugging in WebStorm. + +The same way you can debug your application in IntelliJ IDEA Ultimate, PhpStorm, PyCharm Pro, and RubyMine. + +## Formatting Code Automatically + +Prettier is an opinionated code formatter with support for JavaScript, CSS and JSON. With Prettier you can format the code you write automatically to ensure a code style within your project. See the [Prettier's GitHub page](https://github.com/prettier/prettier) for more information, and look at this [page to see it in action](https://prettier.github.io/prettier/). + +To format our code whenever we make a commit in git, we need to install the following dependencies: + +```sh +npm install --save husky lint-staged prettier +``` + +Alternatively you may use `yarn`: + +```sh +yarn add husky lint-staged prettier +``` + +* `husky` makes it easy to use githooks as if they are npm scripts. +* `lint-staged` allows us to run scripts on staged files in git. See this [blog post about lint-staged to learn more about it](https://medium.com/@okonetchnikov/make-linting-great-again-f3890e1ad6b8). +* `prettier` is the JavaScript formatter we will run before commits. + +Now we can make sure every file is formatted correctly by adding a few lines to the `package.json` in the project root. + +Add the following line to `scripts` section: + +```diff + "scripts": { ++ "precommit": "lint-staged", + "start": "react-scripts start", + "build": "react-scripts build", +``` + +Next we add a 'lint-staged' field to the `package.json`, for example: + +```diff + "dependencies": { + // ... + }, ++ "lint-staged": { ++ "src/**/*.{js,jsx,json,css}": [ ++ "prettier --single-quote --write", ++ "git add" ++ ] ++ }, + "scripts": { +``` + +Now, whenever you make a commit, Prettier will format the changed files automatically. You can also run `./node_modules/.bin/prettier --single-quote --write "src/**/*.{js,jsx,json,css}"` to format your entire project for the first time. + +Next you might want to integrate Prettier in your favorite editor. Read the section on [Editor Integration](https://prettier.io/docs/en/editors.html) on the Prettier GitHub page. + +## Changing the Page `<title>` + +You can find the source HTML file in the `public` folder of the generated project. You may edit the `<title>` tag in it to change the title from “React App” to anything else. + +Note that normally you wouldn’t edit files in the `public` folder very often. For example, [adding a stylesheet](#adding-a-stylesheet) is done without touching the HTML. + +If you need to dynamically update the page title based on the content, you can use the browser [`document.title`](https://developer.mozilla.org/en-US/docs/Web/API/Document/title) API. For more complex scenarios when you want to change the title from React components, you can use [React Helmet](https://github.com/nfl/react-helmet), a third party library. + +If you use a custom server for your app in production and want to modify the title before it gets sent to the browser, you can follow advice in [this section](#generating-dynamic-meta-tags-on-the-server). Alternatively, you can pre-build each page as a static HTML file which then loads the JavaScript bundle, which is covered [here](#pre-rendering-into-static-html-files). + +## Installing a Dependency + +The generated project includes React and ReactDOM as dependencies. It also includes a set of scripts used by Create React App as a development dependency. You may install other dependencies (for example, React Router) with `npm`: + +```sh +npm install --save react-router +``` + +Alternatively you may use `yarn`: + +```sh +yarn add react-router +``` + +This works for any library, not just `react-router`. + +## Importing a Component + +This project setup supports ES6 modules thanks to Babel.<br> +While you can still use `require()` and `module.exports`, we encourage you to use [`import` and `export`](http://exploringjs.com/es6/ch_modules.html) instead. + +For example: + +### `Button.js` + +```js +import React, { Component } from 'react'; + +class Button extends Component { + render() { + // ... + } +} + +export default Button; // Don’t forget to use export default! +``` + +### `DangerButton.js` + + +```js +import React, { Component } from 'react'; +import Button from './Button'; // Import a component from another file + +class DangerButton extends Component { + render() { + return <Button color="red" />; + } +} + +export default DangerButton; +``` + +Be aware of the [difference between default and named exports](http://stackoverflow.com/questions/36795819/react-native-es-6-when-should-i-use-curly-braces-for-import/36796281#36796281). It is a common source of mistakes. + +We suggest that you stick to using default imports and exports when a module only exports a single thing (for example, a component). That’s what you get when you use `export default Button` and `import Button from './Button'`. + +Named exports are useful for utility modules that export several functions. A module may have at most one default export and as many named exports as you like. + +Learn more about ES6 modules: + +* [When to use the curly braces?](http://stackoverflow.com/questions/36795819/react-native-es-6-when-should-i-use-curly-braces-for-import/36796281#36796281) +* [Exploring ES6: Modules](http://exploringjs.com/es6/ch_modules.html) +* [Understanding ES6: Modules](https://leanpub.com/understandinges6/read#leanpub-auto-encapsulating-code-with-modules) + +## Code Splitting + +Instead of downloading the entire app before users can use it, code splitting allows you to split your code into small chunks which you can then load on demand. + +This project setup supports code splitting via [dynamic `import()`](http://2ality.com/2017/01/import-operator.html#loading-code-on-demand). Its [proposal](https://github.com/tc39/proposal-dynamic-import) is in stage 3. The `import()` function-like form takes the module name as an argument and returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) which always resolves to the namespace object of the module. + +Here is an example: + +### `moduleA.js` + +```js +const moduleA = 'Hello'; + +export { moduleA }; +``` +### `App.js` + +```js +import React, { Component } from 'react'; + +class App extends Component { + handleClick = () => { + import('./moduleA') + .then(({ moduleA }) => { + // Use moduleA + }) + .catch(err => { + // Handle failure + }); + }; + + render() { + return ( + <div> + <button onClick={this.handleClick}>Load</button> + </div> + ); + } +} + +export default App; +``` + +This will make `moduleA.js` and all its unique dependencies as a separate chunk that only loads after the user clicks the 'Load' button. + +You can also use it with `async` / `await` syntax if you prefer it. + +### With React Router + +If you are using React Router check out [this tutorial](http://serverless-stack.com/chapters/code-splitting-in-create-react-app.html) on how to use code splitting with it. You can find the companion GitHub repository [here](https://github.com/AnomalyInnovations/serverless-stack-demo-client/tree/code-splitting-in-create-react-app). + +Also check out the [Code Splitting](https://reactjs.org/docs/code-splitting.html) section in React documentation. + +## Adding a Stylesheet + +This project setup uses [Webpack](https://webpack.js.org/) for handling all assets. Webpack offers a custom way of “extending” the concept of `import` beyond JavaScript. To express that a JavaScript file depends on a CSS file, you need to **import the CSS from the JavaScript file**: + +### `Button.css` + +```css +.Button { + padding: 20px; +} +``` + +### `Button.js` + +```js +import React, { Component } from 'react'; +import './Button.css'; // Tell Webpack that Button.js uses these styles + +class Button extends Component { + render() { + // You can use them as regular CSS styles + return <div className="Button" />; + } +} +``` + +**This is not required for React** but many people find this feature convenient. You can read about the benefits of this approach [here](https://medium.com/seek-blog/block-element-modifying-your-javascript-components-d7f99fcab52b). However you should be aware that this makes your code less portable to other build tools and environments than Webpack. + +In development, expressing dependencies this way allows your styles to be reloaded on the fly as you edit them. In production, all CSS files will be concatenated into a single minified `.css` file in the build output. + +If you are concerned about using Webpack-specific semantics, you can put all your CSS right into `src/index.css`. It would still be imported from `src/index.js`, but you could always remove that import if you later migrate to a different build tool. + +## Post-Processing CSS + +This project setup minifies your CSS and adds vendor prefixes to it automatically through [Autoprefixer](https://github.com/postcss/autoprefixer) so you don’t need to worry about it. + +For example, this: + +```css +.App { + display: flex; + flex-direction: row; + align-items: center; +} +``` + +becomes this: + +```css +.App { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-direction: row; + flex-direction: row; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; +} +``` + +If you need to disable autoprefixing for some reason, [follow this section](https://github.com/postcss/autoprefixer#disabling). + +## Adding a CSS Preprocessor (Sass, Less etc.) + +Generally, we recommend that you don’t reuse the same CSS classes across different components. For example, instead of using a `.Button` CSS class in `<AcceptButton>` and `<RejectButton>` components, we recommend creating a `<Button>` component with its own `.Button` styles, that both `<AcceptButton>` and `<RejectButton>` can render (but [not inherit](https://facebook.github.io/react/docs/composition-vs-inheritance.html)). + +Following this rule often makes CSS preprocessors less useful, as features like mixins and nesting are replaced by component composition. You can, however, integrate a CSS preprocessor if you find it valuable. In this walkthrough, we will be using Sass, but you can also use Less, or another alternative. + +First, let’s install the command-line interface for Sass: + +```sh +npm install --save node-sass-chokidar +``` + +Alternatively you may use `yarn`: + +```sh +yarn add node-sass-chokidar +``` + +Then in `package.json`, add the following lines to `scripts`: + +```diff + "scripts": { ++ "build-css": "node-sass-chokidar src/ -o src/", ++ "watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive", + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test --env=jsdom", +``` + +>Note: To use a different preprocessor, replace `build-css` and `watch-css` commands according to your preprocessor’s documentation. + +Now you can rename `src/App.css` to `src/App.scss` and run `npm run watch-css`. The watcher will find every Sass file in `src` subdirectories, and create a corresponding CSS file next to it, in our case overwriting `src/App.css`. Since `src/App.js` still imports `src/App.css`, the styles become a part of your application. You can now edit `src/App.scss`, and `src/App.css` will be regenerated. + +To share variables between Sass files, you can use Sass imports. For example, `src/App.scss` and other component style files could include `@import "./shared.scss";` with variable definitions. + +To enable importing files without using relative paths, you can add the `--include-path` option to the command in `package.json`. + +``` +"build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/", +"watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive", +``` + +This will allow you to do imports like + +```scss +@import 'styles/_colors.scss'; // assuming a styles directory under src/ +@import 'nprogress/nprogress'; // importing a css file from the nprogress node module +``` + +At this point you might want to remove all CSS files from the source control, and add `src/**/*.css` to your `.gitignore` file. It is generally a good practice to keep the build products outside of the source control. + +As a final step, you may find it convenient to run `watch-css` automatically with `npm start`, and run `build-css` as a part of `npm run build`. You can use the `&&` operator to execute two scripts sequentially. However, there is no cross-platform way to run two scripts in parallel, so we will install a package for this: + +```sh +npm install --save npm-run-all +``` + +Alternatively you may use `yarn`: + +```sh +yarn add npm-run-all +``` + +Then we can change `start` and `build` scripts to include the CSS preprocessor commands: + +```diff + "scripts": { + "build-css": "node-sass-chokidar src/ -o src/", + "watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive", +- "start": "react-scripts start", +- "build": "react-scripts build", ++ "start-js": "react-scripts start", ++ "start": "npm-run-all -p watch-css start-js", ++ "build-js": "react-scripts build", ++ "build": "npm-run-all build-css build-js", + "test": "react-scripts test --env=jsdom", + "eject": "react-scripts eject" + } +``` + +Now running `npm start` and `npm run build` also builds Sass files. + +**Why `node-sass-chokidar`?** + +`node-sass` has been reported as having the following issues: + +- `node-sass --watch` has been reported to have *performance issues* in certain conditions when used in a virtual machine or with docker. + +- Infinite styles compiling [#1939](https://github.com/facebookincubator/create-react-app/issues/1939) + +- `node-sass` has been reported as having issues with detecting new files in a directory [#1891](https://github.com/sass/node-sass/issues/1891) + + `node-sass-chokidar` is used here as it addresses these issues. + +## Adding Images, Fonts, and Files + +With Webpack, using static assets like images and fonts works similarly to CSS. + +You can **`import` a file right in a JavaScript module**. This tells Webpack to include that file in the bundle. Unlike CSS imports, importing a file gives you a string value. This value is the final path you can reference in your code, e.g. as the `src` attribute of an image or the `href` of a link to a PDF. + +To reduce the number of requests to the server, importing images that are less than 10,000 bytes returns a [data URI](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) instead of a path. This applies to the following file extensions: bmp, gif, jpg, jpeg, and png. SVG files are excluded due to [#1153](https://github.com/facebookincubator/create-react-app/issues/1153). + +Here is an example: + +```js +import React from 'react'; +import logo from './logo.png'; // Tell Webpack this JS file uses this image + +console.log(logo); // /logo.84287d09.png + +function Header() { + // Import result is the URL of your image + return <img src={logo} alt="Logo" />; +} + +export default Header; +``` + +This ensures that when the project is built, Webpack will correctly move the images into the build folder, and provide us with correct paths. + +This works in CSS too: + +```css +.Logo { + background-image: url(./logo.png); +} +``` + +Webpack finds all relative module references in CSS (they start with `./`) and replaces them with the final paths from the compiled bundle. If you make a typo or accidentally delete an important file, you will see a compilation error, just like when you import a non-existent JavaScript module. The final filenames in the compiled bundle are generated by Webpack from content hashes. If the file content changes in the future, Webpack will give it a different name in production so you don’t need to worry about long-term caching of assets. + +Please be advised that this is also a custom feature of Webpack. + +**It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images).<br> +An alternative way of handling static assets is described in the next section. + +## Using the `public` Folder + +>Note: this feature is available with `react-scripts@0.5.0` and higher. + +### Changing the HTML + +The `public` folder contains the HTML file so you can tweak it, for example, to [set the page title](#changing-the-page-title). +The `<script>` tag with the compiled code will be added to it automatically during the build process. + +### Adding Assets Outside of the Module System + +You can also add other assets to the `public` folder. + +Note that we normally encourage you to `import` assets in JavaScript files instead. +For example, see the sections on [adding a stylesheet](#adding-a-stylesheet) and [adding images and fonts](#adding-images-fonts-and-files). +This mechanism provides a number of benefits: + +* Scripts and stylesheets get minified and bundled together to avoid extra network requests. +* Missing files cause compilation errors instead of 404 errors for your users. +* Result filenames include content hashes so you don’t need to worry about browsers caching their old versions. + +However there is an **escape hatch** that you can use to add an asset outside of the module system. + +If you put a file into the `public` folder, it will **not** be processed by Webpack. Instead it will be copied into the build folder untouched. To reference assets in the `public` folder, you need to use a special variable called `PUBLIC_URL`. + +Inside `index.html`, you can use it like this: + +```html +<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> +``` + +Only files inside the `public` folder will be accessible by `%PUBLIC_URL%` prefix. If you need to use a file from `src` or `node_modules`, you’ll have to copy it there to explicitly specify your intention to make this file a part of the build. + +When you run `npm run build`, Create React App will substitute `%PUBLIC_URL%` with a correct absolute path so your project works even if you use client-side routing or host it at a non-root URL. + +In JavaScript code, you can use `process.env.PUBLIC_URL` for similar purposes: + +```js +render() { + // Note: this is an escape hatch and should be used sparingly! + // Normally we recommend using `import` for getting asset URLs + // as described in “Adding Images and Fonts” above this section. + return <img src={process.env.PUBLIC_URL + '/img/logo.png'} />; +} +``` + +Keep in mind the downsides of this approach: + +* None of the files in `public` folder get post-processed or minified. +* Missing files will not be called at compilation time, and will cause 404 errors for your users. +* Result filenames won’t include content hashes so you’ll need to add query arguments or rename them every time they change. + +### When to Use the `public` Folder + +Normally we recommend importing [stylesheets](#adding-a-stylesheet), [images, and fonts](#adding-images-fonts-and-files) from JavaScript. +The `public` folder is useful as a workaround for a number of less common cases: + +* You need a file with a specific name in the build output, such as [`manifest.webmanifest`](https://developer.mozilla.org/en-US/docs/Web/Manifest). +* You have thousands of images and need to dynamically reference their paths. +* You want to include a small script like [`pace.js`](http://github.hubspot.com/pace/docs/welcome/) outside of the bundled code. +* Some library may be incompatible with Webpack and you have no other option but to include it as a `<script>` tag. + +Note that if you add a `<script>` that declares global variables, you also need to read the next section on using them. + +## Using Global Variables + +When you include a script in the HTML file that defines global variables and try to use one of these variables in the code, the linter will complain because it cannot see the definition of the variable. + +You can avoid this by reading the global variable explicitly from the `window` object, for example: + +```js +const $ = window.$; +``` + +This makes it obvious you are using a global variable intentionally rather than because of a typo. + +Alternatively, you can force the linter to ignore any line by adding `// eslint-disable-line` after it. + +## Adding Bootstrap + +You don’t have to use [React Bootstrap](https://react-bootstrap.github.io) together with React but it is a popular library for integrating Bootstrap with React apps. If you need it, you can integrate it with Create React App by following these steps: + +Install React Bootstrap and Bootstrap from npm. React Bootstrap does not include Bootstrap CSS so this needs to be installed as well: + +```sh +npm install --save react-bootstrap bootstrap@3 +``` + +Alternatively you may use `yarn`: + +```sh +yarn add react-bootstrap bootstrap@3 +``` + +Import Bootstrap CSS and optionally Bootstrap theme CSS in the beginning of your ```src/index.js``` file: + +```js +import 'bootstrap/dist/css/bootstrap.css'; +import 'bootstrap/dist/css/bootstrap-theme.css'; +// Put any other imports below so that CSS from your +// components takes precedence over default styles. +``` + +Import required React Bootstrap components within ```src/App.js``` file or your custom component files: + +```js +import { Navbar, Jumbotron, Button } from 'react-bootstrap'; +``` + +Now you are ready to use the imported React Bootstrap components within your component hierarchy defined in the render method. Here is an example [`App.js`](https://gist.githubusercontent.com/gaearon/85d8c067f6af1e56277c82d19fd4da7b/raw/6158dd991b67284e9fc8d70b9d973efe87659d72/App.js) redone using React Bootstrap. + +### Using a Custom Theme + +Sometimes you might need to tweak the visual styles of Bootstrap (or equivalent package).<br> +We suggest the following approach: + +* Create a new package that depends on the package you wish to customize, e.g. Bootstrap. +* Add the necessary build steps to tweak the theme, and publish your package on npm. +* Install your own theme npm package as a dependency of your app. + +Here is an example of adding a [customized Bootstrap](https://medium.com/@tacomanator/customizing-create-react-app-aa9ffb88165) that follows these steps. + +## Adding Flow + +Flow is a static type checker that helps you write code with fewer bugs. Check out this [introduction to using static types in JavaScript](https://medium.com/@preethikasireddy/why-use-static-types-in-javascript-part-1-8382da1e0adb) if you are new to this concept. + +Recent versions of [Flow](http://flowtype.org/) work with Create React App projects out of the box. + +To add Flow to a Create React App project, follow these steps: + +1. Run `npm install --save flow-bin` (or `yarn add flow-bin`). +2. Add `"flow": "flow"` to the `scripts` section of your `package.json`. +3. Run `npm run flow init` (or `yarn flow init`) to create a [`.flowconfig` file](https://flowtype.org/docs/advanced-configuration.html) in the root directory. +4. Add `// @flow` to any files you want to type check (for example, to `src/App.js`). + +Now you can run `npm run flow` (or `yarn flow`) to check the files for type errors. +You can optionally use an IDE like [Nuclide](https://nuclide.io/docs/languages/flow/) for a better integrated experience. +In the future we plan to integrate it into Create React App even more closely. + +To learn more about Flow, check out [its documentation](https://flowtype.org/). + +## Adding a Router + +Create React App doesn't prescribe a specific routing solution, but [React Router](https://reacttraining.com/react-router/) is the most popular one. + +To add it, run: + +```sh +npm install --save react-router-dom +``` + +Alternatively you may use `yarn`: + +```sh +yarn add react-router-dom +``` + +To try it, delete all the code in `src/App.js` and replace it with any of the examples on its website. The [Basic Example](https://reacttraining.com/react-router/web/example/basic) is a good place to get started. + +Note that [you may need to configure your production server to support client-side routing](#serving-apps-with-client-side-routing) before deploying your app. + +## Adding Custom Environment Variables + +>Note: this feature is available with `react-scripts@0.2.3` and higher. + +Your project can consume variables declared in your environment as if they were declared locally in your JS files. By +default you will have `NODE_ENV` defined for you, and any other environment variables starting with +`REACT_APP_`. + +**The environment variables are embedded during the build time**. Since Create React App produces a static HTML/CSS/JS bundle, it can’t possibly read them at runtime. To read them at runtime, you would need to load HTML into memory on the server and replace placeholders in runtime, just like [described here](#injecting-data-from-the-server-into-the-page). Alternatively you can rebuild the app on the server anytime you change them. + +>Note: You must create custom environment variables beginning with `REACT_APP_`. Any other variables except `NODE_ENV` will be ignored to avoid accidentally [exposing a private key on the machine that could have the same name](https://github.com/facebookincubator/create-react-app/issues/865#issuecomment-252199527). Changing any environment variables will require you to restart the development server if it is running. + +These environment variables will be defined for you on `process.env`. For example, having an environment +variable named `REACT_APP_SECRET_CODE` will be exposed in your JS as `process.env.REACT_APP_SECRET_CODE`. + +There is also a special built-in environment variable called `NODE_ENV`. You can read it from `process.env.NODE_ENV`. When you run `npm start`, it is always equal to `'development'`, when you run `npm test` it is always equal to `'test'`, and when you run `npm run build` to make a production bundle, it is always equal to `'production'`. **You cannot override `NODE_ENV` manually.** This prevents developers from accidentally deploying a slow development build to production. + +These environment variables can be useful for displaying information conditionally based on where the project is +deployed or consuming sensitive data that lives outside of version control. + +First, you need to have environment variables defined. For example, let’s say you wanted to consume a secret defined +in the environment inside a `<form>`: + +```jsx +render() { + return ( + <div> + <small>You are running this application in <b>{process.env.NODE_ENV}</b> mode.</small> + <form> + <input type="hidden" defaultValue={process.env.REACT_APP_SECRET_CODE} /> + </form> + </div> + ); +} +``` + +During the build, `process.env.REACT_APP_SECRET_CODE` will be replaced with the current value of the `REACT_APP_SECRET_CODE` environment variable. Remember that the `NODE_ENV` variable will be set for you automatically. + +When you load the app in the browser and inspect the `<input>`, you will see its value set to `abcdef`, and the bold text will show the environment provided when using `npm start`: + +```html +<div> + <small>You are running this application in <b>development</b> mode.</small> + <form> + <input type="hidden" value="abcdef" /> + </form> +</div> +``` + +The above form is looking for a variable called `REACT_APP_SECRET_CODE` from the environment. In order to consume this +value, we need to have it defined in the environment. This can be done using two ways: either in your shell or in +a `.env` file. Both of these ways are described in the next few sections. + +Having access to the `NODE_ENV` is also useful for performing actions conditionally: + +```js +if (process.env.NODE_ENV !== 'production') { + analytics.disable(); +} +``` + +When you compile the app with `npm run build`, the minification step will strip out this condition, and the resulting bundle will be smaller. + +### Referencing Environment Variables in the HTML + +>Note: this feature is available with `react-scripts@0.9.0` and higher. + +You can also access the environment variables starting with `REACT_APP_` in the `public/index.html`. For example: + +```html +<title>%REACT_APP_WEBSITE_NAME% +``` + +Note that the caveats from the above section apply: + +* Apart from a few built-in variables (`NODE_ENV` and `PUBLIC_URL`), variable names must start with `REACT_APP_` to work. +* The environment variables are injected at build time. If you need to inject them at runtime, [follow this approach instead](#generating-dynamic-meta-tags-on-the-server). + +### Adding Temporary Environment Variables In Your Shell + +Defining environment variables can vary between OSes. It’s also important to know that this manner is temporary for the +life of the shell session. + +#### Windows (cmd.exe) + +```cmd +set "REACT_APP_SECRET_CODE=abcdef" && npm start +``` + +(Note: Quotes around the variable assignment are required to avoid a trailing whitespace.) + +#### Windows (Powershell) + +```Powershell +($env:REACT_APP_SECRET_CODE = "abcdef") -and (npm start) +``` + +#### Linux, macOS (Bash) + +```bash +REACT_APP_SECRET_CODE=abcdef npm start +``` + +### Adding Development Environment Variables In `.env` + +>Note: this feature is available with `react-scripts@0.5.0` and higher. + +To define permanent environment variables, create a file called `.env` in the root of your project: + +``` +REACT_APP_SECRET_CODE=abcdef +``` +>Note: You must create custom environment variables beginning with `REACT_APP_`. Any other variables except `NODE_ENV` will be ignored to avoid [accidentally exposing a private key on the machine that could have the same name](https://github.com/facebookincubator/create-react-app/issues/865#issuecomment-252199527). Changing any environment variables will require you to restart the development server if it is running. + +`.env` files **should be** checked into source control (with the exclusion of `.env*.local`). + +#### What other `.env` files can be used? + +>Note: this feature is **available with `react-scripts@1.0.0` and higher**. + +* `.env`: Default. +* `.env.local`: Local overrides. **This file is loaded for all environments except test.** +* `.env.development`, `.env.test`, `.env.production`: Environment-specific settings. +* `.env.development.local`, `.env.test.local`, `.env.production.local`: Local overrides of environment-specific settings. + +Files on the left have more priority than files on the right: + +* `npm start`: `.env.development.local`, `.env.development`, `.env.local`, `.env` +* `npm run build`: `.env.production.local`, `.env.production`, `.env.local`, `.env` +* `npm test`: `.env.test.local`, `.env.test`, `.env` (note `.env.local` is missing) + +These variables will act as the defaults if the machine does not explicitly set them.
+Please refer to the [dotenv documentation](https://github.com/motdotla/dotenv) for more details. + +>Note: If you are defining environment variables for development, your CI and/or hosting platform will most likely need +these defined as well. Consult their documentation how to do this. For example, see the documentation for [Travis CI](https://docs.travis-ci.com/user/environment-variables/) or [Heroku](https://devcenter.heroku.com/articles/config-vars). + +#### Expanding Environment Variables In `.env` + +>Note: this feature is available with `react-scripts@1.1.0` and higher. + +Expand variables already on your machine for use in your `.env` file (using [dotenv-expand](https://github.com/motdotla/dotenv-expand)). + +For example, to get the environment variable `npm_package_version`: + +``` +REACT_APP_VERSION=$npm_package_version +# also works: +# REACT_APP_VERSION=${npm_package_version} +``` + +Or expand variables local to the current `.env` file: + +``` +DOMAIN=www.example.com +REACT_APP_FOO=$DOMAIN/foo +REACT_APP_BAR=$DOMAIN/bar +``` + +## Can I Use Decorators? + +Many popular libraries use [decorators](https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841) in their documentation.
+Create React App doesn’t support decorator syntax at the moment because: + +* It is an experimental proposal and is subject to change. +* The current specification version is not officially supported by Babel. +* If the specification changes, we won’t be able to write a codemod because we don’t use them internally at Facebook. + +However in many cases you can rewrite decorator-based code without decorators just as fine.
+Please refer to these two threads for reference: + +* [#214](https://github.com/facebookincubator/create-react-app/issues/214) +* [#411](https://github.com/facebookincubator/create-react-app/issues/411) + +Create React App will add decorator support when the specification advances to a stable stage. + +## Fetching Data with AJAX Requests + +React doesn't prescribe a specific approach to data fetching, but people commonly use either a library like [axios](https://github.com/axios/axios) or the [`fetch()` API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) provided by the browser. Conveniently, Create React App includes a polyfill for `fetch()` so you can use it without worrying about the browser support. + +The global `fetch` function allows to easily makes AJAX requests. It takes in a URL as an input and returns a `Promise` that resolves to a `Response` object. You can find more information about `fetch` [here](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch). + +This project also includes a [Promise polyfill](https://github.com/then/promise) which provides a full implementation of Promises/A+. A Promise represents the eventual result of an asynchronous operation, you can find more information about Promises [here](https://www.promisejs.org/) and [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). Both axios and `fetch()` use Promises under the hood. You can also use the [`async / await`](https://davidwalsh.name/async-await) syntax to reduce the callback nesting. + +You can learn more about making AJAX requests from React components in [the FAQ entry on the React website](https://reactjs.org/docs/faq-ajax.html). + +## Integrating with an API Backend + +These tutorials will help you to integrate your app with an API backend running on another port, +using `fetch()` to access it. + +### Node +Check out [this tutorial](https://www.fullstackreact.com/articles/using-create-react-app-with-a-server/). +You can find the companion GitHub repository [here](https://github.com/fullstackreact/food-lookup-demo). + +### Ruby on Rails + +Check out [this tutorial](https://www.fullstackreact.com/articles/how-to-get-create-react-app-to-work-with-your-rails-api/). +You can find the companion GitHub repository [here](https://github.com/fullstackreact/food-lookup-demo-rails). + +## Proxying API Requests in Development + +>Note: this feature is available with `react-scripts@0.2.3` and higher. + +People often serve the front-end React app from the same host and port as their backend implementation.
+For example, a production setup might look like this after the app is deployed: + +``` +/ - static server returns index.html with React app +/todos - static server returns index.html with React app +/api/todos - server handles any /api/* requests using the backend implementation +``` + +Such setup is **not** required. However, if you **do** have a setup like this, it is convenient to write requests like `fetch('/api/todos')` without worrying about redirecting them to another host or port during development. + +To tell the development server to proxy any unknown requests to your API server in development, add a `proxy` field to your `package.json`, for example: + +```js + "proxy": "http://localhost:4000", +``` + +This way, when you `fetch('/api/todos')` in development, the development server will recognize that it’s not a static asset, and will proxy your request to `http://localhost:4000/api/todos` as a fallback. The development server will **only** attempt to send requests without `text/html` in its `Accept` header to the proxy. + +Conveniently, this avoids [CORS issues](http://stackoverflow.com/questions/21854516/understanding-ajax-cors-and-security-considerations) and error messages like this in development: + +``` +Fetch API cannot load http://localhost:4000/api/todos. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. +``` + +Keep in mind that `proxy` only has effect in development (with `npm start`), and it is up to you to ensure that URLs like `/api/todos` point to the right thing in production. You don’t have to use the `/api` prefix. Any unrecognized request without a `text/html` accept header will be redirected to the specified `proxy`. + +The `proxy` option supports HTTP, HTTPS and WebSocket connections.
+If the `proxy` option is **not** flexible enough for you, alternatively you can: + +* [Configure the proxy yourself](#configuring-the-proxy-manually) +* Enable CORS on your server ([here’s how to do it for Express](http://enable-cors.org/server_expressjs.html)). +* Use [environment variables](#adding-custom-environment-variables) to inject the right server host and port into your app. + +### "Invalid Host Header" Errors After Configuring Proxy + +When you enable the `proxy` option, you opt into a more strict set of host checks. This is necessary because leaving the backend open to remote hosts makes your computer vulnerable to DNS rebinding attacks. The issue is explained in [this article](https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a) and [this issue](https://github.com/webpack/webpack-dev-server/issues/887). + +This shouldn’t affect you when developing on `localhost`, but if you develop remotely like [described here](https://github.com/facebookincubator/create-react-app/issues/2271), you will see this error in the browser after enabling the `proxy` option: + +>Invalid Host header + +To work around it, you can specify your public development host in a file called `.env.development` in the root of your project: + +``` +HOST=mypublicdevhost.com +``` + +If you restart the development server now and load the app from the specified host, it should work. + +If you are still having issues or if you’re using a more exotic environment like a cloud editor, you can bypass the host check completely by adding a line to `.env.development.local`. **Note that this is dangerous and exposes your machine to remote code execution from malicious websites:** + +``` +# NOTE: THIS IS DANGEROUS! +# It exposes your machine to attacks from the websites you visit. +DANGEROUSLY_DISABLE_HOST_CHECK=true +``` + +We don’t recommend this approach. + +### Configuring the Proxy Manually + +>Note: this feature is available with `react-scripts@1.0.0` and higher. + +If the `proxy` option is **not** flexible enough for you, you can specify an object in the following form (in `package.json`).
+You may also specify any configuration value [`http-proxy-middleware`](https://github.com/chimurai/http-proxy-middleware#options) or [`http-proxy`](https://github.com/nodejitsu/node-http-proxy#options) supports. +```js +{ + // ... + "proxy": { + "/api": { + "target": "", + "ws": true + // ... + } + } + // ... +} +``` + +All requests matching this path will be proxies, no exceptions. This includes requests for `text/html`, which the standard `proxy` option does not proxy. + +If you need to specify multiple proxies, you may do so by specifying additional entries. +Matches are regular expressions, so that you can use a regexp to match multiple paths. +```js +{ + // ... + "proxy": { + // Matches any request starting with /api + "/api": { + "target": "", + "ws": true + // ... + }, + // Matches any request starting with /foo + "/foo": { + "target": "", + "ssl": true, + "pathRewrite": { + "^/foo": "/foo/beta" + } + // ... + }, + // Matches /bar/abc.html but not /bar/sub/def.html + "/bar/[^/]*[.]html": { + "target": "", + // ... + }, + // Matches /baz/abc.html and /baz/sub/def.html + "/baz/.*/.*[.]html": { + "target": "" + // ... + } + } + // ... +} +``` + +### Configuring a WebSocket Proxy + +When setting up a WebSocket proxy, there are a some extra considerations to be aware of. + +If you’re using a WebSocket engine like [Socket.io](https://socket.io/), you must have a Socket.io server running that you can use as the proxy target. Socket.io will not work with a standard WebSocket server. Specifically, don't expect Socket.io to work with [the websocket.org echo test](http://websocket.org/echo.html). + +There’s some good documentation available for [setting up a Socket.io server](https://socket.io/docs/). + +Standard WebSockets **will** work with a standard WebSocket server as well as the websocket.org echo test. You can use libraries like [ws](https://github.com/websockets/ws) for the server, with [native WebSockets in the browser](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket). + +Either way, you can proxy WebSocket requests manually in `package.json`: + +```js +{ + // ... + "proxy": { + "/socket": { + // Your compatible WebSocket server + "target": "ws://", + // Tell http-proxy-middleware that this is a WebSocket proxy. + // Also allows you to proxy WebSocket requests without an additional HTTP request + // https://github.com/chimurai/http-proxy-middleware#external-websocket-upgrade + "ws": true + // ... + } + } + // ... +} +``` + +## Using HTTPS in Development + +>Note: this feature is available with `react-scripts@0.4.0` and higher. + +You may require the dev server to serve pages over HTTPS. One particular case where this could be useful is when using [the "proxy" feature](#proxying-api-requests-in-development) to proxy requests to an API server when that API server is itself serving HTTPS. + +To do this, set the `HTTPS` environment variable to `true`, then start the dev server as usual with `npm start`: + +#### Windows (cmd.exe) + +```cmd +set HTTPS=true&&npm start +``` + +#### Windows (Powershell) + +```Powershell +($env:HTTPS = $true) -and (npm start) +``` + +(Note: the lack of whitespace is intentional.) + +#### Linux, macOS (Bash) + +```bash +HTTPS=true npm start +``` + +Note that the server will use a self-signed certificate, so your web browser will almost definitely display a warning upon accessing the page. + +## Generating Dynamic `` Tags on the Server + +Since Create React App doesn’t support server rendering, you might be wondering how to make `` tags dynamic and reflect the current URL. To solve this, we recommend to add placeholders into the HTML, like this: + +```html + + + + + +``` + +Then, on the server, regardless of the backend you use, you can read `index.html` into memory and replace `__OG_TITLE__`, `__OG_DESCRIPTION__`, and any other placeholders with values depending on the current URL. Just make sure to sanitize and escape the interpolated values so that they are safe to embed into HTML! + +If you use a Node server, you can even share the route matching logic between the client and the server. However duplicating it also works fine in simple cases. + +## Pre-Rendering into Static HTML Files + +If you’re hosting your `build` with a static hosting provider you can use [react-snapshot](https://www.npmjs.com/package/react-snapshot) or [react-snap](https://github.com/stereobooster/react-snap) to generate HTML pages for each route, or relative link, in your application. These pages will then seamlessly become active, or “hydrated”, when the JavaScript bundle has loaded. + +There are also opportunities to use this outside of static hosting, to take the pressure off the server when generating and caching routes. + +The primary benefit of pre-rendering is that you get the core content of each page _with_ the HTML payload—regardless of whether or not your JavaScript bundle successfully downloads. It also increases the likelihood that each route of your application will be picked up by search engines. + +You can read more about [zero-configuration pre-rendering (also called snapshotting) here](https://medium.com/superhighfives/an-almost-static-stack-6df0a2791319). + +## Injecting Data from the Server into the Page + +Similarly to the previous section, you can leave some placeholders in the HTML that inject global variables, for example: + +```js + + + + +``` + +Then, on the server, you can replace `__SERVER_DATA__` with a JSON of real data right before sending the response. The client code can then read `window.SERVER_DATA` to use it. **Make sure to [sanitize the JSON before sending it to the client](https://medium.com/node-security/the-most-common-xss-vulnerability-in-react-js-applications-2bdffbcc1fa0) as it makes your app vulnerable to XSS attacks.** + +## Running Tests + +>Note: this feature is available with `react-scripts@0.3.0` and higher.
+>[Read the migration guide to learn how to enable it in older projects!](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md#migrating-from-023-to-030) + +Create React App uses [Jest](https://facebook.github.io/jest/) as its test runner. To prepare for this integration, we did a [major revamp](https://facebook.github.io/jest/blog/2016/09/01/jest-15.html) of Jest so if you heard bad things about it years ago, give it another try. + +Jest is a Node-based runner. This means that the tests always run in a Node environment and not in a real browser. This lets us enable fast iteration speed and prevent flakiness. + +While Jest provides browser globals such as `window` thanks to [jsdom](https://github.com/tmpvar/jsdom), they are only approximations of the real browser behavior. Jest is intended to be used for unit tests of your logic and your components rather than the DOM quirks. + +We recommend that you use a separate tool for browser end-to-end tests if you need them. They are beyond the scope of Create React App. + +### Filename Conventions + +Jest will look for test files with any of the following popular naming conventions: + +* Files with `.js` suffix in `__tests__` folders. +* Files with `.test.js` suffix. +* Files with `.spec.js` suffix. + +The `.test.js` / `.spec.js` files (or the `__tests__` folders) can be located at any depth under the `src` top level folder. + +We recommend to put the test files (or `__tests__` folders) next to the code they are testing so that relative imports appear shorter. For example, if `App.test.js` and `App.js` are in the same folder, the test just needs to `import App from './App'` instead of a long relative path. Colocation also helps find tests more quickly in larger projects. + +### Command Line Interface + +When you run `npm test`, Jest will launch in the watch mode. Every time you save a file, it will re-run the tests, just like `npm start` recompiles the code. + +The watcher includes an interactive command-line interface with the ability to run all tests, or focus on a search pattern. It is designed this way so that you can keep it open and enjoy fast re-runs. You can learn the commands from the “Watch Usage” note that the watcher prints after every run: + +![Jest watch mode](http://facebook.github.io/jest/img/blog/15-watch.gif) + +### Version Control Integration + +By default, when you run `npm test`, Jest will only run the tests related to files changed since the last commit. This is an optimization designed to make your tests run fast regardless of how many tests you have. However it assumes that you don’t often commit the code that doesn’t pass the tests. + +Jest will always explicitly mention that it only ran tests related to the files changed since the last commit. You can also press `a` in the watch mode to force Jest to run all tests. + +Jest will always run all tests on a [continuous integration](#continuous-integration) server or if the project is not inside a Git or Mercurial repository. + +### Writing Tests + +To create tests, add `it()` (or `test()`) blocks with the name of the test and its code. You may optionally wrap them in `describe()` blocks for logical grouping but this is neither required nor recommended. + +Jest provides a built-in `expect()` global function for making assertions. A basic test could look like this: + +```js +import sum from './sum'; + +it('sums numbers', () => { + expect(sum(1, 2)).toEqual(3); + expect(sum(2, 2)).toEqual(4); +}); +``` + +All `expect()` matchers supported by Jest are [extensively documented here](https://facebook.github.io/jest/docs/en/expect.html#content).
+You can also use [`jest.fn()` and `expect(fn).toBeCalled()`](https://facebook.github.io/jest/docs/en/expect.html#tohavebeencalled) to create “spies” or mock functions. + +### Testing Components + +There is a broad spectrum of component testing techniques. They range from a “smoke test” verifying that a component renders without throwing, to shallow rendering and testing some of the output, to full rendering and testing component lifecycle and state changes. + +Different projects choose different testing tradeoffs based on how often components change, and how much logic they contain. If you haven’t decided on a testing strategy yet, we recommend that you start with creating simple smoke tests for your components: + +```js +import React from 'react'; +import ReactDOM from 'react-dom'; +import App from './App'; + +it('renders without crashing', () => { + const div = document.createElement('div'); + ReactDOM.render(, div); +}); +``` + +This test mounts a component and makes sure that it didn’t throw during rendering. Tests like this provide a lot of value with very little effort so they are great as a starting point, and this is the test you will find in `src/App.test.js`. + +When you encounter bugs caused by changing components, you will gain a deeper insight into which parts of them are worth testing in your application. This might be a good time to introduce more specific tests asserting specific expected output or behavior. + +If you’d like to test components in isolation from the child components they render, we recommend using [`shallow()` rendering API](http://airbnb.io/enzyme/docs/api/shallow.html) from [Enzyme](http://airbnb.io/enzyme/). To install it, run: + +```sh +npm install --save enzyme enzyme-adapter-react-16 react-test-renderer +``` + +Alternatively you may use `yarn`: + +```sh +yarn add enzyme enzyme-adapter-react-16 react-test-renderer +``` + +As of Enzyme 3, you will need to install Enzyme along with an Adapter corresponding to the version of React you are using. (The examples above use the adapter for React 16.) + +The adapter will also need to be configured in your [global setup file](#initializing-test-environment): + +#### `src/setupTests.js` +```js +import { configure } from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; + +configure({ adapter: new Adapter() }); +``` + +>Note: Keep in mind that if you decide to "eject" before creating `src/setupTests.js`, the resulting `package.json` file won't contain any reference to it. [Read here](#initializing-test-environment) to learn how to add this after ejecting. + +Now you can write a smoke test with it: + +```js +import React from 'react'; +import { shallow } from 'enzyme'; +import App from './App'; + +it('renders without crashing', () => { + shallow(); +}); +``` + +Unlike the previous smoke test using `ReactDOM.render()`, this test only renders `` and doesn’t go deeper. For example, even if `` itself renders a ` - - - - - - - - - - diff --git a/src/app/additional/additional.component.spec.ts b/src/app/additional/additional.component.spec.ts deleted file mode 100644 index 7e5eb90..0000000 --- a/src/app/additional/additional.component.spec.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { StoreService } from '../services/store.service'; - -import { AdditionalComponent } from './additional.component'; - -xdescribe('AdditionalComponent', () => { - let component: AdditionalComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ AdditionalComponent ], - providers: [ StoreService ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(AdditionalComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/additional/additional.component.ts b/src/app/additional/additional.component.ts deleted file mode 100644 index b0dedcb..0000000 --- a/src/app/additional/additional.component.ts +++ /dev/null @@ -1,174 +0,0 @@ -import { Component, Inject, OnInit, OnDestroy } from '@angular/core'; -import { StoreService, GetAssetService, CountryService, RetailerService } from '../services/'; -import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms'; -import 'rxjs/add/operator/takeUntil'; -import 'rxjs/add/observable/throw'; -import { Subscription } from 'rxjs/Subscription'; -import { RecaptchaValidator } from '../validators/'; -import { Subject } from 'rxjs/Subject'; -import { Observable } from 'rxjs/Observable'; -import { APP_CONFIG, AppConfig } from '../config'; -import { ICountry, IState } from '../models'; -import { WarrantiesService } from '../services/warranties.service'; -import { WarrantiesCommand } from '../models/warranties.command'; -import { ImageResizerService } from '../services/image-resizer.service'; - -@Component({ - selector: 'app-additional', - templateUrl: './additional.component.html', - styleUrls: ['./additional.component.css'] -}) -export class AdditionalComponent implements OnInit, OnDestroy { - - public additional: FormGroup; - public formValue: object; - - public captchaKey: string; - private unsubscribe: Subject = new Subject(); - public contactMethod = ''; - private acceptableFileFormats = ['image/jpeg', 'image/jpg', 'image/png']; - public wrongFileType = false; - public attemptedToSubmit = false; - - public showshaftSecure = false; - public showjarleaking = false; - public showspinsmooth = false; - public currentlySubmitting = false; - public imageResizing = false; - - constructor(private storeService: StoreService, - private formBuilder: FormBuilder, - @Inject(APP_CONFIG) private config: AppConfig, - private imageResizerService: ImageResizerService, - private warrantiesService: WarrantiesService) { - this.captchaKey = config.captchaKey; - } - - formSubmitted(formData) { - this.currentlySubmitting = true; - return this.warrantiesService.post(new WarrantiesCommand(formData).toJSON()) - .then(() => { - this.currentlySubmitting = false; - this.storeService.passDisplayState(4); - }) - .catch(() => { - this.currentlySubmitting = false; - this.storeService.passDisplayState(1); - alert('Something went wrong with your application, please try again.'); - }); - } - - ngOnInit() { - this.createForm(); - } - - ngOnDestroy() { - this.unsubscribe.next(); - } - - checkIfErrorsShow(form: any): boolean { - for (const i in form['controls']) { - if (typeof form['controls'][i]['controls'] === 'object') { - if (this.checkIfErrorsShow(form['controls'][i])) { - return true; - } - } else { - if (this.checkIfElementIsErrored(form.controls[i])) { - return true; - } - } - } - return false; - } - - checkIfElementIsErrored(input: object): boolean { - if ((input['touched'] || this.attemptedToSubmit) && input['invalid']) { - return true; - } else { - return false; - } - } - - fileUpload(event, photoKey): void { - if (event.target.files && - event.target.files[0] && - event.target.files[0].name && - event.target.files[0].name.match(/.(jpg|jpeg|png|gif)$/i)) { - this.wrongFileType = false; - const self = this; - self.imageResizing = true; - this.imageResizerService.resizeImage(event.target.files[0], function(out) { - self.imageResizing = false; - if (out) { - const reader = new FileReader(); - reader.onload = function() { - self.additional.get(photoKey).setValue(reader.result); - }; - reader.readAsDataURL(out); - } else { - this.additional.get(photoKey).setValue(''); - } - }); - } else { - this.wrongFileType = true; - this.additional.get(photoKey).setValue(''); - } - } - - private createForm(): void { - if (this.storeService.storeForm['additional']) { - this.additional = this.storeService.storeForm['additional']; - } else { - this.additional = this.formBuilder.group({ - unusualSounds: ['', [Validators.required]], - shaftSecure: ['', []], - jarLeaking: ['', []], - spinSmooth: ['', []], - problemPhoto: [null, [Validators.required]] - }); - } - } - - changeRequire(): void { - if (this.additional.get('unusualSounds').value === 'yes') { - this.additional['controls']['spinSmooth'].setValidators(Validators.compose([Validators.required])); - this.additional['controls']['spinSmooth'].updateValueAndValidity(); - this.showspinsmooth = true; - - this.additional['controls']['shaftSecure'].setValidators(Validators.compose([])); - this.additional['controls']['shaftSecure'].updateValueAndValidity(); - this.showshaftSecure = false; - } - - if (this.additional.get('unusualSounds').value === 'no') { - this.additional['controls']['spinSmooth'].setValidators(Validators.compose([])); - this.additional['controls']['spinSmooth'].updateValueAndValidity(); - this.showspinsmooth = false; - this.additional['controls']['shaftSecure'].setValidators(Validators.compose([Validators.required])); - this.additional['controls']['shaftSecure'].updateValueAndValidity(); - this.showshaftSecure = true; - } - - if (this.additional.get('spinSmooth').value || this.additional.get('shaftSecure').value) { - this.additional['controls']['jarLeaking'].setValidators(Validators.compose([Validators.required])); - this.additional['controls']['jarLeaking'].updateValueAndValidity(); - this.showjarleaking = true; - } - } - - previousStep(): void { - this.storeService.passDisplayState(2); - } - - public onSubmit(): void { - if (!this.currentlySubmitting) { - this.storeService.storeForm['additional'] = this.additional; - this.attemptedToSubmit = true; - if (this.additional.valid) { - this.formSubmitted(this.storeService.storeForm); - } - } - - } - -} diff --git a/src/app/app.component.css b/src/app/app.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/app.component.html b/src/app/app.component.html deleted file mode 100644 index 6e6e8bd..0000000 --- a/src/app/app.component.html +++ /dev/null @@ -1,22 +0,0 @@ - diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts deleted file mode 100644 index b128f8c..0000000 --- a/src/app/app.component.spec.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { TestBed, async } from '@angular/core/testing'; -import { AppComponent } from './app.component'; -import { StoreService } from './services/store.service'; -import { Subscription } from 'rxjs/Subscription'; -import { MyDatePickerModule } from 'mydatepicker'; -import { NgPipesModule } from 'ngx-pipes'; -import { PersonalComponent } from './personal/personal.component'; -import { ProductComponent } from './product/product.component'; -import { AdditionalComponent } from './additional/additional.component'; -import { StateTrackerComponent } from './state-tracker/state-tracker.component'; -import { FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { CountrySelectComponent } from './directives/country-select/country-select.component'; -import { TranslateLoader, TranslateModule, TranslatePipe, TranslateService } from '@ngx-translate/core'; -import { WindowService } from './services/window.service'; -import { HttpClient, HttpClientModule } from '@angular/common/http'; -import { APP_CONFIG } from './config/app-config.module'; - -export function HttpLoaderFactory() { - return null; -} - -xdescribe('AppComponent', () => { - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ - AppComponent, - PersonalComponent, - ProductComponent, - AdditionalComponent, - StateTrackerComponent, - CountrySelectComponent - ], - imports: [ - FormsModule, - ReactiveFormsModule, - NgPipesModule, - MyDatePickerModule, - TranslateModule - ], - providers: [ - StoreService, - TranslatePipe, - { provide: TranslateService, useValue: {} }, - WindowService] - }).compileComponents(); - })); - it('should create the app', async(() => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; - expect(app).toBeTruthy(); - })); -}); diff --git a/src/app/app.component.ts b/src/app/app.component.ts deleted file mode 100644 index 723e5bc..0000000 --- a/src/app/app.component.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; -import { StoreService } from './services/store.service'; -import { Subscription } from 'rxjs/Subscription'; -import { TranslateService } from '@ngx-translate/core'; - -@Component({ - selector: 'app-root', - templateUrl: './app.component.html', - styleUrls: ['./app.component.css'] -}) -export class AppComponent implements OnInit, OnDestroy { - title = 'app'; - appStateSub: Subscription; - appState: number; - displayState: number; - testAppState: number; - defaultState = 1; - - constructor(private storeService: StoreService, - private translate: TranslateService) { - } - - ngOnInit() { - this.translate.setDefaultLang('en'); - this.translate.use('en'); - - this.appState = this.defaultState; - this.displayState = this.defaultState; - const self = this; - this.appStateSub = this.storeService.displayState$.subscribe( - data => { - self.appState = data; - }); - } - - ngOnDestroy() { - this.appStateSub.unsubscribe(); - } - - ngIncrementState(howMuch: number) { - if (this.appState + howMuch > 0 && this.appState + howMuch < 4 ) { - this.storeService.passNumState(this.appState + howMuch); - } - } - - setStateTest() { - this.storeService.passNumState(this.testAppState); - } -} diff --git a/src/app/app.module.ts b/src/app/app.module.ts deleted file mode 100644 index e7a446c..0000000 --- a/src/app/app.module.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { BrowserModule } from '@angular/platform-browser'; -import { NgModule, Inject } from '@angular/core'; - - -import { AppComponent } from './app.component'; -import { PersonalComponent } from './personal/personal.component'; -import { ProductComponent } from './product/product.component'; -import { AdditionalComponent } from './additional/additional.component'; -import { StoreService, GetAssetService, CountryService, RetailerService, WarrantiesService } from './services/'; -import { StateTrackerComponent } from './state-tracker/state-tracker.component'; -import { FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { NgHttpLoaderModule } from 'ng-http-loader/ng-http-loader.module'; -import { HttpClient, HttpClientModule } from '@angular/common/http'; -import { RecaptchaModule } from 'ng-recaptcha'; -import { AppConfigModule } from './config'; -import { NgPipesModule } from 'ngx-pipes'; -import { AppConfig } from './config/models/app-config.interface'; -import { APP_CONFIG } from './config/app-config.module'; -import { TranslateLoader, TranslateModule, TranslatePipe } from '@ngx-translate/core'; -import { CountrySelectComponent } from './directives/country-select/country-select.component'; -import { TranslateHttpLoader } from '@ngx-translate/http-loader'; -import { WindowService } from './services/window.service'; -import { ImageResizerService } from './services/image-resizer.service'; -import { SerialModalComponent } from './directives/serial-modal.component/serial-modal.component'; -import { MyDatePickerModule } from 'mydatepicker'; -import { Ng2ImgMaxModule } from 'ng2-img-max'; - -export function HttpLoaderFactory(http: HttpClient, config: AppConfig) { - return new TranslateHttpLoader(http, `${config.assets}/i18n/`, '.json'); -} - - -@NgModule({ - declarations: [ - AppComponent, - PersonalComponent, - ProductComponent, - AdditionalComponent, - StateTrackerComponent, - CountrySelectComponent, - SerialModalComponent - ], - imports: [ - AppConfigModule, - MyDatePickerModule, - BrowserModule, - FormsModule, - ReactiveFormsModule, - HttpClientModule, - NgHttpLoaderModule, - Ng2ImgMaxModule, - NgPipesModule, - RecaptchaModule.forRoot(), - TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useFactory: HttpLoaderFactory, - deps: [HttpClient, APP_CONFIG] - } - }) - - ], - providers: [StoreService, - FormBuilder, - GetAssetService, - TranslatePipe, - WindowService, - CountryService, - RetailerService, - WarrantiesService, - ImageResizerService], - bootstrap: [AppComponent] -}) -export class AppModule { } diff --git a/src/app/config/app-config.module.ts b/src/app/config/app-config.module.ts deleted file mode 100644 index 10fa32d..0000000 --- a/src/app/config/app-config.module.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { NgModule, InjectionToken } from '@angular/core'; -import { environment } from '../../environments/environment'; -import { AppConfig } from './models/app-config.interface'; - -export let APP_CONFIG = new InjectionToken('app.config'); - - -export const APP_DI_CONFIG: AppConfig = { - apiHost: environment.apiHost, - warrantiesEndPoint: environment.warrantiesEndPoint, - captchaKey: environment.captchaKey, - s3: environment.s3, - assets: environment.assets, - bucket: environment.bucket -}; - -@NgModule({ - providers: [ - {provide: APP_CONFIG, useValue: APP_DI_CONFIG} - ] -}) -export class AppConfigModule { } diff --git a/src/app/config/index.ts b/src/app/config/index.ts deleted file mode 100644 index bb5ee3a..0000000 --- a/src/app/config/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './app-config.module'; -export * from './models'; diff --git a/src/app/config/models/app-config.interface.ts b/src/app/config/models/app-config.interface.ts deleted file mode 100644 index f81c35e..0000000 --- a/src/app/config/models/app-config.interface.ts +++ /dev/null @@ -1,8 +0,0 @@ -export interface AppConfig { - apiHost: string; - warrantiesEndPoint: string; - captchaKey: string; - bucket: string; - assets: string; - s3: string; -} diff --git a/src/app/config/models/index.ts b/src/app/config/models/index.ts deleted file mode 100644 index 64ce33d..0000000 --- a/src/app/config/models/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './app-config.interface'; diff --git a/src/app/directives/country-select/country-select.component.css b/src/app/directives/country-select/country-select.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/directives/country-select/country-select.component.html b/src/app/directives/country-select/country-select.component.html deleted file mode 100644 index 262eb6d..0000000 --- a/src/app/directives/country-select/country-select.component.html +++ /dev/null @@ -1,30 +0,0 @@ -
{{'HEADING.CHOOSE_LANGUAGE' | translate}}
-
    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
diff --git a/src/app/directives/country-select/country-select.component.spec.ts b/src/app/directives/country-select/country-select.component.spec.ts deleted file mode 100644 index b4928f3..0000000 --- a/src/app/directives/country-select/country-select.component.spec.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CountrySelectComponent } from './country-select.component'; -import { TranslateModule, TranslateService } from '@ngx-translate/core'; -import { WindowService } from '../../services/window.service'; - -describe('CountrySelectComponent', () => { - let component: CountrySelectComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ CountrySelectComponent ], - imports: [TranslateModule], - providers: [ - WindowService, - {provide: TranslateService, useValue: {}} - ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CountrySelectComponent); - component = fixture.componentInstance; - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/directives/country-select/country-select.component.ts b/src/app/directives/country-select/country-select.component.ts deleted file mode 100644 index 30caa75..0000000 --- a/src/app/directives/country-select/country-select.component.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Component } from '@angular/core'; -import { WindowService } from '../../services/window.service'; -import { TranslateService } from '@ngx-translate/core'; - -@Component({ - selector: 'app-country-select', - templateUrl: './country-select.component.html', - styleUrls: ['./country-select.component.css'] -}) -export class CountrySelectComponent { - - - public baseImageLocation = ''; - - constructor(winRef: WindowService, private translate: TranslateService) { - if (winRef.nativeWindow.imageStorage) { - this.baseImageLocation = winRef.nativeWindow.imageStorage; - } - } - - public setLanguage(code: string): void { - this.translate.use(code); - } - -} diff --git a/src/app/directives/serial-modal.component/serial-modal.component.css b/src/app/directives/serial-modal.component/serial-modal.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/directives/serial-modal.component/serial-modal.component.html b/src/app/directives/serial-modal.component/serial-modal.component.html deleted file mode 100644 index 789c355..0000000 --- a/src/app/directives/serial-modal.component/serial-modal.component.html +++ /dev/null @@ -1,16 +0,0 @@ - -
-
-
-

{{'HEADING.SERIAL_WHERE' | translate}}

-

{{'HEADING.ALL_EXCEPT_725' | translate}}

-

{{'CONTENT.SERIAL_LOCATION_ALL' | translate}}

- -
-

{{'HEADING.DESIGNER_725' | translate}}

-

{{'CONTENT.SERIAL_LOCATION_725' | translate}}

- - -
-
-
diff --git a/src/app/directives/serial-modal.component/serial-modal.component.spec.ts b/src/app/directives/serial-modal.component/serial-modal.component.spec.ts deleted file mode 100644 index b9019c2..0000000 --- a/src/app/directives/serial-modal.component/serial-modal.component.spec.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { SerialModalComponent } from './serial-modal.component'; -import { TranslateModule, TranslateService } from '@ngx-translate/core'; - -describe('SerialModalComponent', () => { - let component: SerialModalComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ SerialModalComponent ], - providers: [ - { provide: TranslateService, useValue: {} }, - ], - imports: [TranslateModule], - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SerialModalComponent); - component = fixture.componentInstance; - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); - - describe('hide', () => { - - it('should set showing to false', () => { - component.hide(); - expect(component.showing).toBe(false); - }); - }); - - describe('show', () => { - it('should set showing to true', () => { - component.show(); - expect(component.showing).toBe(true); - }); - }); -}); diff --git a/src/app/directives/serial-modal.component/serial-modal.component.ts b/src/app/directives/serial-modal.component/serial-modal.component.ts deleted file mode 100644 index e4c60ff..0000000 --- a/src/app/directives/serial-modal.component/serial-modal.component.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-serial-modal', - templateUrl: './serial-modal.component.html', - styleUrls: ['./serial-modal.component.css'] -}) -export class SerialModalComponent { - - public showing: Boolean = false; - - public show(): void { - this.showing = true; - } - - public hide(): void { - this.showing = false; - } - -} diff --git a/src/app/models/address.interface.ts b/src/app/models/address.interface.ts deleted file mode 100644 index 4fe6475..0000000 --- a/src/app/models/address.interface.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface IAddress { - one: string; - two: string; - city: string; - stateProvince: string; - zip: string; - country: string; - email: string; - phone: string; -} diff --git a/src/app/models/contact.interface.ts b/src/app/models/contact.interface.ts deleted file mode 100644 index 216f88d..0000000 --- a/src/app/models/contact.interface.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface IContact { - contactMethod: string; - contactTime: string; -} diff --git a/src/app/models/country.interface.ts b/src/app/models/country.interface.ts deleted file mode 100644 index 6dec79e..0000000 --- a/src/app/models/country.interface.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface ICountry { - name: string; - code: string; -} diff --git a/src/app/models/date.interface.ts b/src/app/models/date.interface.ts deleted file mode 100644 index dfc18f7..0000000 --- a/src/app/models/date.interface.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface Date { - date: { - year: number; - month: number; - day: number; - }; - jsdate: string; - formatted: string; - epoc: number; -} diff --git a/src/app/models/index.ts b/src/app/models/index.ts deleted file mode 100644 index f8d3c40..0000000 --- a/src/app/models/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './address.interface'; -export * from './country.interface'; -export * from './purchase.interface'; -export * from './retailer.interface'; -export * from './serial.interface'; -export * from './state.interface'; -export * from './personal.interface'; diff --git a/src/app/models/personal.interface.ts b/src/app/models/personal.interface.ts deleted file mode 100644 index ef1f9c9..0000000 --- a/src/app/models/personal.interface.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { IAddress } from './address.interface'; -import { ISerial } from './serial.interface'; -import { IPurchase } from './purchase.interface'; -import { IContact } from './contact.interface'; - -export interface IPersonal { - firstName: string; - lastName: string; - address: IAddress; - serial: ISerial; - contact: IContact; - purchase: IPurchase; - receiptPhoto: string; -} diff --git a/src/app/models/purchase.interface.ts b/src/app/models/purchase.interface.ts deleted file mode 100644 index 94e3255..0000000 --- a/src/app/models/purchase.interface.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Date } from './date.interface'; - -export interface IPurchase { - place: string; - other: string; - date: Date; -} diff --git a/src/app/models/retailer.interface.ts b/src/app/models/retailer.interface.ts deleted file mode 100644 index b58424a..0000000 --- a/src/app/models/retailer.interface.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface IRetailer { - id: string; - name: string; -} diff --git a/src/app/models/serial.interface.ts b/src/app/models/serial.interface.ts deleted file mode 100644 index 6cf1e29..0000000 --- a/src/app/models/serial.interface.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface ISerial { - prefix: string; - suffix: string; -} diff --git a/src/app/models/state.interface.ts b/src/app/models/state.interface.ts deleted file mode 100644 index a5e211c..0000000 --- a/src/app/models/state.interface.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface IState { - short: string; - name: string; - country: string; - alt: string[]; - region: string; -} diff --git a/src/app/models/warranties.command.ts b/src/app/models/warranties.command.ts deleted file mode 100644 index d96ef2d..0000000 --- a/src/app/models/warranties.command.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { IAddress } from './address.interface'; -import { ISerial } from './serial.interface'; -import { IPurchase } from './purchase.interface'; - -export class WarrantiesCommand { - - formData: any; - - constructor(formData: any) { - this.formData = formData; - } - - public toJSON() { - return { - 'firstName': this.formData.personal.value.firstName, - 'lastName': this.formData.personal.value.lastName, - 'street': this.formData.personal.value.address.one + ' ' + this.formData.personal.value.address.two, - 'city': this.formData.personal.value.address.city, - 'state': this.formData.personal.value.address.stateProvince, - 'zipCode': this.formData.personal.value.address.zip, - 'country': this.formData.personal.value.address.country, - 'phoneNumber': this.formData.personal.value.address.phone, - 'emailAddress': this.formData.personal.value.address.email, - 'contactMethod': this.formData.personal.value.contact.contactMethod, - 'contactTime': this.formData.personal.value.contact.contactTime, - 'timeZone': this.formData.personal.value.contact.timeZone, - 'serialNumber': this.formData.product.value.motorSerial.serialPrefix + - '-' + - this.formData.product.value.motorSerial.serialSuffix, - 'jarSize': this.formData.product.value.jar.jarSize, - 'jarNumber': this.formData.product.value.jar.jarNumber, - 'jarNumberImage': this.formData.product.value.jar.jarPhoto || '', - 'description': this.formData.product.value.problemDescription, - 'whichProblem': this.formData.product.value.problemType, - 'hasUnusualSounds': this.formData.additional.value.unusualSounds, - 'isSmoothSpinning': this.formData.additional.value.spinSmooth, - 'isShaftSecure': this.formData.additional.value.shaftSecure, - 'isLeakingJar': this.formData.additional.value.jarLeaking, - 'purchasePlace': this.formData.personal.value.purchase.place, - 'howToOwn': '', - 'purchaseOther': this.formData.personal.value.purchase.other, - 'purchaseDate': new Date(this.formData.personal.value.purchase.date.formatted) - .toISOString(), - 'serialImage': this.formData.product.value.motorSerial.serialPhoto || '', - 'problemImage': this.formData.additional.value.problemPhoto || '' , - 'receiptImage': this.formData.personal.value.receiptPhoto || '', - 'recaptcha': this.formData.additional.value.recaptcha - }; - } -} - diff --git a/src/app/personal/personal.component.css b/src/app/personal/personal.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/personal/personal.component.html b/src/app/personal/personal.component.html deleted file mode 100644 index 9b73e5c..0000000 --- a/src/app/personal/personal.component.html +++ /dev/null @@ -1,246 +0,0 @@ -
-

Personal Information

-

First, Tell us about yourself

-

We need this information so we know how to get back with you. We keep all of this strictly confidential.

-

*Please note that photos will be required of the items and issues you are experiencing. If these cannot be attached to this claim, we ask that you call or chat with Customer Care to place your claim. Customer Care is available at 1-800-748-5400 or through the Live Chat (M-F, 7am-6pm MST)

- -
- -
-
    -
  • - First Name -
  • -
  • - Last Name -
  • -
  • - Address is required -
  • -
  • - City is required -
  • -
  • - Zipcode is required -
  • -
  • - Country is required -
  • -
  • - State is required -
  • -
  • - Valid Email is required -
  • -
  • - Purchase Date is required -
  • -
  • - Contact Method is required -
  • -
  • - Receipt Photo is required -
  • -
  • - Contact Time is required -
  • -
  • - Time Zone is required -
  • -
-
-
- - -
-
- - - -
-
- - -
-
- - -
- - - -
-
- - -
-
- - -
-
- -
-
- - -
-
- - -
-
- - - - - - - - - -
- -
-
-
- -
- - - -
-
-
- -
- - - - - -
-
-
- -
- -
-
- -
- - - - - - -
- -
-
- If you still have the receipt would you please upload a picture of it? -
-
- -
-
- -
- -
- - -
- -
- -
diff --git a/src/app/personal/personal.component.spec.ts b/src/app/personal/personal.component.spec.ts deleted file mode 100644 index f3a5159..0000000 --- a/src/app/personal/personal.component.spec.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { StoreService, GetAssetService, RetailerService } from '../services/'; -import { TranslateLoader, TranslateModule, TranslatePipe, TranslateService } from '@ngx-translate/core'; -import { FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { MyDatePickerModule } from 'mydatepicker'; -import { NgPipesModule } from 'ngx-pipes'; -import { CountryService } from '../services/'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { HttpClientModule } from '@angular/common/http'; -import { APP_CONFIG, AppConfigModule } from '../config/app-config.module'; -import { CountrySelectComponent } from '../directives/country-select/country-select.component'; -import { SerialModalComponent } from '../directives/serial-modal.component/serial-modal.component'; -import { APP_BASE_HREF } from '@angular/common'; -import 'rxjs/add/observable/of'; -import { Observable } from 'rxjs/Observable'; -import { ImageResizerService } from '../services/image-resizer.service'; - -import { PersonalComponent } from './personal.component'; - -xdescribe('PersonalComponent', () => { - - const assetSvcMock = jasmine.createSpyObj('GetAssetService', ['getAll$']); - assetSvcMock.getAll$.and.returnValue(Observable.of([])); - - const countrySvcMock = jasmine.createSpyObj('CountryService', ['getAll$']); - countrySvcMock.getAll$.and.returnValue(Observable.of([])); - - const retailerSvcMock = jasmine.createSpyObj('RetailerService', ['getAll$']); - retailerSvcMock.getAll$.and.returnValue(Observable.of([])); - - let component: PersonalComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [PersonalComponent, CountrySelectComponent], - imports: [ - AppConfigModule, - FormsModule, - HttpClientModule, - MyDatePickerModule, - NgPipesModule, - ReactiveFormsModule, - TranslateModule - ], - providers: [ - FormBuilder, - StoreService, - ImageResizerService, - {provide: RetailerService, useValue: retailerSvcMock}, - {provide: CountryService, useValue: countrySvcMock}, - {provide: GetAssetService, useValue: assetSvcMock}, - {provide: TranslateService, useValue: {} }, - {provide: APP_BASE_HREF, useValue: '/'}, - {provide: APP_CONFIG, useValue: {s3: 's3Url', captchaKey: 'testKey'}} - ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PersonalComponent); - component = fixture.componentInstance; - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/personal/personal.component.ts b/src/app/personal/personal.component.ts deleted file mode 100644 index f09e4ba..0000000 --- a/src/app/personal/personal.component.ts +++ /dev/null @@ -1,177 +0,0 @@ -import { Component, Inject, OnInit, OnDestroy } from '@angular/core'; -import { StoreService, GetAssetService, CountryService, RetailerService } from '../services/'; -import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms'; -import 'rxjs/add/operator/takeUntil'; -import 'rxjs/add/observable/throw'; -import { Subscription } from 'rxjs/Subscription'; -import { OtherPurchasePlaceValidator, StatesValidator } from '../validators/'; -import { Subject } from 'rxjs/Subject'; -import { Observable } from 'rxjs/Observable'; -import { APP_CONFIG, AppConfig } from '../config'; -import { ICountry, IPersonal, IState } from '../models'; -import { ImageResizerService } from '../services/image-resizer.service'; - -@Component({ - selector: 'app-personal', - templateUrl: './personal.component.html', - styleUrls: ['./personal.component.css'] -}) -export class PersonalComponent implements OnInit, OnDestroy { - - public personal: FormGroup; - public retailers$: Observable; - public countries$: Observable; - public states$: Observable; - public timeZones$: Observable; - public formValue: object; - public dateOptions: any = { - dateFormat: 'mm-dd-yyyy', - indicateInvalidDate: true, - showClearDateBtn: false - }; - public captchaKey: string; - private unsubscribe: Subject = new Subject(); - public contactMethod = ''; - private acceptableFileFormats = ['image/jpeg', 'image/jpg', 'image/png']; - public wrongFileType = false; - public dynamicRepeatValue: any; - public imageResizing = false; - - public isFormValid = false; - public attemptedToSubmit = false; - - constructor(private storeService: StoreService, - private formBuilder: FormBuilder, - private countryService: CountryService, - private getState: GetAssetService, - private retailerService: RetailerService, - private getTimeZones: GetAssetService, - private imageResizerService: ImageResizerService, - @Inject(APP_CONFIG) private config: AppConfig) { - - this.retailers$ = retailerService.getAll$(); - this.countries$ = countryService.getAll$(); - this.states$ = getState.getAll$('states.json'); - this.timeZones$ = getTimeZones.getAll$('time-zones.json'); - } - - formSubmitted(value) { - console.log(value); - } - - ngOnInit() { - this.createForm(); - } - - ngOnDestroy() { - this.unsubscribe.next(); - } - - diffState(state: number): void { - this.storeService.passNumState(state); - } - - checkIfErrored(): boolean { - return true; - } - - checkIfErrorsShow(form: any): boolean { - for (const i in form['controls']) { - if (typeof form['controls'][i]['controls'] === 'object') { - if (this.checkIfErrorsShow(form['controls'][i])) { - return true; - } - } else { - if (this.checkIfElementIsErrored(form.controls[i])) { - return true; - } - } - } - return false; - } - - - checkIfElementIsErrored(input: object): boolean { - if ((input['touched'] || this.attemptedToSubmit) && input['invalid']) { - return true; - } else { - return false; - } - } - - fileUpload(event): void { - if (event.target.files && - event.target.files[0] && - event.target.files[0].name && - event.target.files[0].name.match(/.(jpg|jpeg|png|gif)$/i)) { - this.wrongFileType = false; - const self = this; - this.imageResizing = true; - this.imageResizerService.resizeImage(event.target.files[0], function(out) { - self.imageResizing = false; - if (out) { - const reader = new FileReader(); - reader.onload = function() { - self.personal.get('receiptPhoto').setValue(reader.result); - }; - reader.readAsDataURL(out); - } else { - this.personal.get('receiptPhoto').setValue({}); - } - }); - } else { - this.wrongFileType = true; - this.personal.get('receiptPhoto').setValue({}); - } - } - - private createForm(): void { - if (this.storeService.storeForm['personal']) { - this.personal = this.storeService.storeForm['personal']; - } else { - this.personal = this.formBuilder.group({ - firstName: ['', [Validators.required]], - lastName: ['', [Validators.required]], - address: this.formBuilder.group({ - one: ['', [Validators.required]], - two: ['', []], - city: ['', [Validators.required]], - zip: ['', [Validators.required]], - country: ['US', [Validators.required]], - stateProvince: ['', []], - email: ['', [Validators.required, Validators.email]], - phone: ['', [Validators.required]] - }), - contact: this.formBuilder.group({ - contactMethod: ['', [Validators.required]], - contactTime: ['', [Validators.required]], - timeZone: ['', [Validators.required]] - }), - purchase: this.formBuilder.group({ - place: ['', [Validators.required]], - other: ['', []], - date: ['', [Validators.required]] - }, {validator: OtherPurchasePlaceValidator}), - receiptPhoto: ['', []] - }); - } - - this.personal.get('address.stateProvince').setAsyncValidators(StatesValidator.createValidator(this.getState)); - - this.personal - .get('address.country') - .valueChanges - .takeUntil(this.unsubscribe) - .subscribe(() => this.personal.get('address.stateProvince').updateValueAndValidity()); - } - - - public onSubmit(): void { - this.storeService.storeForm['personal'] = this.personal; - this.attemptedToSubmit = true; - if (this.personal.valid) { - this.storeService.passDisplayState(2); - } - } - -} diff --git a/src/app/product/product.component.css b/src/app/product/product.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/product/product.component.html b/src/app/product/product.component.html deleted file mode 100644 index fb82b01..0000000 --- a/src/app/product/product.component.html +++ /dev/null @@ -1,193 +0,0 @@ -
-
-
- - -
- - -
- -
-
-
-
- -
-
-
- - -
- - -
- -
-
-
-
-
-

PRODUCT INFORMATION

-

Next, tell us about your problem.

- -
- -
-
    -
  • - Select your problem -
  • -
  • - Serial Prefix is required -
  • -
  • - Serial Suffix is required -
  • -
  • - Please upload a photo of the motor serial number. Make sure that the image is either a jpg, png, or gif. -
  • -
  • - Jar size is required -
  • -
  • - Jar number is required -
  • -
  • - Please upload a photo of the jar number. Make sure that the image is either a jpg, png, or gif. -
  • -
  • - Please describe your problem -
  • -
-
-
- -
- -
-
- -
-
- -
-
- -
-
- -
-
-
- Motor Serial Number -
-
- - -
-
-
-
- - -
-
-
-
-
- -
-
- - -
-
-
-
- -
{{jar.name}}
-
-
-
-
-
-
-
-
- - -
-
- -
-
-
- -
- -
-
-
-
-
Describe your blender's issue(s). Please be as descriptive as possible:
- -
You have {{textAreaLength-product.get('problemDescription').value.length}} characters available.
-
-
-
- - -
- - -
- -
- -
\ No newline at end of file diff --git a/src/app/product/product.component.spec.ts b/src/app/product/product.component.spec.ts deleted file mode 100644 index d5bc4ec..0000000 --- a/src/app/product/product.component.spec.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { StoreService } from '../services/store.service'; - -import { ProductComponent } from './product.component'; - -xdescribe('ProductComponent', () => { - let component: ProductComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ProductComponent ], - providers: [ StoreService ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ProductComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/product/product.component.ts b/src/app/product/product.component.ts deleted file mode 100644 index 14c482b..0000000 --- a/src/app/product/product.component.ts +++ /dev/null @@ -1,170 +0,0 @@ -import { Component, Inject, OnInit, OnDestroy } from '@angular/core'; -import { StoreService, GetAssetService, CountryService, RetailerService } from '../services/'; -import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms'; -import 'rxjs/add/operator/takeUntil'; -import 'rxjs/add/observable/throw'; -import { Subscription } from 'rxjs/Subscription'; -import { OtherPurchasePlaceValidator, StatesValidator } from '../validators/'; -import { Subject } from 'rxjs/Subject'; -import { Observable } from 'rxjs/Observable'; -import { APP_CONFIG, AppConfig } from '../config'; -import { ICountry, IState } from '../models'; -import { ImageResizerService } from '../services/image-resizer.service'; - -@Component({ - selector: 'app-product', - templateUrl: './product.component.html', - styleUrls: ['./product.component.css'] -}) -export class ProductComponent implements OnInit, OnDestroy { - - public product: FormGroup; - public formValue: object; - - public captchaKey: string; - private unsubscribe: Subject = new Subject(); - public contactMethod = ''; - private acceptableFileFormats = ['image/jpeg', 'image/jpg', 'image/png']; - public wrongFileType = false; - public dynamicRepeatValue: any; - public jars$: Observable; - public isFormValid = false; - public attemptedToSubmit = false; - public textAreaLength = 500; - public explainSerialMotor = false; - public explainSerialJar = false; - public imageResizing = false; - - constructor(private storeService: StoreService, - private formBuilder: FormBuilder, - private jarInfo: GetAssetService, - private imageResizerService: ImageResizerService, - @Inject(APP_CONFIG) private config: AppConfig) { - - this.jars$ = jarInfo.getAll$('jars.json'); - } - - ngOnInit() { - this.createForm(); - } - - ngOnDestroy() { - this.unsubscribe.next(); - } - - diffState(state: number): void { - this.storeService.passNumState(state); - } - - checkIfErrored(): boolean { - return true; - } - - checkIfErrorsShow(form: any): boolean { - for (const i in form['controls']) { - if (typeof form['controls'][i]['controls'] === 'object') { - if (this.checkIfErrorsShow(form['controls'][i])) { - return true; - } - } else { - if (this.checkIfElementIsErrored(form.controls[i])) { - return true; - } - } - } - return false; - } - - checkIfElementIsErrored(input: object): boolean { - if ((input['touched'] || this.attemptedToSubmit) && input['invalid']) { - return true; - } else { - return false; - } - } - - fileUpload(event, photoKey): void { - if (event.target.files && - event.target.files[0] && - event.target.files[0].name && - event.target.files[0].name.match(/.(jpg|jpeg|png|gif)$/i)) { - this.wrongFileType = false; - const self = this; - self.imageResizing = true; - this.imageResizerService.resizeImage(event.target.files[0], function(out) { - self.imageResizing = false; - if (out) { - const reader = new FileReader(); - reader.onload = function() { - self.product.get(photoKey).setValue(reader.result); - }; - reader.readAsDataURL(out); - } else { - this.product.get(photoKey).setValue({}); - } - }); - } else { - this.wrongFileType = true; - this.product.get(photoKey).setValue({}); - } - } - - private createForm(): void { - if (this.storeService.storeForm['product']) { - this.product = this.storeService.storeForm['product']; - } else { - this.product = this.formBuilder.group({ - problemType: ['', [Validators.required]], - motorSerial: this.formBuilder.group({ - serialPrefix: ['', [Validators.required]], - serialSuffix: ['', [Validators.required]], - serialPhoto: [null, [Validators.required]] - }), - jar: this.formBuilder.group({ - jarSize: ['', []], - jarNumber: ['', []], - jarPhoto: [null, []] - }), - problemDescription: ['', [Validators.required]] - }); - } - } - - requireJars(): void { - // this.registration.get('address.stateProvince').setAsyncValidators(StatesValidator.createValidator(this.stateService)); - if ((this.product.get('problemType').value === 'jar' || this.product.get('problemType').value === 'both') && - this.product['controls'] && - this.product['controls']['jar'] && - this.product['controls']['jar']['controls']) { - this.product['controls']['jar']['controls']['jarNumber'].setValidators(Validators.compose([Validators.required])); - this.product['controls']['jar']['controls']['jarNumber'].updateValueAndValidity(); - this.product['controls']['jar']['controls']['jarSize'].setValidators(Validators.compose([Validators.required])); - this.product['controls']['jar']['controls']['jarSize'].updateValueAndValidity(); - this.product['controls']['jar']['controls']['jarPhoto'].setValidators(Validators.compose([Validators.required])); - this.product['controls']['jar']['controls']['jarPhoto'].updateValueAndValidity(); - } else if (!(this.product.get('problemType').value === 'jar' || this.product.get('problemType').value === 'both') && - this.product['controls'] && - this.product['controls']['jar'] && - this.product['controls']['jar']['controls']) { - this.product['controls']['jar']['controls']['jarNumber'].setValidators(Validators.compose([])); - this.product['controls']['jar']['controls']['jarNumber'].updateValueAndValidity(); - this.product['controls']['jar']['controls']['jarSize'].setValidators(Validators.compose([])); - this.product['controls']['jar']['controls']['jarSize'].updateValueAndValidity(); - this.product['controls']['jar']['controls']['jarPhoto'].setValidators(Validators.compose([])); - this.product['controls']['jar']['controls']['jarPhoto'].updateValueAndValidity(); - } - } - - previousStep(): void { - this.storeService.passDisplayState(1); - } - - public onSubmit(): void { - this.storeService.storeForm['product'] = this.product; - this.attemptedToSubmit = true; - if (this.product.valid) { - this.storeService.passDisplayState(3); - } - } - -} diff --git a/src/app/services/country.service.spec.ts b/src/app/services/country.service.spec.ts deleted file mode 100644 index 1c0499e..0000000 --- a/src/app/services/country.service.spec.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { TestBed } from '@angular/core/testing'; -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; - -import { CountryService } from './country.service'; -import { AppConfigModule } from '../config'; - - -describe('CountryService', () => { - - let service: CountryService; - let httpMock: HttpTestingController; - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule, - AppConfigModule, - ], - providers: [ - CountryService - ] - }); - - service = TestBed.get(CountryService); - httpMock = TestBed.get(HttpTestingController); - }); - - it('should be created', () => { - - expect(service).toBeTruthy(); - }); - - it('should get countries', (done) => { - service.getAll$() - .subscribe(res => { - expect(res).toEqual( - [ - {name: 'United States', code: 'US'}, - {name: 'Canada', code: 'CA'} - ] - ); - done(); - }); - - const request = httpMock.expectOne('https://s3-us-west-1.amazonaws.com/data.blendtec.com/countries.json'); - request.flush([ - {name: 'United States', code: 'US'}, - {name: 'Canada', code: 'CA'} - ]); - - - httpMock.verify(); - }); -}); - - diff --git a/src/app/services/country.service.ts b/src/app/services/country.service.ts deleted file mode 100644 index b2fea52..0000000 --- a/src/app/services/country.service.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Inject, Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; -import { ICountry } from '../models/country.interface'; -import { HttpClient } from '@angular/common/http'; -import { APP_CONFIG, AppConfig } from '../config'; - -@Injectable() -export class CountryService { - - private _resource = 'countries.json'; - - constructor(private http: HttpClient, @Inject(APP_CONFIG) private config: AppConfig) {} - - public getAll$(): Observable { - return this.http.get(`${this.config.s3}/${this._resource}`); - } -} diff --git a/src/app/services/get-asset.service.spec.ts b/src/app/services/get-asset.service.spec.ts deleted file mode 100644 index ff8616f..0000000 --- a/src/app/services/get-asset.service.spec.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { TestBed } from '@angular/core/testing'; -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; - -import { GetAssetService } from './get-asset.service'; -import { AppConfigModule } from '../config'; -import { IState } from '../models'; - - -describe('GetAssetService', () => { - - let getAssetService: GetAssetService; - let httpMock: HttpTestingController; - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule, - AppConfigModule - ], - providers: [ - GetAssetService - ] - }); - - getAssetService = TestBed.get(GetAssetService); - httpMock = TestBed.get(HttpTestingController); - }); - - it('should be created', () => { - - expect(getAssetService).toBeTruthy(); - }); - -}); - - diff --git a/src/app/services/get-asset.service.ts b/src/app/services/get-asset.service.ts deleted file mode 100644 index 421184f..0000000 --- a/src/app/services/get-asset.service.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Inject, Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; -import { IState } from '../models/state.interface'; -import { HttpClient } from '@angular/common/http'; -import { APP_CONFIG, AppConfig } from '../config'; - -@Injectable() -export class GetAssetService { - - - constructor(private http: HttpClient, @Inject(APP_CONFIG) private config: AppConfig) { - } - - public getAll$(resource: string): Observable { - return this.http.get(`${this.config.s3}/${resource}`); - } -} diff --git a/src/app/services/image-resizer.service.spec.ts b/src/app/services/image-resizer.service.spec.ts deleted file mode 100644 index d52397f..0000000 --- a/src/app/services/image-resizer.service.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { TestBed, inject } from '@angular/core/testing'; - -import { ImageResizerService } from './image-resizer.service'; - -xdescribe('ImageResizerService', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [ImageResizerService] - }); - }); - - it('should be created', inject([ImageResizerService], (service: ImageResizerService) => { - expect(service).toBeTruthy(); - })); -}); diff --git a/src/app/services/image-resizer.service.ts b/src/app/services/image-resizer.service.ts deleted file mode 100644 index 8447e99..0000000 --- a/src/app/services/image-resizer.service.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Ng2ImgMaxService } from 'ng2-img-max'; - -@Injectable() -export class ImageResizerService { - - constructor(private ng2ImgMax: Ng2ImgMaxService) { } - - resizeImage(image, callback) { - this.ng2ImgMax.resizeImage(image, 800, 800).subscribe( - result => { - callback(result); - }, - error => { - callback(false); - } - ); - } - -} diff --git a/src/app/services/index.ts b/src/app/services/index.ts deleted file mode 100644 index 9bfdbf2..0000000 --- a/src/app/services/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './country.service'; -export * from './retailer.service'; -export * from './store.service'; -export * from './get-asset.service'; -export * from './window.service'; -export * from './warranties.service'; diff --git a/src/app/services/retailer.service.spec.ts b/src/app/services/retailer.service.spec.ts deleted file mode 100644 index dd21c39..0000000 --- a/src/app/services/retailer.service.spec.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { TestBed } from '@angular/core/testing'; -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; - -import { RetailerService } from './retailer.service'; -import { AppConfigModule } from '../config'; - - -describe('RetailerService', () => { - - let service: RetailerService; - let httpMock: HttpTestingController; - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule, - AppConfigModule, - ], - providers: [ - RetailerService - ] - }); - - service = TestBed.get(RetailerService); - httpMock = TestBed.get(HttpTestingController); - }); - - it('should be created', () => { - - expect(service).toBeTruthy(); - }); - - it('should get retailers', (done) => { - service.getAll$() - .subscribe(res => { - expect(res).toEqual( - [ - {name: 'Best Buy', id: 'bestbuy' }, - {name: 'Blendtec.com', id: 'blendteccom'} - ] - ); - done(); - }); - - const request = httpMock.expectOne('https://s3-us-west-1.amazonaws.com/data.blendtec.com/retailers.json'); - request.flush([ - {name: 'Best Buy', id: 'bestbuy' }, - {name: 'Blendtec.com', id: 'blendteccom'} - ]); - - - httpMock.verify(); - }); -}); - - diff --git a/src/app/services/retailer.service.ts b/src/app/services/retailer.service.ts deleted file mode 100644 index ec19dba..0000000 --- a/src/app/services/retailer.service.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Inject, Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; -import { HttpClient } from '@angular/common/http'; -import { APP_CONFIG, AppConfig } from '../config'; -import { IRetailer } from '../models/retailer.interface'; - -@Injectable() -export class RetailerService { - - private _resource = 'retailers.json'; - - constructor(private http: HttpClient, @Inject(APP_CONFIG) private config: AppConfig) {} - - public getAll$(): Observable { - return this.http.get(`${this.config.s3}/${this._resource}`); - } -} diff --git a/src/app/services/store.service.spec.ts b/src/app/services/store.service.spec.ts deleted file mode 100644 index fb307b5..0000000 --- a/src/app/services/store.service.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { TestBed, inject } from '@angular/core/testing'; - -import { StoreService } from './store.service'; - -describe('StoreService', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [StoreService] - }); - }); - - it('should be created', inject([StoreService], (service: StoreService) => { - expect(service).toBeTruthy(); - })); -}); diff --git a/src/app/services/store.service.ts b/src/app/services/store.service.ts deleted file mode 100644 index 0a57c19..0000000 --- a/src/app/services/store.service.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Observable } from 'rxjs/Observable'; -import { Injectable } from '@angular/core'; -import { Subject } from 'rxjs/Subject'; - -@Injectable() -export class StoreService { - storeForm: any; - storeFormData: any; - retrieveLanguage$: Observable; - retrieveState$: Observable; - displayState$: Observable; - retrieveNumState$: Observable; - - private language = new Subject(); - private state = new Subject(); - private displayState = new Subject(); - private numState = new Subject(); - - constructor() { - this.language.next('en'); - this.retrieveLanguage$ = this.language.asObservable(); - this.retrieveState$ = this.state.asObservable(); - this.displayState$ = this.displayState.asObservable(); - this.retrieveNumState$ = this.numState.asObservable(); - this.storeForm = {}; - this.storeFormData = {}; - } - - passLanguage(data: string) { - this.language.next(data); - } - - getLanguage() { - return this.language.asObservable(); - } - - passState(data: string) { - this.state.next(data); - } - - passDisplayState(data: number) { - this.displayState.next(data); - } - - passNumState(data: number) { - this.numState.next(data); - } - - getState() { - return this.state.asObservable(); - } - -} diff --git a/src/app/services/warranties.service.spec.ts b/src/app/services/warranties.service.spec.ts deleted file mode 100644 index 0068641..0000000 --- a/src/app/services/warranties.service.spec.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { TestBed } from '@angular/core/testing'; -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; - -import { WarrantiesService } from './warranties.service'; -import { AppConfigModule } from '../config'; - -describe('WarrantiesService', () => { - - let requestService: WarrantiesService; - let httpMock: HttpTestingController; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule, - AppConfigModule - ], - providers: [ - WarrantiesService - ] - }); - - requestService = TestBed.get(WarrantiesService); - httpMock = TestBed.get(HttpTestingController); - }); - - it('should be created', () => { - - expect(requestService).toBeTruthy(); - }); -}); diff --git a/src/app/services/warranties.service.ts b/src/app/services/warranties.service.ts deleted file mode 100644 index 1dde042..0000000 --- a/src/app/services/warranties.service.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Inject, Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import 'rxjs/add/operator/toPromise'; -import { APP_CONFIG, AppConfig } from '../config'; - -@Injectable() -export class WarrantiesService { - - constructor(private http: HttpClient, @Inject(APP_CONFIG) private config: AppConfig) { } - - post(command: any): Promise { - return this.http.post(`${this.config.apiHost}${this.config.warrantiesEndPoint}`, command, {responseType: 'text'}).toPromise(); - } -} diff --git a/src/app/services/window.service.spec.ts b/src/app/services/window.service.spec.ts deleted file mode 100644 index c314f3c..0000000 --- a/src/app/services/window.service.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { TestBed, inject } from '@angular/core/testing'; -import { WindowService } from './window.service'; - -describe('WindowService', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [WindowService] - }); - }); - - it('should be created', inject([WindowService], (service: WindowService) => { - expect(service) - .toBeTruthy(); - })); -}); diff --git a/src/app/services/window.service.ts b/src/app/services/window.service.ts deleted file mode 100644 index 3550104..0000000 --- a/src/app/services/window.service.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Injectable } from '@angular/core'; - -function _window(): any { - - return window; -} - -@Injectable() -export class WindowService { - get nativeWindow(): any { - return _window(); - } -} diff --git a/src/app/state-tracker/state-tracker.component.css b/src/app/state-tracker/state-tracker.component.css deleted file mode 100644 index 2a7aeb2..0000000 --- a/src/app/state-tracker/state-tracker.component.css +++ /dev/null @@ -1,6 +0,0 @@ -.colorInSVG { - fill: #ED1B2C; -} -.opacityInSVG { - opacity: .5; -} \ No newline at end of file diff --git a/src/app/state-tracker/state-tracker.component.html b/src/app/state-tracker/state-tracker.component.html deleted file mode 100644 index e505735..0000000 --- a/src/app/state-tracker/state-tracker.component.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/src/app/state-tracker/state-tracker.component.spec.ts b/src/app/state-tracker/state-tracker.component.spec.ts deleted file mode 100644 index feae805..0000000 --- a/src/app/state-tracker/state-tracker.component.spec.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { StoreService } from '../services/store.service'; - -import { StateTrackerComponent } from './state-tracker.component'; - -describe('StateTrackerComponent', () => { - let component: StateTrackerComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ StateTrackerComponent ], - providers: [ StoreService ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(StateTrackerComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/state-tracker/state-tracker.component.ts b/src/app/state-tracker/state-tracker.component.ts deleted file mode 100644 index bf5a375..0000000 --- a/src/app/state-tracker/state-tracker.component.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; -import { StoreService } from '../services/store.service'; -import { Subscription } from 'rxjs/Subscription'; - -@Component({ - selector: 'ngx-state-tracker', - templateUrl: './state-tracker.component.html', - styleUrls: ['./state-tracker.component.css'] -}) -export class StateTrackerComponent implements OnInit, OnDestroy { - title = 'app'; - appStateSub: Subscription; - appState: number; - defaultState = 1; - displayState: number; - - constructor(private storeService: StoreService) { - } - - ngOnInit(): void { - - this.displayState = this.defaultState; - this.appState = this.defaultState; - const self = this; - this.appStateSub = this.storeService.displayState$ - .subscribe(data => self.appState = data); - } - - ngOnDestroy(): void { - this.appStateSub.unsubscribe(); - } - -} diff --git a/src/app/validators/captcha.validator.ts b/src/app/validators/captcha.validator.ts deleted file mode 100644 index 2f992d5..0000000 --- a/src/app/validators/captcha.validator.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { AbstractControl } from '@angular/forms'; - -export function RecaptchaValidator(control: AbstractControl): object | null { - if (!control.value) { - return { resolved: true }; - } - - return null; -} diff --git a/src/app/validators/has-states.validator.ts b/src/app/validators/has-states.validator.ts deleted file mode 100644 index b46d24a..0000000 --- a/src/app/validators/has-states.validator.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Injectable } from '@angular/core'; -import { AbstractControl } from '@angular/forms'; -import { GetAssetService } from '../services'; -import 'rxjs/add/operator/map'; -import { Observable } from 'rxjs/Observable'; -import { IState } from '../models'; - -@Injectable() -export class StatesValidator { - - static createValidator(stateService: GetAssetService): (control: AbstractControl) => Observable<{[key: string]: boolean}> { - - return (control: AbstractControl): Observable<{[key: string]: boolean}> => { - const country = control.parent.get('country').value; - - return stateService - .getAll$('states.json') - .map(states => states.some(state => state.country === country) && !control.value ? {required: true} : null); - } - ; - } -} diff --git a/src/app/validators/index.ts b/src/app/validators/index.ts deleted file mode 100644 index 23c9598..0000000 --- a/src/app/validators/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './other-purchase.validator'; -export * from './has-states.validator'; -export * from './captcha.validator'; diff --git a/src/app/validators/other-purchase.validator.ts b/src/app/validators/other-purchase.validator.ts deleted file mode 100644 index d443e66..0000000 --- a/src/app/validators/other-purchase.validator.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { AbstractControl } from '@angular/forms'; - -export function OtherPurchasePlaceValidator(formGroup: AbstractControl): {[key: string]: boolean} { - const place = formGroup.get('place').value; - const other = formGroup.get('other').value; - - if (place && place.indexOf('Other') > -1 && !other) { - return {required: true}; - } - - return null; -} diff --git a/src/assets/.gitkeep b/src/assets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json deleted file mode 100644 index d26dc41..0000000 --- a/src/assets/i18n/de.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "HEADING": { - "REGISTER_PRODUCT": "Registrieren Sie Ihr Produkt", - "CHOOSE_LANGUAGE": "Wähle deine Sprache" - }, - "CONTENT": { - "USA": "Vereinigte Staaten" - }, - "LABEL": { - "FIRST_NAME": "Vorname", - "LAST_NAME": "Nachname", - "ADDRESS": "Anschrift", - "ADDRESS_TWO": "Whg.", - "CITY": "Ort", - "ZIP": "Postleitzahl", - "COUNTRY": "Land", - "STATE": "Bundesstaat", - "EMAIL": "E-Mail-Adresse", - "PHONE": "Telefon", - "SERIAL": "Seriennummer", - "PURCHASE_DATE": "Kaufdatum", - "PURCHASE_PLACE": "Kaufort", - "PURCHASE_PLACE_OTHER": "Andere angeben", - "NEWSLETTER": "Send me recipes, tips & News", - "NEWSLETTER_NOTICE": "You can unsubscribe at any time" - }, - "OPTION": { - "STATE": "Select State", - "COUNTRY": "Select Country", - "LOCATION": "Select Location" - }, - "BUTTON": { - "REGISTER": "Produkt registrieren" - }, - "VALIDATION": { - "REQUIRED_FIRST_NAME": "First Name is required", - "REQUIRED_LAST_NAME": "Last Name is required", - "REQUIRED_ADDRESS": "Address is required", - "REQUIRED_CITY": "City is required", - "REQUIRED_ZIP": "Zipcode is required", - "REQUIRED_COUNTRY": "Country is required", - "REQUIRED_STATE": "State is required", - "REQUIRED_EMAIL": "Valid Email is required", - "REQUIRED_PREFIX": "Serial prefix is required", - "REQUIRED_SUFFIX": "Serial suffix is required", - "REQUIRED_PURCHASE_DATE": "Purchase Date is required" - }, - "ERROR": { - "REGISTRATION_FAILED": "Registration failed please try again later" - } -} diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json deleted file mode 100644 index b64b309..0000000 --- a/src/assets/i18n/en.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "HEADING": { - "REGISTER_PRODUCT": "Register your product", - "CHOOSE_LANGUAGE": "Choose your language", - "PERSONAL_INFORMATION": "Personal Information" - }, - "CONTENT": { - "USA": "United States", - "CONFIDENTIAL": "We need this information so we know how to get back with you. We keep all of this strictly confidential.", - "PHOTO_INFO": "*Please note that photos will be required of the items and issues you are experiencing. If these cannot be attached to this claim, we ask that you call or chat with Customer Care to place your claim. Customer Care is available at 1-800-748-5400 or through the Live Chat (M-F, 7am-6pm MST)" - }, - "LABEL": { - "FIRST_NAME": "First Name", - "LAST_NAME": "Last Name", - "ADDRESS": "Street Address", - "ADDRESS_TWO": "Apt/Suite", - "CITY": "City", - "ZIP": "Zip Code", - "COUNTRY": "Country", - "STATE": "State", - "EMAIL": "Email", - "PHONE": "Phone Number", - "SERIAL": "Serial Number", - "PURCHASE_DATE": "Date of Purchase", - "PURCHASE_PLACE": "Place of Purchase", - "PURCHASE_PLACE_OTHER": "If 'Other' please specify", - "NEWSLETTER": "Send me recipes, tips & News", - "NEWSLETTER_NOTICE": "You can unsubscribe at any time", - "TELL_ABOUT_YOURSELF": "First, Tell us about yourself", - "CONTACT_METHOD": "What Is The Best Way To Contact You?", - "CONTACT_TIME": "What Is The Best Time Of Day To Reach You?", - "MORNING": "Morning", - "AFTERNOON": "Afternoon", - "EVENING": "Evening", - "RECEIPT": "If you still have the receipt would you please upload a picture of it?" - }, - "OPTION": { - "STATE": "Select State", - "COUNTRY": "Select Country", - "LOCATION": "Select Location" - }, - "BUTTON": { - "REGISTER": "Register Product", - "NEXT": "Next", - "BACK": "Back" - }, - "VALIDATION": { - "REQUIRED_FIRST_NAME": "First Name is required", - "REQUIRED_LAST_NAME": "Last Name is required", - "REQUIRED_ADDRESS": "Address is required", - "REQUIRED_CITY": "City is required", - "REQUIRED_ZIP": "Zipcode is required", - "REQUIRED_COUNTRY": "Country is required", - "REQUIRED_STATE": "State is required", - "REQUIRED_EMAIL": "Valid Email is required", - "REQUIRED_PREFIX": "Serial prefix is required", - "REQUIRED_SUFFIX": "Serial suffix is required", - "REQUIRED_PURCHASE_DATE": "Purchase Date is required", - "REQUIRED_CONTACT_METHOD": "Contact Method is required", - "REQUIRED_CONTACT_TYPE": "Contact Type is required", - "REQUIRED_RECEIPT_PHOTO": "Receipt Photo is required", - "WRONG_FILE_TYPE": "Wrong File type, upload a png, jpg, or gif" - - }, - "ERROR": { - "REGISTRATION_FAILED": "Registration failed please try again later" - } -} diff --git a/src/assets/i18n/fr-ca.json b/src/assets/i18n/fr-ca.json deleted file mode 100644 index 6251dff..0000000 --- a/src/assets/i18n/fr-ca.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "HEADING": { - "REGISTER_PRODUCT": "ENREGISTRER PRODUIT", - "CHOOSE_LANGUAGE": "Choisissez votre langue" - }, - "CONTENT": { - "USA": "United States" - }, - "LABEL": { - "FIRST_NAME": "Prénom", - "LAST_NAME": "Nom de famille", - "ADDRESS": "Adresse", - "ADDRESS_TWO": "App. /Bureau", - "CITY": "Ville", - "ZIP": "Code postal", - "COUNTRY": "Pays", - "STATE": "Province ou État", - "EMAIL": "Courriel", - "PHONE": "Téléphone", - "SERIAL": "Numéro de série", - "PURCHASE_DATE": "Date D’achat", - "PURCHASE_PLACE": "Endroit de l’achat", - "PURCHASE_PLACE_OTHER": "Autre (préciser)", - "NEWSLETTER": "Send me recipes, tips & News", - "NEWSLETTER_NOTICE": "You can unsubscribe at any time" - }, - "OPTION": { - "STATE": "Select State", - "COUNTRY": "Select Country", - "LOCATION": "Select Location" - }, - "BUTTON": { - "REGISTER": "Enregistrer produit" - }, - "VALIDATION": { - "REQUIRED_FIRST_NAME": "First Name is required", - "REQUIRED_LAST_NAME": "Last Name is required", - "REQUIRED_ADDRESS": "Address is required", - "REQUIRED_CITY": "City is required", - "REQUIRED_ZIP": "Zipcode is required", - "REQUIRED_COUNTRY": "Country is required", - "REQUIRED_STATE": "State is required", - "REQUIRED_EMAIL": "Valid Email is required", - "REQUIRED_PREFIX": "Serial prefix is required", - "REQUIRED_SUFFIX": "Serial suffix is required", - "REQUIRED_PURCHASE_DATE": "Purchase Date is required" - }, - "ERROR": { - "REGISTRATION_FAILED": "Registration failed please try again later" - } -} diff --git a/src/assets/i18n/it.json b/src/assets/i18n/it.json deleted file mode 100644 index fbffdd9..0000000 --- a/src/assets/i18n/it.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "HEADING": { - "REGISTER_PRODUCT": "Register your product", - "CHOOSE_LANGUAGE": "Choose your language" - }, - "CONTENT": { - "USA": "United States" - }, - "LABEL": { - "FIRST_NAME": "Nome", - "LAST_NAME": "Cognome", - "ADDRESS": "Indirizzo", - "ADDRESS_TWO": "Interno", - "CITY": "Città", - "ZIP": "CAP", - "COUNTRY": "Nazione", - "STATE": "Stato", - "EMAIL": "Email", - "PHONE": "Telefono", - "SERIAL": "Numero di serie", - "PURCHASE_DATE": "Data Di Acquisto", - "PURCHASE_PLACE": "Luogo di acquisto", - "PURCHASE_PLACE_OTHER": "Altro (specificare)", - "NEWSLETTER": "Send me recipes, tips & News", - "NEWSLETTER_NOTICE": "You can unsubscribe at any time" - }, - "OPTION": { - "STATE": "Select State", - "COUNTRY": "Select Country", - "LOCATION": "Select Location" - }, - "BUTTON": { - "REGISTER": "Registra il mio prodotto" - }, - "VALIDATION": { - "REQUIRED_FIRST_NAME": "First Name is required", - "REQUIRED_LAST_NAME": "Last Name is required", - "REQUIRED_ADDRESS": "Address is required", - "REQUIRED_CITY": "City is required", - "REQUIRED_ZIP": "Zipcode is required", - "REQUIRED_COUNTRY": "Country is required", - "REQUIRED_STATE": "State is required", - "REQUIRED_EMAIL": "Valid Email is required", - "REQUIRED_PREFIX": "Serial prefix is required", - "REQUIRED_SUFFIX": "Serial suffix is required", - "REQUIRED_PURCHASE_DATE": "Purchase Date is required" - }, - "ERROR": { - "REGISTRATION_FAILED": "Registration failed please try again later" - } -} diff --git a/src/assets/i18n/jpn.json b/src/assets/i18n/jpn.json deleted file mode 100644 index ac3b109..0000000 --- a/src/assets/i18n/jpn.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "HEADING": { - "REGISTER_PRODUCT": "ブレンドテックをご購入くださり誠にありがとうございます。", - "CHOOSE_LANGUAGE": "Choose your language" - }, - "CONTENT": { - "USA": "United States" - }, - "LABEL": { - "FIRST_NAME": "<漢字> 姓", - "LAST_NAME": "名", - "ADDRESS": "郵便番号 <半角数字>", - "ADDRESS_TWO": "市町村区郡", - "CITY": "それ以降の住所", - "ZIP": "それ以降の住所", - "COUNTRY": "国", - "STATE": "市町村区郡", - "EMAIL": "E メールアドレス", - "PHONE": "電話番号", - "SERIAL": "シリアル番号 (例: XXXX-123456)", - "PURCHASE_DATE": "ご購入日", - "PURCHASE_PLACE": "ご購入先", - "PURCHASE_PLACE_OTHER": "オンラインの販売店名", - "NEWSLETTER": "Send me recipes, tips & News", - "NEWSLETTER_NOTICE": "You can unsubscribe at any time" - }, - "OPTION": { - "STATE": "Select State", - "COUNTRY": "Select Country", - "LOCATION": "Select Location" - }, - "BUTTON": { - "REGISTER": "登録する" - }, - "VALIDATION": { - "REQUIRED_FIRST_NAME": "First Name is required", - "REQUIRED_LAST_NAME": "Last Name is required", - "REQUIRED_ADDRESS": "Address is required", - "REQUIRED_CITY": "City is required", - "REQUIRED_ZIP": "Zipcode is required", - "REQUIRED_COUNTRY": "Country is required", - "REQUIRED_STATE": "State is required", - "REQUIRED_EMAIL": "Valid Email is required", - "REQUIRED_PREFIX": "Serial prefix is required", - "REQUIRED_SUFFIX": "Serial suffix is required", - "REQUIRED_PURCHASE_DATE": "Purchase Date is required" - }, - "ERROR": { - "REGISTRATION_FAILED": "Registration failed please try again later" - } -} diff --git a/src/assets/i18n/ko.json b/src/assets/i18n/ko.json deleted file mode 100644 index f30ac0f..0000000 --- a/src/assets/i18n/ko.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "HEADING": { - "REGISTER_PRODUCT": "구입하신 제품을 등록하세요", - "CHOOSE_LANGUAGE": "Choose your language" - }, - "CONTENT": { - "USA": "United States" - }, - "LABEL": { - "FIRST_NAME": "이름", - "LAST_NAME": "성", - "ADDRESS": "주소", - "ADDRESS_TWO": "아파트/건물 번호 및 호수", - "CITY": "시/군", - "ZIP": "우편번호", - "COUNTRY": "국가", - "STATE": "도/광역시/특별시", - "EMAIL": "이메일", - "PHONE": "전화번호", - "SERIAL": "일련 번호", - "PURCHASE_DATE": "구입 날짜", - "PURCHASE_PLACE": "구입 장소", - "PURCHASE_PLACE_OTHER": "기타 명시", - "NEWSLETTER": "Send me recipes, tips & News", - "NEWSLETTER_NOTICE": "You can unsubscribe at any time" - }, - "OPTION": { - "STATE": "Select State", - "COUNTRY": "Select Country", - "LOCATION": "Select Location" - }, - "BUTTON": { - "REGISTER": "제품 등록하기" - }, - "VALIDATION": { - "REQUIRED_FIRST_NAME": "First Name is required", - "REQUIRED_LAST_NAME": "Last Name is required", - "REQUIRED_ADDRESS": "Address is required", - "REQUIRED_CITY": "City is required", - "REQUIRED_ZIP": "Zipcode is required", - "REQUIRED_COUNTRY": "Country is required", - "REQUIRED_STATE": "State is required", - "REQUIRED_EMAIL": "Valid Email is required", - "REQUIRED_PREFIX": "Serial prefix is required", - "REQUIRED_SUFFIX": "Serial suffix is required", - "REQUIRED_PURCHASE_DATE": "Purchase Date is required" - }, - "ERROR": { - "REGISTRATION_FAILED": "Registration failed please try again later" - } -} diff --git a/src/assets/i18n/spa.json b/src/assets/i18n/spa.json deleted file mode 100644 index 0636532..0000000 --- a/src/assets/i18n/spa.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "HEADING": { - "REGISTER_PRODUCT": "Register your product", - "CHOOSE_LANGUAGE": "Choose your language" - }, - "CONTENT": { - "USA": "United States" - }, - "LABEL": { - "FIRST_NAME": "NOMBRE", - "LAST_NAME": "APELLIDOS", - "ADDRESS": "DIRECCIÓN POSTAL", - "ADDRESS_TWO": "Apt/Suite", - "CITY": "CIUDAD", - "ZIP": "CÓDIGO POSTAL", - "COUNTRY": "PAÍS", - "STATE": "ESTADO/PROVINCIA", - "EMAIL": "CORREO ELECTRONICO", - "PHONE": "TELÉFONO", - "SERIAL": "Número de Serie", - "PURCHASE_DATE": "FECHADECOMPRA", - "PURCHASE_PLACE": "LUGAR DE COMPRA", - "PURCHASE_PLACE_OTHER": "ESPECIFIQUE LUGAR DE COMPRA", - "NEWSLETTER": "Send me recipes, tips & News", - "NEWSLETTER_NOTICE": "You can unsubscribe at any time" - }, - "OPTION": { - "STATE": "Select State", - "COUNTRY": "Select Country", - "LOCATION": "Select Location" - }, - "BUTTON": { - "REGISTER": "Registro Del Producto" - }, - "VALIDATION": { - "REQUIRED_FIRST_NAME": "First Name is required", - "REQUIRED_LAST_NAME": "Last Name is required", - "REQUIRED_ADDRESS": "Address is required", - "REQUIRED_CITY": "City is required", - "REQUIRED_ZIP": "Zipcode is required", - "REQUIRED_COUNTRY": "Country is required", - "REQUIRED_STATE": "State is required", - "REQUIRED_EMAIL": "Valid Email is required", - "REQUIRED_PREFIX": "Serial prefix is required", - "REQUIRED_SUFFIX": "Serial suffix is required", - "REQUIRED_PURCHASE_DATE": "Purchase Date is required" - }, - "ERROR": { - "REGISTRATION_FAILED": "Registration failed please try again later" - } -} diff --git a/src/assets/i18n/zh-tw.json b/src/assets/i18n/zh-tw.json deleted file mode 100644 index 34f0500..0000000 --- a/src/assets/i18n/zh-tw.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "HEADING": { - "REGISTER_PRODUCT": "Register your product", - "CHOOSE_LANGUAGE": "Choose your language" - }, - "CONTENT": { - "USA": "United States" - }, - "LABEL": { - "FIRST_NAME": "名", - "LAST_NAME": "姓", - "ADDRESS": "地址", - "ADDRESS_TWO": "門牌號", - "CITY": "市", - "ZIP": "郵編", - "COUNTRY": "國家", - "STATE": "省", - "EMAIL": "電子郵箱", - "PHONE": "電話", - "SERIAL": "序號", - "PURCHASE_DATE": "購買日期", - "PURCHASE_PLACE": "購買地點", - "PURCHASE_PLACE_OTHER": "詳列其他", - "NEWSLETTER": "Send me recipes, tips & News", - "NEWSLETTER_NOTICE": "You can unsubscribe at any time" - }, - "OPTION": { - "STATE": "Select State", - "COUNTRY": "Select Country", - "LOCATION": "Select Location" - }, - "BUTTON": { - "REGISTER": "註冊我的產品" - }, - "VALIDATION": { - "REQUIRED_FIRST_NAME": "First Name is required", - "REQUIRED_LAST_NAME": "Last Name is required", - "REQUIRED_ADDRESS": "Address is required", - "REQUIRED_CITY": "City is required", - "REQUIRED_ZIP": "Zipcode is required", - "REQUIRED_COUNTRY": "Country is required", - "REQUIRED_STATE": "State is required", - "REQUIRED_EMAIL": "Valid Email is required", - "REQUIRED_PREFIX": "Serial prefix is required", - "REQUIRED_SUFFIX": "Serial suffix is required", - "REQUIRED_PURCHASE_DATE": "Purchase Date is required" - }, - "ERROR": { - "REGISTRATION_FAILED": "Registration failed please try again later" - } -} diff --git a/src/assets/i18n/zh.json b/src/assets/i18n/zh.json deleted file mode 100644 index 95ef319..0000000 --- a/src/assets/i18n/zh.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "HEADING": { - "REGISTER_PRODUCT": "Register your product", - "CHOOSE_LANGUAGE": "Choose your language" - }, - "CONTENT": { - "USA": "United States" - }, - "LABEL": { - "FIRST_NAME": "名", - "LAST_NAME": "姓", - "ADDRESS": "地址", - "ADDRESS_TWO": "门牌号", - "CITY": "市", - "ZIP": "邮编", - "COUNTRY": "国家", - "STATE": "省", - "EMAIL": "电子邮箱", - "PHONE": "电话", - "SERIAL": "序号", - "PURCHASE_DATE": "购买日期", - "PURCHASE_PLACE": "购买地点", - "PURCHASE_PLACE_OTHER": "详列其他", - "NEWSLETTER": "Send me recipes, tips & News", - "NEWSLETTER_NOTICE": "You can unsubscribe at any time" - }, - "OPTION": { - "STATE": "Select State", - "COUNTRY": "Select Country", - "LOCATION": "Select Location" - }, - "BUTTON": { - "REGISTER": "注册我的产品" - }, - "VALIDATION": { - "REQUIRED_FIRST_NAME": "First Name is required", - "REQUIRED_LAST_NAME": "Last Name is required", - "REQUIRED_ADDRESS": "Address is required", - "REQUIRED_CITY": "City is required", - "REQUIRED_ZIP": "Zipcode is required", - "REQUIRED_COUNTRY": "Country is required", - "REQUIRED_STATE": "State is required", - "REQUIRED_EMAIL": "Valid Email is required", - "REQUIRED_PREFIX": "Serial prefix is required", - "REQUIRED_SUFFIX": "Serial suffix is required", - "REQUIRED_PURCHASE_DATE": "Purchase Date is required" - }, - "ERROR": { - "REGISTRATION_FAILED": "Registration failed please try again later" - } -} diff --git a/src/assets/img/Ajax-loader.gif b/src/assets/img/Ajax-loader.gif deleted file mode 100644 index 3288d1035d70bb86517e2c233f1a904e41f06b29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3208 zcmc(iX;4#H9>pJdFE7h`I{IF)0|5<6L}(j=N}5%L009EB2nYfyF)E0PvIqo$u!IC; z4PgyY5|S9AEh38G)(9eq4TbH7_UHg@yWrlIJ$6smIADL7s^P;_O;ykRc9soXl`UC*LwQJXkii*0rx|*7rI2=x7WaRkx_~XZqFJ8R3c=2Kg zf@aSAv8+BJ8+^hyay>(QR@t*blbKzsf0}bscEqRc5Hd3o(-N5RyW=zWB*zQw6Zh>* z2CROCDAbu#D`)S|J_o(lL9Yn3l*+8RdiRD_>iNz$#_IAzCna&Wl5 zSF_(rRCDD!wi#i8oAm&jYtn2_@VB%2-H*G%bN#|(6R6N?wM)3u`PiGzwuX7qmTgyF zpE)h0kuoxQ9?=kW7Y!=R@DmhU9)vwT*EZWzJ zrt+=2tqFts72yIp?|gvdLhs8Hfku^Z(){gmN%Y=K#P|%fkvgUj~HfIp3CuXqCtYGtJ#me+n+-LmP( z*XNuk%!aH8bIE@_Bj46>M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BSw>WE z1AXZ1>Ahv&571%XmM4%wyScFsl0bWQZfx`3`e6Zgy=*VAP<>-Rorcs%2ErUq%^7mJ8?4F@EYt4C%+WS{ z8doU(UjQKi-u}MqqiSWboMi;?t9Wy08v-6jK21XaX~3&l*AU3G0BG4iV&mS;ySMM( zz=I1PPQ1AB_^Z3TR(Z~^_|BbaPWyYUvL4+poiZwDY>BC76TRs;e-pGFd>B% zj&R|H8H%tWh8cbcVTW3X7~u@d5p`k`CQ6hN0WcD9pb{d&@m!2J@^#9FHsa_b0XiZ_ z*pE1_xEql^9yp?GNaE-obIcj3QIjw>2PKqJit%ETw_SPVX+t(iLyBIic-odf>PBXn qGe&}DjLofCrfe+4INfAyGS^|AFLWp;lq3ScW}qHoNvKvK0028J#nnsz diff --git a/src/assets/img/flags/ca.png b/src/assets/img/flags/ca.png deleted file mode 100644 index 1f204193ae58c87efdd88d46700ccb48c2e1d0d8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 628 zcmV-)0*n2LP)e`b1WGV} ze#gbd^&bp=ef-GykAYc$@BhDltSqdeSy?RXJpcawy+5fJAb?mHcsPJ&{d@EF@4HtJ z)qno||1xd*zaM|Ot4f#|8A1AQ-~Pubz$7IBv;-i4SQvovfB*ge{fFVtAE4aNE7yPi z`^Eg=5yP(^Ur(Q5`TLjM%#`8#_rHuB|9}1hItd_vSpNO`#qjs<|KGp=|NIHm@MXqK z79K7}ZvOwQ9Df%s{`~lX*xI%KzW-!k{Lc96Cr|@G0I@Lq`0?-epMSr9|NHeD?&umBG}6iH(DSogJte zDERNk_kV0Zng09%Itd_vSb&=T{rt@+B*66dJ0my{fpNkvBm!jpV_;xnVgd@XDk?Dx zh=IJyzyJ_HjJJUrz)|>#fr0nRl^;KTz#|yK`2G9$BS%LzureS32rvK^u`=B;c)+&+ O0000e`b1WGV} ze#gbd^&bp=ef-GykAYc$@BhDltSqdeSy?RXJpcawy+5fJAb?mHcsPJ&{d@EF@4HtJ z)qno||1xd*zaM|Ot4f#|8A1AQ-~Pubz$7IBv;-i4SQvovfB*ge{fFVtAE4aNE7yPi z`^Eg=5yP(^Ur(Q5`TLjM%#`8#_rHuB|9}1hItd_vSpNO`#qjs<|KGp=|NIHm@MXqK z79K7}ZvOwQ9Df%s{`~lX*xI%KzW-!k{Lc96Cr|@G0I@Lq`0?-epMSr9|NHeD?&umBG}6iH(DSogJte zDERNk_kV0Zng09%Itd_vSb&=T{rt@+B*66dJ0my{fpNkvBm!jpV_;xnVgd@XDk?Dx zh=IJyzyJ_HjJJUrz)|>#fr0nRl^;KTz#|yK`2G9$BS%LzureS32rvK^u`=B;c)+&+ O0000h<6BFn%a z@b8~2SoNP@zd$;E{sbbRuHQd?{QCI=sNwhbA3*&Qe}GP900=;09NYi^fU@pUdVa9*13;+Sd!tjgXKhXQEMobL97(p6<{RLvMGBN!7 j!N9=G@a-1^K!5=NcXWu!7_DDe00000NkvXXu0mjfeQx^H diff --git a/src/assets/img/flags/en.png b/src/assets/img/flags/en.png deleted file mode 100644 index 10f451fe85c41c6c9a06d543a57114ae2f87ecc1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 609 zcmV-n0-pVeP){qW|y?pud`Sa)3|NY&vWd%S0u>b>P!2!lUe;6EF*#G_c zFVXVt@6Q{uX@40W{p0iY2Aa+A^Cu7i8KT+YH}2j52q4BskM2rJ$^k9;2Xxc_|Np=M z&VaLlA*IO5FlECMfB<5VUNC{tBZO(|zW*;@GJN;|bTJ71`0*d;`d`2P!x=ymOA`2> z+y@9C##^^8%gd{MW@Y91_2d742B2~OQNf=-zkmD?Vqkdk_wPTUNeuu2#KPTG{_;O4 v7C%8E5*DLB7#Kb?Fnj}}-(W6879hX?8lYRg`Y`<~00000NkvXXu0mjfD6Jtx diff --git a/src/assets/img/flags/es.png b/src/assets/img/flags/es.png deleted file mode 100644 index c2de2d7111e3cb59cf6511dd2ab045e824bdb43e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 469 zcmV;`0V@89P)@|4`Xj5kLT%`al?B=W5I`&pe;NKW0^Ri&h`xRJ_x;0v zUa?=y?0^3M|NZ~}FE9c#{{3cP{Qd6}13&;Vf!z&M{pZWqKYu4MFm$tgedF}w=P#IQ z7-9gT-$11R0mKA$(qEu4%ok$*y!^wMRm*x;`R7|k6yu?K{s8?55I{^|9{?Tjhec2I zv+6&FhFWG_BbNVc|Ns94tNRJp!0`V!Py;{!F#$2enB#XZaohg-5%Tlk#oa&nzQW9g zl0Y{D4gK?n0U&@Fe=;yIr=|V7caH%YEYL84k`Tt9-wc2LGODP&y?7BIfLMT@X8Qey zK~fSFpuiXa$^kra@ocD)4hB}-f* zN`mv#O3D+9QW+dm@{>{(JaZG%Q-e|yQz{EjrrIztFq(O~IEGZ*N=lh=;=qSyMwWku z27eMOW_|f0uQeek^e_9g7KH|eq{JVG0^UaP2Jy4}|L^JL_3uCblfVD@mnS9t`~UCn z|MT(+KT|KOfz%~1cG~~^_2vEk{SFNQ?Cjg~|NsBWy<%2im{vp^YdeS=hk-Cyo6U`Hgs{l4FR(w#{P`G0;a3G2@YSmzI~fu(ZE1> L{an^LB{Ts58L6#6 diff --git a/src/assets/img/flags/ja.png b/src/assets/img/flags/ja.png deleted file mode 100644 index 325fbad3ffd3075a4a84d8d898ad26ef7d3e0d56..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 420 zcmV;V0bBlwP)9whYk?f=!Q|Ns8||JN@lTD;`{R1ZWk|EGa3dAO8ObDh3E3Cb;oH_5X#1 z|NHy@|M?558b}5Q|Cf`4hZv9q2p|@?lb|{i68>{>{ol0lx`{mi O0000k7RCwBA z{P_JV0}}Z6?;n_iu%H+Q{s1vR05Jij`8c?M=-GouSI=K${m;n9!7aeW#m~(x$j!^i z%zXLG*~fS9it_V|2?zl-00a;V#NgMjUvJ&I^~3uQB4T37ii-d5-u?gQ&wmw_XD?o^ zUAsm=P*7M%NJdr`Xazt3fo%By|Nn;%AAbM-ZD?YwEG7BBxA%WR!T-FR|8><0Vxn$d zUT@yKdH&)BP#Mq$fB<3y`hl076R7Rgt5;mSyo`Gea7>-}|M%}Nf0%y${3VbO@hKwm zAWK?W z+TGp#<;$01Vv<1pdP-ancZ!Qkd3bmLHK?nrgX5I}Ab=R3zkQ1wk#LIP517FKVgLC9 eRt>}e0R{ktF&Q^6#MUGL0000<~s!0-E7R}a|Ns2?4|9|}gs%Dgx1=;`*KrBFO{{8#+``2Fv2B6@-@8AFY{`(K80jdYk13&6P)$bmtfBa_T{rmsVufH!rO2O)W0!b+P{TrwO zAb?mv&i(NBbu;G`sX*)cv$d*%>MiL-(QdhpkjakVmyu%k;sfcNRj;yhJaxT5MTg0u5&QfH8#Bf O0000 ( + props.show ?
: null +); + +export default backdrop; \ No newline at end of file diff --git a/src/components/Backdrop/backdrop.test.jsx b/src/components/Backdrop/backdrop.test.jsx new file mode 100644 index 0000000..34bbc23 --- /dev/null +++ b/src/components/Backdrop/backdrop.test.jsx @@ -0,0 +1,30 @@ +import React from 'react'; +import { mount, configure, shallow } from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; +import Backdrop from './backdrop'; + +configure({ adapter: new Adapter() }); + +describe('', () => { + let wrapper = null; + + beforeEach( () => { + wrapper = shallow(); + }); + + it('renders without crashing', () => { + wrapper = shallow(); + expect(wrapper).toBeTruthy(); + }); + + it('on show shows backdrop', () => { + wrapper = shallow(); + expect(wrapper.find('.Backdrop')).toHaveLength(1); + }); + + it('is null when show is false', () => { + wrapper = shallow(); + expect(wrapper.find('.Backdrop')).toHaveLength(0); + }); + +}); \ No newline at end of file diff --git a/src/app/additional/additional.component.css b/src/components/Form/Form.css similarity index 100% rename from src/app/additional/additional.component.css rename to src/components/Form/Form.css diff --git a/src/components/Form/Form.jsx b/src/components/Form/Form.jsx new file mode 100644 index 0000000..f11c4b8 --- /dev/null +++ b/src/components/Form/Form.jsx @@ -0,0 +1,351 @@ +import React, { Component } from 'react'; +import Input from '../UI/Input/Input'; +import './RegistrationForm.css'; +import axios from '../../axios-data'; +import axiosTransit from '../../axios-transit'; +import Aux from '../../hoc/Aux/Aux'; +import Popup from '../PopUp/popup'; +import orderForm from '../../enum/orderForm'; +import infoFiles from '../../enum/info-files'; + +class RegistrationForm extends Component { + state = { + orderForm: {...orderForm.registration}, + formIsValid: false, + loading: false, + states: null, + countries: null, + prefixes: null, + showPopup: false + } + + setSelectStates(states = null, country = null) { + if (this.state.states || states) { + let currCountry = 'US'; + let availStates = states || this.state.states; + + const updatedOrderForm = { + ...this.state.orderForm + }; + + if (country || updatedOrderForm.country.value) { + currCountry = country || updatedOrderForm.country.value; + } + let currStates = availStates.filter(state => { + return state.country === currCountry; + }) + .map(state => { + return {value: state.name, displayValue: state.name}; + }); + if (currStates.length === 0) { + + } else { + currStates.unshift({value: '', displayValue: 'Select State'}); + } + return currStates; + } else { + return null; + } + } + + setCountries() { + if (this.state.countries) { + let availCountries = this.state.countries; + const updatedOrderForm = { + ...this.state.orderForm + }; + let currCountries = availCountries.map(country => { + return {value: country.code, displayValue: country.name}; + }); + currCountries.unshift({value: '', displayValue: 'Select a Country'}); + updatedOrderForm.country.elementConfig.options = currCountries; + this.setState((state, props) => { + return { + orderForm: updatedOrderForm + } + }); + } + } + + componentDidMount() { + axios.get(infoFiles.statesFile) + .then(res => { + const states = res.data; + const showStates = this.setSelectStates(states); + let stateUpdater = {states: states}; + if (showStates) { + const updatedOrderForm = { + ...this.state.orderForm + }; + updatedOrderForm.state.validation = { required: Boolean(showStates.length)}; + updatedOrderForm.state.elementConfig.options = showStates; + stateUpdater = { + states: states, + orderForm: updatedOrderForm + }; + } + this.setState((state, props) => { + return stateUpdater; + }); + }) + .catch(e => e); + axios.get(infoFiles.countryFile) + .then(res => { + const countries = res.data; + this.setState({ countries: countries }); + this.setCountries(); + }) + .catch(e => e); + axiosTransit.get(infoFiles.prefixes) + .then(res => { + const prefixes = res.data; + this.setState({ prefixes: prefixes }); + this.setCountries(); + }) + .catch(e => e); + axios.get(infoFiles.retailersFile) + .then(res => { + const retailers = res.data; + const updatedOrderForm = { + ...this.state.orderForm + }; + updatedOrderForm.retailers.elementConfig.options = retailers.map(retailer => { + return {value: retailer.id, displayValue: retailer.name}; + }); + if (updatedOrderForm.retailers.elementConfig.options.length > 0) { + updatedOrderForm.retailers.elementConfig.options.unshift({value: '', displayValue: 'Place of Purchase'}); + updatedOrderForm.retailers.validation = {required: true}; + } + this.setState({orderForm: updatedOrderForm}); + }) + .catch(e => e); + } + + checkValidity(value, rules) { + let isValid = true; + if (!rules) { + return true; + } + + if (rules.required) { + isValid = value.trim() !== '' && isValid; + } + + if (rules.minLength && isValid) { + isValid = value.length >= rules.minLength && isValid + } + + if (rules.maxLength && isValid) { + isValid = value.length <= rules.maxLength && isValid + } + + if (rules.prefix && isValid) { + const availPrefix = this.state.prefixes; + isValid = Boolean(availPrefix.filter(prefix => { + return value.toUpperCase() === prefix.prefix.toUpperCase(); + }).length); + } + + if (rules.pastDate && isValid) { + if (value && value.fromNow) { + const distanceString = value.fromNow(); + isValid = Boolean(distanceString.indexOf('ago') > -1); + } else { + isValid = false; + } + } + + if (rules.isEmail && isValid) { + const pattern = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/; + isValid = pattern.test(value) && isValid + } + + if (rules.isNumeric && isValid) { + const pattern = /^\d+$/; + isValid = pattern.test(value) && isValid + } + + return isValid; + } + + inputChangedHandler = (event, inputIdentifier) => { + let updatedOrderForm = { + ...this.state.orderForm + }; + const updatedFormElement = { + ...updatedOrderForm[inputIdentifier] + }; + let value = null; + if (inputIdentifier === 'purchaseDate' || inputIdentifier === 'captcha') { + value = event; + } else { + value = event.target.value; + } + updatedFormElement.value = value; + updatedFormElement.valid = this.checkValidity(updatedFormElement.value, updatedFormElement.validation); + updatedFormElement.touched = true; + updatedOrderForm[inputIdentifier] = updatedFormElement; + if (inputIdentifier === 'country') { + const showStates = this.setSelectStates(null, updatedFormElement.value); + if (showStates) { + updatedOrderForm.state.validation = { required: Boolean(showStates.length)}; + updatedOrderForm.state.valid = this.checkValidity(updatedOrderForm.state.value, updatedOrderForm.state.validation); + updatedOrderForm.state.elementConfig.options = showStates; + } + } + let formIsValid = true; + for (let inputIdentifier in updatedOrderForm) { + formIsValid = updatedOrderForm[inputIdentifier].valid && formIsValid; + } + this.setState((state, props) => { + return { + orderForm: updatedOrderForm, + formIsValid: formIsValid + } + }); + } + + getErrorMessages() { + const formElement = {...this.state.orderForm}; + + const errorMessages = Object.keys(formElement).filter(key => { + if (formElement[key].valid === false && formElement[key].touched === true) { + return true; + } else { + return false; + } + }).map(errored => { + if (formElement[errored].elementConfig.errormessage) { + return formElement[errored].elementConfig.errormessage; + } + return null; + }); + return errorMessages; + } + + hidePopUpHandler = () => { + this.setState({showPopup: false}); + } + + showPopUpHandler = () => { + this.setState({showPopup: true}); + } + + submitIt = () => { + let formElement = {...this.state.orderForm}; + const valid = this.state.formIsValid; + if (valid) { + this.props.submit(formElement); + } else { + Object.keys(formElement).map(key => { + formElement[key].touched = true; + return formElement[key]; + }); + this.setState({orderForm: formElement}); + } + } + + + render() { + let formElement = {...this.state.orderForm}; + const firstSection = [...orderForm.firstSection]; + const secondSection = [...orderForm.secondSection]; + const errorMessages = this.getErrorMessages(); + let errors = null; + Object.keys(formElement).map(el => { + if (formElement[el].elementConfig && formElement[el].elementConfig.placeholder_key) { + formElement[el].elementConfig.placeholder = this.props.t(formElement[el].elementConfig.placeholder_key); + } + if (formElement[el].elementConfig && formElement[el].elementConfig.errormessage_key) { + formElement[el].elementConfig.errormessage = this.props.t(formElement[el].elementConfig.errormessage_key); + } + return el; + }); + if (errorMessages.length) { + errors = ( +
+
    + {errorMessages.map((message, index) => { + return ( +
  • {message}
  • + ); + })} +
+
+ ); + } + let form = ( + + +
+
+
+ {errors} +
+
+ {firstSection.map(section => ( + this.inputChangedHandler(event, section)} + classesInput={formElement[section].classes}/> + ))} +
+
+ this.inputChangedHandler(event, 'serialPrefix')} + classesInput={formElement['serialPrefix'].classes}/> + this.inputChangedHandler(event, 'serialSuffix')} + classesInput={formElement['serialSuffix'].classes}/> +
+ +
+ {secondSection.map(section => ( + this.inputChangedHandler(event, section)} + classesInput={formElement[section].classes} + captchaKey={formElement[section].captchaKey}/> + ))} +
+ + {this.props.t('REGISTER_PRODUCT')} + +
+
+
+
+
+ ); + return form; + } + +} + +export default RegistrationForm; \ No newline at end of file diff --git a/src/components/Form/Form.test.jsx b/src/components/Form/Form.test.jsx new file mode 100644 index 0000000..c9043d9 --- /dev/null +++ b/src/components/Form/Form.test.jsx @@ -0,0 +1,105 @@ +import React from 'react'; +import { mount, configure, shallow } from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; +import Form from './Form'; +import orderForm from '../../enum/orderForm'; +import MockAdapter from 'axios-mock-adapter'; +import axios from '../../axios-data'; +import axiosTransit from '../../axios-transit'; +import infoFiles from '../../enum/info-files'; +import Input from '../UI/Input/Input'; + +configure({ adapter: new Adapter() }); + + +describe('
', () => { + let wrapper = null; + const mockSubmit = jest.fn(); + const mockT = jest.fn(); + const statesOut = [{short: "AL", name: "Alabama", country: "US", region: "", alt: []}]; + const countriesOut = [{name: "United States", code: "US"}, {name: "Canada", code: "CA"}]; + const retailers = [{name: "Amazon", id: "amazon"}]; + const prefixes = [{id: 5, prefix: "TTBB", recid: ""}, {id: 32, prefix: "BHP3AJ", recid: ""}]; + + + beforeEach( () => { + const mocker = new MockAdapter(axios); + mocker.onGet(infoFiles.statesFile).reply(200, statesOut); + mocker.onGet(infoFiles.countryFile).reply(200, countriesOut); + mocker.onGet(infoFiles.retailersFile).reply(200, retailers); + + const mockerTransit = new MockAdapter(axiosTransit); + mockerTransit.onGet(infoFiles.prefixes).reply(200, prefixes); + + wrapper = shallow(); + + }); + + it('renders without crashing', () => { + expect(wrapper).toBeTruthy();; + }); + + it('states need to be set', () => { + expect(wrapper.state('states')).toEqual(statesOut); + }); + + it('countries need to be set', () => { + expect(wrapper.state('countries')).toEqual(countriesOut); + }); + + it('prefixes need to be set', () => { + expect(wrapper.state('prefixes')).toEqual(prefixes); + }); + + it('should check if email is valid', () => { + const emailFake = 'not an email'; + const valid = wrapper.instance().checkValidity(emailFake, { required: true, isEmail: true}); + expect(valid).toBe(false); + }); + + it('should check if max length is correct', () => { + const longString = 'a string that is too long'; + const valid = wrapper.instance().checkValidity(longString, { required: true, maxLength: 2}); + expect(valid).toBe(false); + }); + + it('should check if max length is correct', () => { + const notNumber = 'non numeric string'; + const valid = wrapper.instance().checkValidity(notNumber, { required: true, isNumeric: true}); + expect(valid).toBe(false); + }); + + it('should check if min length is correct', () => { + const shortString = 'short string'; + const valid = wrapper.instance().checkValidity(shortString, { required: true, minLength: 100}); + expect(valid).toBe(false); + }); + + it('should check has input is required', () => { + const emptyString = ''; + const valid = wrapper.instance().checkValidity(emptyString, { required: true}); + expect(valid).toBe(false); + }); + + it('should contain Input elements', () => { + const firstSectionLength = orderForm.firstSection.length; + const secondSectionLength = orderForm.secondSection.length; + const serialPrefixAndSuffix = 2; + expect(wrapper.find(Input)).toHaveLength(firstSectionLength + secondSectionLength + serialPrefixAndSuffix); + }); + + it('should show errors when submit button is clicked', () => { + expect(wrapper.find('.errors')).toHaveLength(0); + wrapper.instance().submitIt(); + wrapper.update(); + expect(wrapper.find('.errors')).toHaveLength(1); + }); + + it('should submit when valid', () => { + wrapper.instance().setState({formIsValid: true}); + wrapper.instance().submitIt(); + expect(mockT).toHaveBeenCalled(); + }); + +}); + diff --git a/src/components/PopUp/popup.jsx b/src/components/PopUp/popup.jsx new file mode 100644 index 0000000..792374b --- /dev/null +++ b/src/components/PopUp/popup.jsx @@ -0,0 +1,27 @@ +import React from 'react'; + +const popup = (props) => { + const showclassNamees = ['exit-intent-overlay', 'exit-intent-overlay-scroll']; + if (props.show) { + showclassNamees.push('show'); + } + return ( +
+
+
+

{props.t('SERIAL_WHERE')}

+

{props.t('ALL_EXCEPT_725')}

+

{props.t('SERIAL_LOCATION_ALL')}

+ {props.t('ALL_EXCEPT_725')} +
+

{props.t('DESIGNER_725')}

+

{props.t('SERIAL_LOCATION_725')}

+ {props.t('SERIAL_LOCATION_725')} + +
+
+
+ ); +}; + +export default popup; \ No newline at end of file diff --git a/src/components/PopUp/popup.test.jsx b/src/components/PopUp/popup.test.jsx new file mode 100644 index 0000000..631add4 --- /dev/null +++ b/src/components/PopUp/popup.test.jsx @@ -0,0 +1,27 @@ +import React from 'react'; +import { mount, configure, shallow } from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; +import Popup from './popup'; + +configure({ adapter: new Adapter() }); + +describe('', () => { + let wrapper = null; + + beforeEach( () => { + const mockHide = jest.fn(); + const mockT = jest.fn(); + wrapper = shallow(); + }); + + it('renders without crashing', () => { + expect(wrapper).toBeTruthy();; + }); + + it('contains classes which animate it', () => { + expect(wrapper.find('.exit-intent-overlay')).toHaveLength(1); + expect(wrapper.find('.exit-intent-overlay-scroll')).toHaveLength(1); + expect(wrapper.find('.show')).toHaveLength(1); + }); + +}); \ No newline at end of file diff --git a/src/components/Recaptcha/recaptcha.jsx b/src/components/Recaptcha/recaptcha.jsx new file mode 100644 index 0000000..d1ef2da --- /dev/null +++ b/src/components/Recaptcha/recaptcha.jsx @@ -0,0 +1,17 @@ +import React, { Component } from 'react'; +import ReCAPTCHA from 'react-google-recaptcha'; + + +class Recaptcha extends Component { + render() { + return ( + + ); + } +}; + +export default Recaptcha; \ No newline at end of file diff --git a/src/components/Recaptcha/recaptcha.test.jsx b/src/components/Recaptcha/recaptcha.test.jsx new file mode 100644 index 0000000..85a9294 --- /dev/null +++ b/src/components/Recaptcha/recaptcha.test.jsx @@ -0,0 +1,20 @@ +import React from 'react'; +import { mount, configure, shallow } from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; +import Recaptcha from './recaptcha'; + +configure({ adapter: new Adapter() }); + +describe('', () => { + let wrapper = null; + + beforeEach( () => { + const mockChange = jest.fn(); + wrapper = shallow(); + }); + + it('renders without crashing', () => { + expect(wrapper).toBeTruthy();; + }); + +}); \ No newline at end of file diff --git a/src/components/SuccessPage/successPage.jsx b/src/components/SuccessPage/successPage.jsx new file mode 100644 index 0000000..eb3c799 --- /dev/null +++ b/src/components/SuccessPage/successPage.jsx @@ -0,0 +1,265 @@ +import React from 'react'; + +const successPage = (props) => { + return ( + + ); +} + +export default successPage; \ No newline at end of file diff --git a/src/components/SuccessPage/successPage.test.jsx b/src/components/SuccessPage/successPage.test.jsx new file mode 100644 index 0000000..e102e91 --- /dev/null +++ b/src/components/SuccessPage/successPage.test.jsx @@ -0,0 +1,24 @@ +import React from 'react'; +import { mount, configure, shallow } from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; +import SuccessPage from './successPage'; + +configure({ adapter: new Adapter() }); + +describe('', () => { + let wrapper = null; + + beforeEach( () => { + const mockT = jest.fn(); + wrapper = shallow(); + }); + + it('renders without crashing', () => { + expect(wrapper).toBeTruthy(); + }); + + it('contains the registration thank you page', () => { + expect(wrapper.find('.registration-thank-you')).toHaveLength(1); + }); + +}); \ No newline at end of file diff --git a/src/components/UI/Button/Button.css b/src/components/UI/Button/Button.css new file mode 100644 index 0000000..53e31da --- /dev/null +++ b/src/components/UI/Button/Button.css @@ -0,0 +1,29 @@ +.Button { + background-color: transparent; + border: none; + color: white; + outline: none; + cursor: pointer; + font: inherit; + padding: 10px; + margin: 10px; + font-weight: bold; +} + +.Button:first-of-type { + margin-left: 0; + padding-left: 0; +} + +.Button:disabled { + color: #ccc; + cursor: not-allowed; +} + +.Success { + color: #5C9210; +} + +.Danger { + color: #944317; +} \ No newline at end of file diff --git a/src/components/UI/Button/Button.jsx b/src/components/UI/Button/Button.jsx new file mode 100644 index 0000000..ad1a009 --- /dev/null +++ b/src/components/UI/Button/Button.jsx @@ -0,0 +1,12 @@ +import React from 'react'; + +import classes from './Button.css'; + +const button = (props) => ( + +); + +export default button; \ No newline at end of file diff --git a/src/components/UI/Input/Input.jsx b/src/components/UI/Input/Input.jsx new file mode 100644 index 0000000..ccdc093 --- /dev/null +++ b/src/components/UI/Input/Input.jsx @@ -0,0 +1,74 @@ +import React from 'react'; +import DatePicker from 'react-datepicker'; +import 'react-datepicker/dist/react-datepicker.css'; +import Recaptcha from '../../Recaptcha/recaptcha'; + +const input = (props) => { + let inputElement = null; + const inputClasses = ['input-full']; + if (props.invalid && props.shouldValidate && props.touched) { + inputClasses.push('error'); + } + + switch ( props.elementType ) { + case ( 'input' ): + inputElement = ; + break; + case ( 'textarea' ): + inputElement =