@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 +25 -3
- package/dist/constructorio-ui-quizzes-bundled.js +42 -0
- package/lib/cjs/components/CioQuiz/index.js +1 -0
- package/lib/cjs/components/ResultCard/ResultCard.js +37 -15
- package/lib/cjs/components/ResultContainer/ResultContainer.js +15 -3
- package/lib/cjs/components/ResultCtaButton/ResultCtaButton.js +20 -2
- package/lib/cjs/components/Results/Results.js +2 -2
- package/lib/cjs/utils.js +2 -1
- package/lib/mjs/components/CioQuiz/index.js +1 -0
- package/lib/mjs/components/ResultCard/ResultCard.js +32 -14
- package/lib/mjs/components/ResultContainer/ResultContainer.js +15 -3
- package/lib/mjs/components/ResultCtaButton/ResultCtaButton.js +19 -2
- package/lib/mjs/components/Results/Results.js +1 -1
- package/lib/mjs/utils.js +2 -1
- package/lib/types/components/CioQuiz/context.d.ts +4 -2
- package/lib/types/components/ResultCard/ResultCard.d.ts +1 -0
- package/lib/types/components/ResultCtaButton/ResultCtaButton.d.ts +1 -0
- package/lib/types/hooks/useCioClient.d.ts +1 -1
- package/lib/types/types.d.ts +1 -1
- package/lib/types/utils.d.ts +1 -1
- package/package.json +13 -6
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
|

|
|
15
15
|
|
|
16
|
-
##
|
|
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
|
|