@constructor-io/constructorio-ui-quizzes 1.0.2 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,14 +13,16 @@ A UI Library that provides React components to manage the fetching and rendering
13
13
 
14
14
  ![Quizzes-UI-Example](assets/coffee-quiz.gif)
15
15
 
16
- ## How to use this UI Library
17
-
18
- ### Install
16
+ ## Installation
19
17
 
20
18
  ```bash
21
19
  npm i @constructor-io/constructorio-ui-quizzes
22
20
  ```
23
21
 
22
+ ## Usage
23
+
24
+ ### Using the React Component
25
+
24
26
  The `CioQuiz` component handles state management, data fetching, and rendering logic for the entire quiz.
25
27
 
26
28
  ```jsx
@@ -33,6 +35,26 @@ function YourComponent() {
33
35
  </div>
34
36
  );
35
37
  ```
38
+ ### Using the Javascript Bundle
39
+
40
+ This 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`.
41
+ In addition to [Quiz component props](https://constructor-io.github.io/constructorio-ui-quizzes/?path=/docs/quiz-component--docs), this function also accepts `selector` and `includeCSS`.
42
+
43
+ ```js
44
+ import CioQuiz from "@constructor-io/constructorio-ui-quizzes/constructorio-ui-quizzes-bundled";
45
+
46
+ CioQuiz({
47
+ selector: "#quiz-container",
48
+ quizId: "coffee-quiz",
49
+ apiKey: "key_wJSdZSiesX5hiVLt",
50
+ includeCSS: true, // Include the default CSS styles. Defaults to true.
51
+ resultsPageOptions: {
52
+ addToCartCallback: (item) => console.dir(item),
53
+ resultCardRegularPriceKey: "price",
54
+ }
55
+ // ... additional arguments
56
+ });
57
+ ```
36
58
 
37
59
  ## Custom Styling
38
60