[
  {
    "path": ".gitignore",
    "content": "# See https://help.github.com/ignore-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n\n# testing\n/coverage\n\n# production\n/build\n\n# misc\n.DS_Store\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n"
  },
  {
    "path": "README.md",
    "content": "# (Obsolete) SurveyJS + React Quickstart Template \n\n> This template is built using [Create React App](https://github.com/facebook/create-react-app), which is now deprecated. Use the [SurveyJS + Next.js quickstart template](https://github.com/surveyjs/surveyjs-nextjs) instead. \n\nSurveyJS is a set of JavaScript components that allow you and your users to build surveys / forms, store them in your database, and visualize survey results for data analysis. This quick start template is bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app) and uses the following SurveyJS components:\n\n- [SurveyJS Form Library](https://surveyjs.io/form-library/documentation/overview)\n- [Survey Creator / Form Builder](https://surveyjs.io/survey-creator/documentation/overview)\n- [SurveyJS PDF Generator](https://surveyjs.io/pdf-generator/documentation/overview)\n- [SurveyJS Dashboard](https://surveyjs.io/dashboard/documentation/overview)\n\n## Run the application\n\n```bash\ngit clone https://github.com/surveyjs/surveyjs_react_quickstart.git\ncd surveyjs_react_quickstart\nnpm i\nnpm run start\n```\n\nOpen http://localhost:3000/ in your web browser.\n\n## Template structure\n\nThis template covers most basic use cases. You can find code examples for them in the following files:\n\n- Create a standalone survey\n  - [src/data/survey_json.js](src/data/survey_json.js)\n  - [src/pages/Survey.js](src/pages/Survey.js)\n- Add Survey Creator to a page\n  - [src/components/SurveyCreator.js](src/components/SurveyCreator.js)\n  - [src/pages/Creator.js](src/pages/Creator.js)\n- Export a survey to a PDF document\n  - [src/pages/Export.js](src/pages/Export.js)\n- Visualize survey results\n  - As charts\n    - [src/data/analytics_data.js](src/data/analytics_data.js)\n    - [src/components/SurveyAnalytics.js](src/components/SurveyAnalytics.js)\n    - [src/pages/Analytics.js](src/pages/Analytics.js)\n  - As a table\n    - [src/data/analytics_data.js](src/data/analytics_data.js)\n    - [src/components/SurveyAnalyticsTabulator.js](src/components/SurveyAnalyticsTabulator.js)\n    - [src/pages/AnalyticsTabulator.js](src/pages/AnalyticsTabulator.js)\n- Create a custom question type\n  - [src/components/MyQuestion.js](src/components/MyQuestion.js)\n- Register third-party components\n  - [src/App.js](src/App.js#L37)\n"
  },
  {
    "path": "azure-pipelines/master/react-quickstart-main.yml",
    "content": "resources:\n  pipelines:\n    - pipeline: ReleaseVersion\n      source: Release Version\n      trigger: true\n\nvariables:\n  npm_config_cache: $(Pipeline.Workspace)/.npm\n  CurrentBranch: $(Build.SourceBranchName)\n  ProjectId: 'd79f2855-7b94-4261-9daf-4cace0a06c03'\n\ntrigger:\n  batch: true\n  branches:\n    include:\n      - master\n\npr: none\n\npool:\n  vmImage: ubuntu-latest\n\nsteps:\n- task: NodeTool@0\n  inputs:\n    versionSpec: \"24.x\"\n  displayName: 'Install Node.js'\n\n- script: |\n    npm install\n    npm run build\n  displayName: 'npm install and build'\n\n- script: |\n    npm run test -- --watchAll=false\n  displayName: 'run unit tests'"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"surveyjs_react_quickstart\",\n  \"version\": \"0.2.0\",\n  \"private\": true,\n  \"dependencies\": {\n    \"bootstrap\": \"^3.3.7\",\n    \"jspdf\": \"1.5.3\",\n    \"jspdf-autotable\": \"3.0.10\",\n    \"react\": \"^17.0.2\",\n    \"react-dom\": \"^17.0.2\",\n    \"react-router-dom\": \"^5.2.0\",\n    \"react-scripts\": \"^5.0.0\",\n    \"survey-analytics\": \"^1.12.26\",\n    \"survey-core\": \"^1.12.26\",\n    \"survey-creator-core\": \"^1.12.26\",\n    \"survey-creator-react\": \"^1.12.26\",\n    \"survey-pdf\": \"^1.12.26\",\n    \"survey-react-ui\": \"^1.12.26\",\n    \"xlsx\": \"^0.18.5\"\n  },\n  \"scripts\": {\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts --max_old_space_size=4096 build\",\n    \"test\": \"react-scripts test --env=jsdom\",\n    \"eject\": \"react-scripts eject\"\n  },\n  \"browserslist\": [\n    \">0.2%\",\n    \"not dead\",\n    \"not ie <= 11\",\n    \"not op_mini all\"\n  ],\n  \"devDependencies\": {\n    \"jest-canvas-mock\": \"^2.3.1\",\n    \"jest-watch-typeahead\": \"^0.6.5\"\n  }\n}\n"
  },
  {
    "path": "public/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n  <meta charset=\"utf-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\n  <meta name=\"theme-color\" content=\"#000000\">\n  <!--\n      manifest.json provides metadata used when your web app is added to the\n      homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/\n    -->\n  <link rel=\"manifest\" href=\"%PUBLIC_URL%/manifest.json\">\n  <link rel=\"shortcut icon\" href=\"%PUBLIC_URL%/favicon.ico\">\n  <script src=\"https://unpkg.com/jquery\"></script>\n  <!--\n      Notice the use of %PUBLIC_URL% in the tags above.\n      It will be replaced with the URL of the `public` folder during the build.\n      Only files inside the `public` folder can be referenced from the HTML.\n\n      Unlike \"/favicon.ico\" or \"favicon.ico\", \"%PUBLIC_URL%/favicon.ico\" will\n      work correctly both with client-side routing and a non-root public URL.\n      Learn how to configure a non-root public URL by running `npm run build`.\n    -->\n  <title>SurveyJS + React App</title>\n</head>\n\n<body>\n  <noscript>\n    You need to enable JavaScript to run this app.\n  </noscript>\n  <div id=\"root\"></div>\n  <!--\n      This HTML file is a template.\n      If you open it directly in the browser, you will see an empty page.\n\n      You can add webfonts, meta tags, or analytics to this file.\n      The build step will place the bundled scripts into the <body> tag.\n\n      To begin the development, run `npm start` or `yarn start`.\n      To create a production bundle, use `npm run build` or `yarn build`.\n    -->\n</body>\n\n</html>"
  },
  {
    "path": "public/manifest.json",
    "content": "{\n  \"short_name\": \"React App\",\n  \"name\": \"Create React App Sample\",\n  \"icons\": [\n    {\n      \"src\": \"favicon.ico\",\n      \"sizes\": \"64x64 32x32 24x24 16x16\",\n      \"type\": \"image/x-icon\"\n    }\n  ],\n  \"start_url\": \"./index.html\",\n  \"display\": \"standalone\",\n  \"theme_color\": \"#000000\",\n  \"background_color\": \"#ffffff\"\n}\n"
  },
  {
    "path": "src/App.css",
    "content": ".App-logo {\n  animation: App-logo-spin infinite 20s linear;\n}\n\n.app-content {\n  height: calc(100vh - 80px);\n  overflow-y: auto;\n}\n\nh1,\nh1+span {\n  padding: 0 20px;\n}\n\n.jumbotron ul {\n  font-size: 21px;\n}\n\n@keyframes App-logo-spin {\n  from {\n    transform: rotate(0deg);\n  }\n\n  to {\n    transform: rotate(360deg);\n  }\n}"
  },
  {
    "path": "src/App.js",
    "content": "import { BrowserRouter as Router, Switch, Route, Link } from \"react-router-dom\";\r\nimport \"./App.css\";\r\nimport { HomePage } from \"./pages/Home\";\r\nimport { CreatorPage } from \"./pages/Creator\";\r\nimport { SurveyPage } from \"./pages/Survey\";\r\nimport { ExportToPDFPage } from \"./pages/Export\";\r\nimport { AnalyticsPage } from \"./pages/Analytics\";\r\nimport { AnalyticsTabulatorPage } from \"./pages/AnalyticsTabulator\";\r\n\r\nimport \"bootstrap/dist/css/bootstrap.css\";\r\n\r\nexport { MyQuestion } from \"./components/MyQuestion\";\r\n\r\nexport default function SurveyJSReactApplication() {\r\n  return (\r\n    <Router>\r\n      <div>\r\n        <nav className=\"navbar navbar-default\">\r\n          <div className=\"container-fluid\">\r\n            <div className=\"navbar-header\">\r\n              <a className=\"navbar-brand\" href=\"/\">\r\n                SurveyJS + React\r\n              </a>\r\n            </div>\r\n            <ul className=\"nav navbar-nav\">\r\n              <li>\r\n                <Link to=\"/\">Home</Link>\r\n              </li>\r\n              <li>\r\n                <Link to=\"/survey\">Survey</Link>\r\n              </li>\r\n              <li>\r\n                <Link to=\"/creator\">Survey Creator</Link>\r\n              </li>\r\n              <li>\r\n                <Link to=\"/export\">PDF Export</Link>\r\n              </li>\r\n              <li>\r\n                <Link to=\"/analytics\">Analytics</Link>\r\n              </li>\r\n              <li>\r\n                <Link to=\"/analyticstabulator\">Results Table</Link>\r\n              </li>\r\n            </ul>\r\n          </div>\r\n        </nav>\r\n\r\n        <div className=\"app-content\">\r\n          <Switch>\r\n            <Route exact path=\"/\">\r\n              <HomePage />\r\n            </Route>\r\n            <Route path=\"/survey\">\r\n              <SurveyPage />\r\n            </Route>\r\n            <Route path=\"/creator\">\r\n              <CreatorPage />\r\n            </Route>\r\n            <Route path=\"/export\">\r\n              <ExportToPDFPage />\r\n            </Route>\r\n            <Route path=\"/analytics\">\r\n              <AnalyticsPage />\r\n            </Route>\r\n            <Route path=\"/analyticstabulator\">\r\n              <AnalyticsTabulatorPage />\r\n            </Route>\r\n          </Switch>\r\n        </div>\r\n      </div>\r\n    </Router>\r\n  );\r\n}\r\n"
  },
  {
    "path": "src/App.test.js",
    "content": "import React from 'react';\nimport ReactDOM from 'react-dom';\nimport \"jest-canvas-mock\";\n\njest.mock('plotly.js-dist-min', () => ({\n  Map: () => ({}),\n}));\n\nimport App from './App';\n\nit('renders without crashing', () => {\n  const div = document.createElement('div');\n  ReactDOM.render(<App />, div);\n  ReactDOM.unmountComponentAtNode(div);\n});\n"
  },
  {
    "path": "src/components/MyQuestion.js",
    "content": "import { Question, Serializer, ElementFactory } from \"survey-core\";\nimport { SurveyElementBase, ReactQuestionFactory } from \"survey-react-ui\";\n\nconst QUESTION_TYPE = \"myquestion\";\n\nexport function registerMyQuestion() {\n  ElementFactory.Instance.registerElement(QUESTION_TYPE, (name) => {\n    return new MyQuestionModel(name);\n  });\n}\n\nexport class MyQuestionModel extends Question {\n  getType() {\n    return QUESTION_TYPE;\n  }\n\n  get text() {\n    return this.getPropertyValue(\"text\", \"\");\n  }\n  set text(newValue) {\n    this.setPropertyValue(\"text\", newValue);\n  }\n}\n\nexport class MyQuestion extends SurveyElementBase {\n  get question() {\n    return this.props.question;\n  }\n  render() {\n    if (!this.question) return null;\n    const cssClasses = this.question.cssClasses;\n    return (\n      <div className={cssClasses.root}>\n        <span>My Text Value: </span><span><b>{this.question.text}</b></span>\n      </div>\n    );\n  }\n}\n\nSerializer.addClass(\n  QUESTION_TYPE,\n  [\n    { name: \"text\" }\n  ],\n  function () {\n    return new MyQuestionModel(\"\");\n  },\n  \"question\"\n);\n\n\nReactQuestionFactory.Instance.registerQuestion(QUESTION_TYPE, props => {\n  return React.createElement(MyQuestion, props);\n});\n"
  },
  {
    "path": "src/components/SurveyAnalytics.js",
    "content": "import { Component } from \"react\";\nimport { data, json } from \"../data/analytics_data\";\nimport { VisualizationPanel } from \"survey-analytics\";\nimport \"survey-analytics/survey.analytics.css\";\nimport { Model } from \"survey-core\";\n\nexport default class SurveyAnalytics extends Component {\n  visPanel;\n  componentDidMount() {\n    const survey = new Model(json);\n    this.visPanel = new VisualizationPanel(survey.getAllQuestions(), data);\n    this.visPanel.render(document.getElementById(\"summaryContainer\"));\n  }\n  render() {\n    return <div id=\"summaryContainer\"></div>;\n  }\n}\n"
  },
  {
    "path": "src/components/SurveyAnalyticsTabulator.js",
    "content": "import { Component } from \"react\";\nimport { data, json } from \"../data/analytics_data\";\n\nimport jsPDF from \"jspdf\";\nimport * as XLSX from \"xlsx\";\nimport \"jspdf-autotable\";\n\nimport { Tabulator } from \"survey-analytics/survey.analytics.tabulator.js\";\nimport { Model } from \"survey-core\";\nimport \"survey-analytics/survey.analytics.tabulator.css\";\nimport \"tabulator-tables/dist/css/tabulator.min.css\";\n\n\nwindow.jsPDF = jsPDF;\nwindow.XLSX = XLSX;\n\nexport default class SurveyAnalyticsTabulator extends Component {\n  visPanel;\n  componentDidMount() {\n    const survey = new Model(json);\n    this.visPanel = new Tabulator(survey, data);\n    this.visPanel.render(document.getElementById(\"summaryContainer\"));\n  }\n  render() {\n    return <div id=\"summaryContainer\"></div>;\n  }\n}\n"
  },
  {
    "path": "src/components/SurveyCreator.js",
    "content": "import { useState } from \"react\";\nimport { SurveyCreatorComponent, SurveyCreator } from \"survey-creator-react\";\nimport { registerMyQuestion } from \"./MyQuestion\";\nimport \"survey-core/defaultV2.css\";\nimport \"survey-creator-core/survey-creator-core.css\";\n\nregisterMyQuestion();\n\nexport default function SurveyCreatorWidget(props) {\n  let [creator, setCreator] = useState();\n\n  if (creator === undefined) {\n    let options = { showLogicTab: true, showTranslationTab: true };\n    creator = new SurveyCreator(options);\n    creator.saveSurveyFunc = (no, callback) => {\n      console.log(JSON.stringify(creator.JSON));\n      callback(no, true);\n    };\n    // creator.tabs().push({\n    //   name: \"survey-templates\",\n    //   title: \"My Custom Tab\",\n    //   template: \"custom-tab-survey-templates\",\n    //   action: () => {\n    //     this.creator.makeNewViewActive(\"survey-templates\");\n    //   },\n    //   data: {},\n    // });\n    setCreator(creator);\n  }\n\n  creator.JSON = props.json;\n\n  return (\n    <div style={{ height: \"calc(100% - 70px)\" }}>\n      {/* <script type=\"text/html\" id=\"custom-tab-survey-templates\">\n          {`<div id=\"test\">TEST</div>`}\n        </script> */}\n      <SurveyCreatorComponent creator={creator} />\n    </div>\n  );\n}\n"
  },
  {
    "path": "src/data/analytics_data.js",
    "content": "export const json = {\n  completedHtml: \"<p style='font-size:24px;'>Thank you for completing the survey! (please wait for analytics to load ...)<p>\",\n  pages: [{\n    name: \"page_info\",\n    elements: [{\n      type: \"radiogroup\",\n      name: \"organization_type\",\n      title: \"Which of the following best describes you or your organization?\",\n      hasOther: true,\n      choices: [{\n        value: \"ISV\",\n        text: \"ISV (building commercial/shrink-wrapped software)\"\n      }, {\n        value: \"Consulting\",\n        text: \"Software consulting firm (providing development services to other organizations)\"\n      }, {\n        value: \"Custom\",\n        text: \"Custom software development (as a freelancer/contractor)\"\n      }, {\n        value: \"In-house\",\n        text: \"In-house software development\"\n      }, {\n        value: \"Hobbyist\",\n        text: \"Hobbyist (developing apps for personal use)\"\n      }],\n      colCount: 2\n    }, {\n      type: \"radiogroup\",\n      name: \"developer_count\",\n      visibleIf: \"{organization_type} != 'Hobbyist'\",\n      title: \"How many software developers are in your organization?\",\n      choices: [\"1\", \"2\", \"3-5\", \"6-10\", \"> 10\"]\n    }, {\n      type: \"radiogroup\",\n      name: \"vertical_market\",\n      visibleIf: \"{organization_type} != 'Hobbyist'\",\n      title: \"Which vertical market does your product serve?\",\n      hasOther: true,\n      choices: [\n        \"Automotive\",\n        \"Banking\",\n        \"Consumer\",\n        \"Education\",\n        \"Engineering\",\n        \"Energy\",\n        \"Fast-moving consumer goods\",\n        \"Financial\",\n        \"FinTech\",\n        \"Food and beverage\",\n        \"Government (federal, state, local)\",\n        \"Healthcare\",\n        \"Insurance\",\n        \"Legal\",\n        \"Manufacturing\",\n        \"Media\",\n        \"Online\",\n        \"Raw materials\",\n        \"Real estate\",\n        \"Religion\",\n        \"Retail\",\n        \"Jewelry\",\n        \"Technology\",\n        \"Telecommunications\",\n        \"Transportation (Travel)\",\n        \"Electronics\",\n        \"Not-for-profit\"\n      ],\n      colCount: 4\n    }, {\n      type: \"radiogroup\",\n      name: \"product_discovering\",\n      title: \"How did you discover our product?\",\n      hasOther: true,\n      choices: [\n        \"Search engine\",\n        \"GitHub\",\n        \"Friend or colleague\",\n        \"Reddit\",\n        \"Medium\",\n        \"Twitter\",\n        \"Facebook\"\n      ],\n      otherText: \"Other\",\n      colCount: 3\n    }]\n  }, {\n    name: \"page_libraries_usage\",\n    elements: [{\n      type: \"checkbox\",\n      name: \"javascript_frameworks\",\n      title: \"Which JavaScript frameworks do you use?\",\n      hasOther: true,\n      choices: [\n        \"React\",\n        \"Angular\",\n        \"jQuery\",\n        \"Vue\",\n        \"Meteor\",\n        \"Ember\",\n        \"Backbone\",\n        \"Knockout\",\n        \"Aurelia\",\n        \"Polymer\",\n        \"Mithril\",\n      ],\n      choicesOrder: \"asc\",\n      otherText: \"Other\",\n      colCount: 3\n    }, {\n      type: \"checkbox\",\n      name: \"backend_language\",\n      title: \"Which web backend programming languages do you use?\",\n      hasOther: true,\n      choices: [\n        \"Java\",\n        \"Python\",\n        \"Node.js\",\n        \"Go\",\n        \"Django\",\n        \"C#\",\n        \"Ruby\",\n      ],\n      choicesOrder: \"asc\",\n      otherText: \"Other\",\n      colCount: 3\n    }],\n  }, {\n    name: \"page_product_usage\",\n    elements: [{\n      type: \"radiogroup\",\n      name: \"useproduct\",\n      title: \"Do you currently use our components?\",\n      isRequired: true,\n      choices: [\"Yes\", \"No\"],\n    }, {\n      type: \"checkbox\",\n      name: \"usecomponents\",\n      visibleIf: '{useproduct} = \"Yes\"',\n      title: \"Which of our components do you use?\",\n      isRequired: true,\n      choices: [\"Survey Library (Runner)\", \"Survey Creator\", \"Export to PDF\", \"SurveyJS Analytics\"]\n    }, {\n      type: \"checkbox\",\n      name: \"supported_devices\",\n      title: \"Which device types do you need to support?\",\n      isRequired: true,\n      choices: [ \"Desktop\", \"Tablet\", \"Mobile\" ],\n    }, {\n      type: \"radiogroup\",\n      name: \"native_mobile_support\",\n      visibleIf: '{supported_devices} contains \"Mobile\"',\n      title: \"How important for you is native mobile support?\",\n      isRequired: true,\n      choices: [{\n        value: 1,\n        text: \"I am happy with adaptive HTML rendering\"\n      }, {\n        value: 2,\n        text: \"Somewhat important, but adaptive HTML rendering is fine\"\n      }, {\n        value: 3,\n        text: \"Very important\"\n      }, {\n        value: 4,\n        text: \"Cannot use your components without it\"\n      }]\n    }, {\n      type: \"radiogroup\",\n      name: \"native_framework\",\n      visibleIf: \"{native_mobile_support} >= 3\",\n      title: \"Which framework are you using or going to use for native mobile developlment?\",\n      hasOther: true,\n      choices: [\n        \"React Native\",\n        \"NativeScript\",\n        \"Ionic\",\n        \"Xamarin\",\n        \"Native iOS and Android apps\",\n      ],\n      otherText: \"Other\",\n      colCount: 2\n    }],\n  }, {\n      name: \"page_alternative\",\n      elements: [{\n        type: \"radiogroup\",\n        name: \"product_alternative\",\n        title: \"What would you use as an alternative if our product didn't exist?\",\n        isRequired: true,\n        hasOther: true,\n        choices: [\"Popular cloud-based platforms\", \"Self-developed solution\"],\n        otherText: \"Other\"\n      }, {\n        type: \"text\",\n        name: \"survey_cloud_platform\",\n        visibleIf: '{product_alternative} = \"Popular cloud-based platforms\"',\n        title: \"What cloud-based platform would you choose?\"\n      }, {\n        type: \"radiogroup\",\n        name: \"product_recommend\",\n        title: \"Have you recommended our product to anyone?\",\n        choices: [\"Yes\", \"No\"]\n      }]\n    }, {\n      name: \"page_recommend\",\n      elements: [{\n        type: \"rating\",\n        name: \"nps_score\",\n        title: \"How likely are you to recommend our product to a friend or colleague?\",\n        isRequired: true,\n        rateMin: 0,\n        rateMax: 10,\n        minRateDescription: \"Most unlikely\",\n        maxRateDescription: \"Most likely\"\n      }, {\n        type: \"comment\",\n        name: \"favorite_functionality\",\n        title: \"What feature do you find most useful in our product?\"\n      }, {\n        type: \"comment\",\n        name: \"product_improvement\",\n        title: \"How could our components be improved to meet your needs better?\"\n      }]\n    }\n  ]\n};\n\n// Survey results\nconst firstResult = {\n  organization_type: \"In-house\",\n  developer_count: \"1\",\n  vertical_market: \"Education\",\n  product_discovering: \"GitHub\",\n  javascript_frameworks: [\"jQuery\"],\n  backend_language: [\"Ruby\"],\n  useproduct: \"Yes\",\n  usecomponents: [\"Survey Library (Runner)\"],\n  supported_devices: [\"Desktop\", \"Tablet\", \"Mobile\"],\n  native_mobile_support: 2,\n  product_alternative: \"Self-developed solution\",\n  product_recommend: \"Yes\",\n  nps_score: 6,\n  product_improvement: \"The lack of accessibility is a huge disadvantage. That's one reason why I cannot use it in all my projects.\",\n  native_framework: \"\",\n  survey_cloud_platform: \"\",\n  favorite_functionality: \"\",\n};\n\nconst secondResult = {\n  organization_type: \"Consulting\",\n  developer_count: \"3-5\",\n  vertical_market: \"Government (federal, state, local)\",\n  product_discovering: \"Search engine\",\n  javascript_frameworks: [\"Vue\", \"jQuery\", \"other\"],\n  backend_language: [\"Python\", \"Node.js\"],\n  useproduct: \"Yes\",\n  usecomponents: [\"Survey Library (Runner)\"],\n  supported_devices: [\"Desktop\"],\n  product_alternative: \"Develop ourselves\",\n  product_recommend: \"Yes\",\n  nps_score: 8,\n  native_mobile_support: \"\",\n  native_framework: \"\",\n  survey_cloud_platform: \"\",\n  favorite_functionality: \"\",\n  product_improvement: \"\",\n};\n\nexport const data = [firstResult, secondResult];"
  },
  {
    "path": "src/data/survey_json.js",
    "content": "export const json = {\n  completedHtml: \"<h3>Thank you for your feedback</h3> <h5>Your thoughts and ideas will help us improve our product.</h5>\",\n  completedHtmlOnCondition: [{\n    expression: \"{nps_score} > 8\",\n    html: \"<h3>Thank you for your feedback</h3> <h5>We are glad that you love our product. Your ideas and suggestions will help us make it even better.</h5>\"\n  }, {\n    expression: \"{nps_score} < 7\",\n    html: \"<h3>Thank you for your feedback</h3> <h5>We are glad that you shared your ideas with us. They will help us make our product better.</h5>\"\n  }],\n  pages: [{\n    name: \"page1\",\n    elements: [{\n      type: \"rating\",\n      name: \"nps_score\",\n      title: \"On a scale of zero to ten, how likely are you to recommend our product to a friend or colleague?\",\n      isRequired: true,\n      rateMin: 0,\n      rateMax: 10,\n      minRateDescription: \"(Most unlikely)\",\n      maxRateDescription: \"(Most likely)\"\n    }, {\n      type: \"checkbox\",\n      name: \"promoter_features\",\n      visibleIf: \"{nps_score} >= 9\",\n      title: \"Which of the following features do you value the most?\",\n      isRequired: true,\n      validators: [{\n        type: \"answercount\",\n        text: \"Please select two features maximum.\",\n        maxCount: 2\n      }],\n      hasOther: true,\n      choices: [\n        \"Performance\",\n        \"Stability\",\n        \"User Interface\",\n        \"Complete Functionality\"\n      ],\n      otherText: \"Other features:\",\n      colCount: 2\n    }, {\n      type: \"comment\",\n      name: \"passive_experience\",\n      visibleIf: \"{nps_score} > 6  and {nps_score} < 9\",\n      title: \"What is the primary reason for your score?\"\n    }, {\n      type: \"comment\",\n      name: \"disappointed_experience\",\n      visibleIf: \"{nps_score} notempty\",\n      title: \"What do you miss and find disappointing in your experience with our product?\"\n    }]\n  }],\n  showQuestionNumbers: \"off\"\n};"
  },
  {
    "path": "src/index.css",
    "content": "body {\n  margin: 0;\n  padding: 0;\n  font-family: sans-serif;\n}\n"
  },
  {
    "path": "src/index.js",
    "content": "import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport registerServiceWorker from './registerServiceWorker';\n\nReactDOM.render(<App />, document.getElementById('root'));\nregisterServiceWorker();\n"
  },
  {
    "path": "src/pages/Analytics.js",
    "content": "import SurveyAnalytics from \"../components/SurveyAnalytics\";\n\nexport function AnalyticsPage() {\n  return (\n    <div>\n      <h1>Survey Analytics</h1>\n      <SurveyAnalytics />\n    </div>\n  );\n}\n"
  },
  {
    "path": "src/pages/AnalyticsTabulator.js",
    "content": "import SurveyAnalyticsTabulator from \"../components/SurveyAnalyticsTabulator\";\n\nexport function AnalyticsTabulatorPage() {\n  return (\n    <div>\n      <h1>Survey Analytics - Table View</h1>\n      <span>Uses Tabulator supported only by modern browsers.</span>\n      <SurveyAnalyticsTabulator />\n    </div>\n  );\n}\n"
  },
  {
    "path": "src/pages/Creator.js",
    "content": "import SurveyCreator from \"../components/SurveyCreator\";\n\nimport { json } from \"../data/survey_json.js\";\n\nexport function CreatorPage() {\n  return (\n    <>\n      <h1>Survey Creator / Form Builder</h1>\n      <SurveyCreator json={json} />\n    </>\n  );\n}\n"
  },
  {
    "path": "src/pages/Export.js",
    "content": "import { Model } from \"survey-core\";\nimport { SurveyPDF } from \"survey-pdf\";\n\nimport { json } from \"../data/survey_json.js\";\n\nfunction savePDF(model) {\n  const surveyPDF = new SurveyPDF(json);\n  surveyPDF.data = model.data;\n  surveyPDF.save();\n};\n\nexport function ExportToPDFPage() {\n  const model = new Model(json);\n  return (\n    <div className=\"container\">\n      <h1>SurveyJS PDF Export</h1>\n      <div className=\"jumbotron\">\n        <p>SurveyJS PDF Export is a client-side extension over the SurveyJS Library that enables users to save surveys as PDF documents.</p>\n        <p>NOTE: Dynamic elements and characteristics (visibility, validation, navigation buttons) are not supported.</p>\n        <p>Click the button below to export survey to a PDF document.</p>\n        <button onClick={() => savePDF(model)}>Save as PDF</button>\n      </div>\n    </div>\n  );\n}\n"
  },
  {
    "path": "src/pages/Home.js",
    "content": "import logo from \"../logo.svg\";\n\nexport function HomePage() {\n  return (\n    <div className=\"container\">\n      <div className=\"col-lg-3 centered\">\n        <img className=\"App-logo\" src={logo} alt=\"ReactJS\"/>\n      </div>\n      <h1>SurveyJS + React Quickstart Template</h1>\n      <div className=\"col-lg-9 jumbotron\">\n        <p>\n          SurveyJS is a set of JavaScript components that allow you and your users to build surveys / forms, store them in your database, and visualize survey results for data analysis. This quick start template uses the following SurveyJS components:\n        </p>\n        <ul>\n          <li><a href=\"https://surveyjs.io/Documentation/Library?id=LibraryOverview\" target=\"_blank\">SurveyJS Library / Runner</a></li>\n          <li><a href=\"https://surveyjs.io/Documentation/Survey-Creator?id=Survey-Creator-Overview\" target=\"_blank\">Survey Creator / Form Builder</a></li>\n          <li><a href=\"https://surveyjs.io/Documentation/Pdf-Export?id=PdfExportOverview\" target=\"_blank\">PDF Export</a></li>\n          <li><a href=\"https://surveyjs.io/Documentation/Analytics?id=AnalyticsOverview\" target=\"_blank\">Survey Analytics</a></li>\n        </ul>\n      </div>\n    </div>\n  );\n  }\n  "
  },
  {
    "path": "src/pages/Survey.js",
    "content": "import React from \"react\";\nimport { Model, StylesManager } from \"survey-core\";\nimport { Survey } from \"survey-react-ui\";\nimport \"survey-core/defaultV2.css\";\n\nimport { json } from \"../data/survey_json.js\";\n\nStylesManager.applyTheme(\"defaultV2\");\n\nfunction onValueChanged(_, options) {\n  console.log(\"New value: \" + options.value);\n}\n\nfunction onComplete(survey) {\n  console.log(\"Survey complete! Results: \" + JSON.stringify(survey.data));\n}\n\nexport function SurveyPage() {\n  const model = new Model(json);\n  return (\n    <div className=\"container\">\n      <h1>SurveyJS Library / Runner</h1>\n      <Survey\n        model={model}\n        onComplete={onComplete}\n        onValueChanged={onValueChanged}\n      />\n    </div>\n  );\n}\n"
  },
  {
    "path": "src/registerServiceWorker.js",
    "content": "// In production, we register a service worker to serve assets from local cache.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on the \"N+1\" visit to a page, since previously\n// cached resources are updated in the background.\n\n// To learn more about the benefits of this model, read https://goo.gl/KwvDNy.\n// This link also includes instructions on opting out of this behavior.\n\nconst isLocalhost = Boolean(\n  window.location.hostname === 'localhost' ||\n    // [::1] is the IPv6 localhost address.\n    window.location.hostname === '[::1]' ||\n    // 127.0.0.1/8 is considered localhost for IPv4.\n    window.location.hostname.match(\n      /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n    )\n);\n\nexport default function register() {\n  if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n    // The URL constructor is available in all browsers that support SW.\n    const publicUrl = new URL(process.env.PUBLIC_URL, window.location);\n    if (publicUrl.origin !== window.location.origin) {\n      // Our service worker won't work if PUBLIC_URL is on a different origin\n      // from what our page is served on. This might happen if a CDN is used to\n      // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374\n      return;\n    }\n\n    window.addEventListener('load', () => {\n      const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n      if (isLocalhost) {\n        // This is running on localhost. Lets check if a service worker still exists or not.\n        checkValidServiceWorker(swUrl);\n\n        // Add some additional logging to localhost, pointing developers to the\n        // service worker/PWA documentation.\n        navigator.serviceWorker.ready.then(() => {\n          console.log(\n            'This web app is being served cache-first by a service ' +\n              'worker. To learn more, visit https://goo.gl/SC7cgQ'\n          );\n        });\n      } else {\n        // Is not local host. Just register service worker\n        registerValidSW(swUrl);\n      }\n    });\n  }\n}\n\nfunction registerValidSW(swUrl) {\n  navigator.serviceWorker\n    .register(swUrl)\n    .then(registration => {\n      registration.onupdatefound = () => {\n        const installingWorker = registration.installing;\n        installingWorker.onstatechange = () => {\n          if (installingWorker.state === 'installed') {\n            if (navigator.serviceWorker.controller) {\n              // At this point, the old content will have been purged and\n              // the fresh content will have been added to the cache.\n              // It's the perfect time to display a \"New content is\n              // available; please refresh.\" message in your web app.\n              console.log('New content is available; please refresh.');\n            } else {\n              // At this point, everything has been precached.\n              // It's the perfect time to display a\n              // \"Content is cached for offline use.\" message.\n              console.log('Content is cached for offline use.');\n            }\n          }\n        };\n      };\n    })\n    .catch(error => {\n      console.error('Error during service worker registration:', error);\n    });\n}\n\nfunction checkValidServiceWorker(swUrl) {\n  // Check if the service worker can be found. If it can't reload the page.\n  fetch(swUrl)\n    .then(response => {\n      // Ensure service worker exists, and that we really are getting a JS file.\n      if (\n        response.status === 404 ||\n        response.headers.get('content-type').indexOf('javascript') === -1\n      ) {\n        // No service worker found. Probably a different app. Reload the page.\n        navigator.serviceWorker.ready.then(registration => {\n          registration.unregister().then(() => {\n            window.location.reload();\n          });\n        });\n      } else {\n        // Service worker found. Proceed as normal.\n        registerValidSW(swUrl);\n      }\n    })\n    .catch(() => {\n      console.log(\n        'No internet connection found. App is running in offline mode.'\n      );\n    });\n}\n\nexport function unregister() {\n  if ('serviceWorker' in navigator) {\n    navigator.serviceWorker.ready.then(registration => {\n      registration.unregister();\n    });\n  }\n}\n"
  }
]