{"id":26103320,"url":"https://github.com/constructor-io/constructorio-ui-quizzes","last_synced_at":"2026-03-11T13:21:17.792Z","repository":{"id":153521890,"uuid":"583021192","full_name":"Constructor-io/constructorio-ui-quizzes","owner":"Constructor-io","description":"Constructor.io Quizzes UI library for web applications","archived":false,"fork":false,"pushed_at":"2025-03-28T22:54:34.000Z","size":17824,"stargazers_count":8,"open_issues_count":2,"forks_count":2,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-12T17:23:17.223Z","etag":null,"topics":["constructorio-integrations","javascript","quizzes","react","react-hooks","typescript"],"latest_commit_sha":null,"homepage":"https://constructor-io.github.io/constructorio-ui-quizzes/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Constructor-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-28T14:29:24.000Z","updated_at":"2025-02-19T17:05:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"84bf5572-af77-416c-a52d-20708e09c710","html_url":"https://github.com/Constructor-io/constructorio-ui-quizzes","commit_stats":{"total_commits":302,"total_committers":18,"mean_commits":16.77777777777778,"dds":0.5960264900662251,"last_synced_commit":"fa2a67afdae9f4c711446578b01827a54e138c77"},"previous_names":[],"tags_count":104,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Constructor-io%2Fconstructorio-ui-quizzes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Constructor-io%2Fconstructorio-ui-quizzes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Constructor-io%2Fconstructorio-ui-quizzes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Constructor-io%2Fconstructorio-ui-quizzes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Constructor-io","download_url":"https://codeload.github.com/Constructor-io/constructorio-ui-quizzes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248602867,"owners_count":21131704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["constructorio-integrations","javascript","quizzes","react","react-hooks","typescript"],"created_at":"2025-03-09T20:06:22.145Z","updated_at":"2026-03-11T13:21:17.778Z","avatar_url":"https://github.com/Constructor-io.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Constructor.io Quizzes UI Library\n\n[![npm](https://img.shields.io/npm/v/@constructor-io/constructorio-ui-quizzes)](https://www.npmjs.com/package/@constructor-io/constructorio-ui-quizzes)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Constructor-io/constructorio-ui-quizzes/blob/main/LICENSE)\n\nA UI Library that provides React components to manage the fetching and rendering logic for [Constructor.io's Quizzes](https://constructor.io/products/quizzes/).\n\n## Introduction\n\n[Constructor.io's Quizzes](https://constructor.io/products/quizzes/) are interactive experiences that personalize the shopping journey for each of your customers. This UI library simplifies the integration process by providing React Components that handle the fetching and rendering logic for Quizzes. Typescript support is available.\n\n[Our storybook docs](https://constructor-io.github.io/constructorio-ui-quizzes) are the best place to explore the behavior and the available configuration options for this UI Library.\n\n![Quizzes-UI-Example](assets/coffee-quiz.gif)\n\n## Installation\n\n```bash\nnpm i @constructor-io/constructorio-ui-quizzes\n```\n\n## Usage\n\n### Using the React Component\n\nThe `CioQuiz` component handles state management, data fetching, and rendering logic for the entire quiz.\n\n```jsx\nimport CioQuiz from '@constructor-io/constructorio-ui-quizzes';\n\nfunction YourComponent() {\n  return (\n    \u003cdiv\u003e\n      \u003cCioQuiz quizId='coffee-quiz' apiKey='key_n4SkMH5PFWLdStQZ' /\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\n### Using the Javascript Bundle\n\nThis is a framework agnostic method that can be used in any JavaScript project. The `CioQuiz` function provides a simple interface to inject an entire Quizzes UI into the provided `selector`.\nIn addition to [Quiz component props](https://constructor-io.github.io/constructorio-ui-quizzes/?path=/docs/quiz-cioquiz--props), this function also accepts `selector` and `includeCSS`.\n\n```js\nimport CioQuiz from '@constructor-io/constructorio-ui-quizzes/constructorio-ui-quizzes-bundled';\n\nCioQuiz({\n  selector: '#quiz-container',\n  quizId: 'coffee-quiz',\n  apiKey: 'key_n4SkMH5PFWLdStQZ',\n  includeCSS: true, // Include the default CSS styles. Defaults to true.\n  resultCardOptions: {\n    resultCardRegularPriceKey: 'price',\n  },\n  questionsPageOptions: {\n    skipQuestionButtonText: 'Skip',\n  },\n  // ... additional arguments\n});\n```\n\n## Custom Styling\n\n### Library defaults\n\nBy default, importing React components from this library does not pull any css into your project.\n\nIf you wish to use some starter styles from this library, add an import statement similar to the example import statement below:\n\n```js\nimport '@constructor-io/constructorio-ui-quizzes/styles.css';\n```\n\n- These starter styles can be used as a foundation to build on top of, or just as a reference for you to replace completely.\n- To opt out of all default styling, do not import the `styles.css` stylesheet.\n- All starter styles in this library are scoped within the `.cio-quiz` css selector.\n- These starter styles are intended to be extended by layering in your own css rules\n- If you import the starter styles, `CioQuiz` component will take up the full width and height of its parent container\n\n\u003e Please note the starter styles utilize @container queries and enable responsive styles for our quizzes based on the size of their container element. Since this feature is supported by modern browsers, polyfills have not been included in this library. However, if you want to support older browsers, you can add fallback styles or use a [polyfill](https://github.com/GoogleChromeLabs/container-query-polyfill).\n\n## Troubleshooting\n\n### Known Issues\n\n**Older Javascript environments**\n\nThe library provides two different builds. CommonJS (cjs) and ECMAScript Modules (mjs)\n\nFor ECMAScript Modules (mjs) build. The Javascript version is ESNext which might not be supported by your environment.\nIf that's the case and your environment is using an older Javascript version like ES6 (ES2015), you might get this error.\n\n`Module parse failed: Unexpected token (15:32)\nYou may need an appropriate loader to handle this file type, currently no loaders are configured to process this file`\n\nTo solve this you can import the CommonJS (cjs) build which supports ES6 (ES2015) syntax:\n\n`import CioQuiz from '@constructor-io/constructorio-ui-quizzes/cjs'`\n\n**ESLint**\n\nThere is a known issue with ESLint where it fails to resolve the paths exposed in the `exports` statement of NPM packages. If you are receiving the following error, you can safely disable ESLint using `// eslint-disable-line` for that line.\n\n`Unable to resolve path to module '@constructor-io/constructorio-ui-quizzes/styles.css'`\n\nRelevant open issues:\n\n[Issue 1868](https://github.com/import-js/eslint-plugin-import/issues/1868)\n\n[Issue 1810](https://github.com/import-js/eslint-plugin-import/issues/1810)\n\n## Local Development\n\n### Development scripts\n\n```bash\nnpm ci                  # install dependencies for local dev\nnpm run dev             # start a local dev server for Storybook\nnpm run lint            # run linter\n```\n\n## Publishing new versions\n\nDispatch the [Publish](https://github.com/Constructor-io/constructorio-ui-quizzes/actions/workflows/publish.yml) workflow in GitHub Actions. You're required to provide two arguments:\n\n- **Version Strategy**: `major`, `minor`, or `patch`.\n- **Title**: A title for the release.\n\nThis workflow will automatically:\n\n1. Bump the library version using the provided strategy.\n2. Create a new git tag.\n3. Create a new GitHub release.\n4. Compile the library.\n5. Publish the new version to NPM.\n6. Deploy the Storybook docs to GitHub Pages.\n7. Report the progress on the [relevant Slack channel](https://constructor.slack.com/archives/C061D3CFVR9).\n\n#### ℹ️ Note: Please don't manually increase the package.json version or create new git tags.\n\nThe library version is tracked by releases and git tags. We intentionally keep the package.json version at `0.0.0` to avoid pushing changes to the `main` branch. This solves many security concerns by avoiding the need for branch-protection rule exceptions.\n\n## New Storybook Version\n\nDispatch the [Deploy Storybook](https://github.com/Constructor-io/constructorio-ui-quizzes/actions/workflows/deploy-storybook.yml) workflow in GitHub Actions.\n\n#### ℹ️ Note: This is already done automatically when publishing a new version.\n\n## Supporting Docs\n\n- [Storybook 7 Introduction](https://storybook.js.org/docs/7.0/react/get-started/introduction)\n- [Typescript Docs](https://www.typescriptlang.org/docs/)\n\n## Demoing quizzes in a sandbox environment\n\nPlease fork from the following code sandboxes to experiment with the quizzes UI library integrated in various approaches.\n\n- [Simple React app](https://codesandbox.io/s/quizzes-ui-integration-3cggdh)\n- [Plain HTML, CSS, JS](https://codesandbox.io/s/quizzes-ui-integration-plain-4f4dns)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconstructor-io%2Fconstructorio-ui-quizzes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconstructor-io%2Fconstructorio-ui-quizzes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconstructor-io%2Fconstructorio-ui-quizzes/lists"}