@mulmochat-plugin/quiz 0.3.2 → 0.4.0
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/dist/core.cjs +1 -1
- package/dist/core.js +2 -144
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -9
- package/dist/plugin-BDTug9SB.cjs +1 -0
- package/dist/plugin-Dc-SF02-.js +147 -0
- package/dist/react.cjs +3 -4
- package/dist/react.js +307 -395
- package/dist/style.css +3 -1
- package/dist/vue.cjs +2 -3
- package/dist/vue.js +90 -145
- package/package.json +17 -15
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./plugin-BDTug9SB.cjs`);exports.SAMPLES=e.r,exports.TOOL_DEFINITION=e.i,exports.TOOL_NAME=e.a,exports.executeQuiz=e.t,exports.pluginCore=e.n;
|
package/dist/core.js
CHANGED
|
@@ -1,144 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
name: n,
|
|
4
|
-
description: "Present a set of multiple choice questions to test the user's knowledge or abilities. Each question should have 2-6 answer choices.",
|
|
5
|
-
parameters: {
|
|
6
|
-
type: "object",
|
|
7
|
-
properties: {
|
|
8
|
-
title: {
|
|
9
|
-
type: "string",
|
|
10
|
-
description: "Optional title for the quiz (e.g., 'JavaScript Basics Quiz')"
|
|
11
|
-
},
|
|
12
|
-
questions: {
|
|
13
|
-
type: "array",
|
|
14
|
-
description: "Array of multiple choice questions",
|
|
15
|
-
items: {
|
|
16
|
-
type: "object",
|
|
17
|
-
properties: {
|
|
18
|
-
question: {
|
|
19
|
-
type: "string",
|
|
20
|
-
description: "The question text"
|
|
21
|
-
},
|
|
22
|
-
choices: {
|
|
23
|
-
type: "array",
|
|
24
|
-
description: "Array of answer choices (2-6 choices)",
|
|
25
|
-
items: {
|
|
26
|
-
type: "string"
|
|
27
|
-
},
|
|
28
|
-
minItems: 2,
|
|
29
|
-
maxItems: 6
|
|
30
|
-
},
|
|
31
|
-
correctAnswer: {
|
|
32
|
-
type: "number",
|
|
33
|
-
description: "Optional: The index of the correct answer (0-based). Include this if you want to track correct answers."
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
required: ["question", "choices"]
|
|
37
|
-
},
|
|
38
|
-
minItems: 1
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
required: ["questions"]
|
|
42
|
-
}
|
|
43
|
-
}, c = [
|
|
44
|
-
{
|
|
45
|
-
name: "JavaScript Quiz",
|
|
46
|
-
args: {
|
|
47
|
-
title: "JavaScript Basics",
|
|
48
|
-
questions: [
|
|
49
|
-
{
|
|
50
|
-
question: "What does 'const' do in JavaScript?",
|
|
51
|
-
choices: [
|
|
52
|
-
"Declares a constant variable",
|
|
53
|
-
"Declares a mutable variable",
|
|
54
|
-
"Creates a function",
|
|
55
|
-
"Imports a module"
|
|
56
|
-
],
|
|
57
|
-
correctAnswer: 0
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
question: "Which method adds an element to the end of an array?",
|
|
61
|
-
choices: ["pop()", "shift()", "push()", "unshift()"],
|
|
62
|
-
correctAnswer: 2
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
question: "What is the output of: typeof null?",
|
|
66
|
-
choices: ['"null"', '"undefined"', '"object"', '"boolean"'],
|
|
67
|
-
correctAnswer: 2
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: "World Capitals",
|
|
74
|
-
args: {
|
|
75
|
-
title: "World Capitals Quiz",
|
|
76
|
-
questions: [
|
|
77
|
-
{
|
|
78
|
-
question: "What is the capital of Japan?",
|
|
79
|
-
choices: ["Osaka", "Kyoto", "Tokyo", "Hiroshima"],
|
|
80
|
-
correctAnswer: 2
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
question: "What is the capital of Australia?",
|
|
84
|
-
choices: ["Sydney", "Melbourne", "Canberra", "Brisbane"],
|
|
85
|
-
correctAnswer: 2
|
|
86
|
-
}
|
|
87
|
-
]
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: "Simple Yes/No",
|
|
92
|
-
args: {
|
|
93
|
-
questions: [
|
|
94
|
-
{
|
|
95
|
-
question: "Is the Earth round?",
|
|
96
|
-
choices: ["Yes", "No"],
|
|
97
|
-
correctAnswer: 0
|
|
98
|
-
}
|
|
99
|
-
]
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
], u = async (h, o) => {
|
|
103
|
-
try {
|
|
104
|
-
const { title: s, questions: e } = o;
|
|
105
|
-
if (!e || !Array.isArray(e) || e.length === 0)
|
|
106
|
-
throw new Error("At least one question is required");
|
|
107
|
-
for (let t = 0; t < e.length; t++) {
|
|
108
|
-
const r = e[t];
|
|
109
|
-
if (!r.question || typeof r.question != "string")
|
|
110
|
-
throw new Error(`Question ${t + 1} must have a question text`);
|
|
111
|
-
if (!Array.isArray(r.choices) || r.choices.length < 2)
|
|
112
|
-
throw new Error(`Question ${t + 1} must have at least 2 choices`);
|
|
113
|
-
if (r.choices.length > 6)
|
|
114
|
-
throw new Error(`Question ${t + 1} cannot have more than 6 choices`);
|
|
115
|
-
}
|
|
116
|
-
const i = {
|
|
117
|
-
title: s,
|
|
118
|
-
questions: e
|
|
119
|
-
};
|
|
120
|
-
return {
|
|
121
|
-
message: `Quiz presented with ${e.length} question${e.length > 1 ? "s" : ""}`,
|
|
122
|
-
jsonData: i,
|
|
123
|
-
instructions: "The quiz has been presented to the user. Wait for the user to submit their answers. They will tell you their answers in text format."
|
|
124
|
-
};
|
|
125
|
-
} catch (s) {
|
|
126
|
-
return console.error("Quiz creation error", s), {
|
|
127
|
-
message: `Quiz error: ${s instanceof Error ? s.message : "Unknown error"}`,
|
|
128
|
-
instructions: "Acknowledge that there was an error creating the quiz and suggest trying again."
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
}, l = {
|
|
132
|
-
toolDefinition: a,
|
|
133
|
-
execute: u,
|
|
134
|
-
generatingMessage: "Preparing quiz...",
|
|
135
|
-
isEnabled: () => !0,
|
|
136
|
-
samples: c
|
|
137
|
-
};
|
|
138
|
-
export {
|
|
139
|
-
c as SAMPLES,
|
|
140
|
-
a as TOOL_DEFINITION,
|
|
141
|
-
n as TOOL_NAME,
|
|
142
|
-
u as executeQuiz,
|
|
143
|
-
l as pluginCore
|
|
144
|
-
};
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "./plugin-Dc-SF02-.js";
|
|
2
|
+
export { r as SAMPLES, t as TOOL_DEFINITION, e as TOOL_NAME, i as executeQuiz, n as pluginCore };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./plugin-BDTug9SB.cjs`);require(`./core.cjs`),exports.SAMPLES=e.r,exports.TOOL_DEFINITION=e.i,exports.TOOL_NAME=e.a,exports.default=e.n,exports.pluginCore=e.n,exports.executeQuiz=e.t;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
o as TOOL_DEFINITION,
|
|
5
|
-
r as TOOL_NAME,
|
|
6
|
-
i as default,
|
|
7
|
-
l as executeQuiz,
|
|
8
|
-
p as pluginCore
|
|
9
|
-
};
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "./plugin-Dc-SF02-.js";
|
|
2
|
+
import "./core.js";
|
|
3
|
+
export { r as SAMPLES, t as TOOL_DEFINITION, e as TOOL_NAME, n as default, n as pluginCore, i as executeQuiz };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`putQuestions`,t={type:`function`,name:e,description:`Present a set of multiple choice questions to test the user's knowledge or abilities. Each question should have 2-6 answer choices.`,parameters:{type:`object`,properties:{title:{type:`string`,description:`Optional title for the quiz (e.g., 'JavaScript Basics Quiz')`},questions:{type:`array`,description:`Array of multiple choice questions`,items:{type:`object`,properties:{question:{type:`string`,description:`The question text`},choices:{type:`array`,description:`Array of answer choices (2-6 choices)`,items:{type:`string`},minItems:2,maxItems:6},correctAnswer:{type:`number`,description:`Optional: The index of the correct answer (0-based). Include this if you want to track correct answers.`}},required:[`question`,`choices`]},minItems:1}},required:[`questions`]}},n=[{name:`JavaScript Quiz`,args:{title:`JavaScript Basics`,questions:[{question:`What does 'const' do in JavaScript?`,choices:[`Declares a constant variable`,`Declares a mutable variable`,`Creates a function`,`Imports a module`],correctAnswer:0},{question:`Which method adds an element to the end of an array?`,choices:[`pop()`,`shift()`,`push()`,`unshift()`],correctAnswer:2},{question:`What is the output of: typeof null?`,choices:[`"null"`,`"undefined"`,`"object"`,`"boolean"`],correctAnswer:2}]}},{name:`World Capitals`,args:{title:`World Capitals Quiz`,questions:[{question:`What is the capital of Japan?`,choices:[`Osaka`,`Kyoto`,`Tokyo`,`Hiroshima`],correctAnswer:2},{question:`What is the capital of Australia?`,choices:[`Sydney`,`Melbourne`,`Canberra`,`Brisbane`],correctAnswer:2}]}},{name:`Simple Yes/No`,args:{questions:[{question:`Is the Earth round?`,choices:[`Yes`,`No`],correctAnswer:0}]}}],r=async(e,t)=>{try{let{title:e,questions:n}=t;if(!n||!Array.isArray(n)||n.length===0)throw Error(`At least one question is required`);for(let e=0;e<n.length;e++){let t=n[e];if(!t.question||typeof t.question!=`string`)throw Error(`Question ${e+1} must have a question text`);if(!Array.isArray(t.choices)||t.choices.length<2)throw Error(`Question ${e+1} must have at least 2 choices`);if(t.choices.length>6)throw Error(`Question ${e+1} cannot have more than 6 choices`)}let r={title:e,questions:n};return{message:`Quiz presented with ${n.length} question${n.length>1?`s`:``}`,jsonData:r,instructions:`The quiz has been presented to the user. Wait for the user to submit their answers. They will tell you their answers in text format.`}}catch(e){return console.error(`Quiz creation error`,e),{message:`Quiz error: ${e instanceof Error?e.message:`Unknown error`}`,instructions:`Acknowledge that there was an error creating the quiz and suggest trying again.`}}},i={toolDefinition:t,execute:r,generatingMessage:`Preparing quiz...`,isEnabled:()=>!0,samples:n};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return r}});
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
//#region src/core/definition.ts
|
|
2
|
+
var e = "putQuestions", t = {
|
|
3
|
+
type: "function",
|
|
4
|
+
name: e,
|
|
5
|
+
description: "Present a set of multiple choice questions to test the user's knowledge or abilities. Each question should have 2-6 answer choices.",
|
|
6
|
+
parameters: {
|
|
7
|
+
type: "object",
|
|
8
|
+
properties: {
|
|
9
|
+
title: {
|
|
10
|
+
type: "string",
|
|
11
|
+
description: "Optional title for the quiz (e.g., 'JavaScript Basics Quiz')"
|
|
12
|
+
},
|
|
13
|
+
questions: {
|
|
14
|
+
type: "array",
|
|
15
|
+
description: "Array of multiple choice questions",
|
|
16
|
+
items: {
|
|
17
|
+
type: "object",
|
|
18
|
+
properties: {
|
|
19
|
+
question: {
|
|
20
|
+
type: "string",
|
|
21
|
+
description: "The question text"
|
|
22
|
+
},
|
|
23
|
+
choices: {
|
|
24
|
+
type: "array",
|
|
25
|
+
description: "Array of answer choices (2-6 choices)",
|
|
26
|
+
items: { type: "string" },
|
|
27
|
+
minItems: 2,
|
|
28
|
+
maxItems: 6
|
|
29
|
+
},
|
|
30
|
+
correctAnswer: {
|
|
31
|
+
type: "number",
|
|
32
|
+
description: "Optional: The index of the correct answer (0-based). Include this if you want to track correct answers."
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
required: ["question", "choices"]
|
|
36
|
+
},
|
|
37
|
+
minItems: 1
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
required: ["questions"]
|
|
41
|
+
}
|
|
42
|
+
}, n = [
|
|
43
|
+
{
|
|
44
|
+
name: "JavaScript Quiz",
|
|
45
|
+
args: {
|
|
46
|
+
title: "JavaScript Basics",
|
|
47
|
+
questions: [
|
|
48
|
+
{
|
|
49
|
+
question: "What does 'const' do in JavaScript?",
|
|
50
|
+
choices: [
|
|
51
|
+
"Declares a constant variable",
|
|
52
|
+
"Declares a mutable variable",
|
|
53
|
+
"Creates a function",
|
|
54
|
+
"Imports a module"
|
|
55
|
+
],
|
|
56
|
+
correctAnswer: 0
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
question: "Which method adds an element to the end of an array?",
|
|
60
|
+
choices: [
|
|
61
|
+
"pop()",
|
|
62
|
+
"shift()",
|
|
63
|
+
"push()",
|
|
64
|
+
"unshift()"
|
|
65
|
+
],
|
|
66
|
+
correctAnswer: 2
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
question: "What is the output of: typeof null?",
|
|
70
|
+
choices: [
|
|
71
|
+
"\"null\"",
|
|
72
|
+
"\"undefined\"",
|
|
73
|
+
"\"object\"",
|
|
74
|
+
"\"boolean\""
|
|
75
|
+
],
|
|
76
|
+
correctAnswer: 2
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "World Capitals",
|
|
83
|
+
args: {
|
|
84
|
+
title: "World Capitals Quiz",
|
|
85
|
+
questions: [{
|
|
86
|
+
question: "What is the capital of Japan?",
|
|
87
|
+
choices: [
|
|
88
|
+
"Osaka",
|
|
89
|
+
"Kyoto",
|
|
90
|
+
"Tokyo",
|
|
91
|
+
"Hiroshima"
|
|
92
|
+
],
|
|
93
|
+
correctAnswer: 2
|
|
94
|
+
}, {
|
|
95
|
+
question: "What is the capital of Australia?",
|
|
96
|
+
choices: [
|
|
97
|
+
"Sydney",
|
|
98
|
+
"Melbourne",
|
|
99
|
+
"Canberra",
|
|
100
|
+
"Brisbane"
|
|
101
|
+
],
|
|
102
|
+
correctAnswer: 2
|
|
103
|
+
}]
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "Simple Yes/No",
|
|
108
|
+
args: { questions: [{
|
|
109
|
+
question: "Is the Earth round?",
|
|
110
|
+
choices: ["Yes", "No"],
|
|
111
|
+
correctAnswer: 0
|
|
112
|
+
}] }
|
|
113
|
+
}
|
|
114
|
+
], r = async (e, t) => {
|
|
115
|
+
try {
|
|
116
|
+
let { title: e, questions: n } = t;
|
|
117
|
+
if (!n || !Array.isArray(n) || n.length === 0) throw Error("At least one question is required");
|
|
118
|
+
for (let e = 0; e < n.length; e++) {
|
|
119
|
+
let t = n[e];
|
|
120
|
+
if (!t.question || typeof t.question != "string") throw Error(`Question ${e + 1} must have a question text`);
|
|
121
|
+
if (!Array.isArray(t.choices) || t.choices.length < 2) throw Error(`Question ${e + 1} must have at least 2 choices`);
|
|
122
|
+
if (t.choices.length > 6) throw Error(`Question ${e + 1} cannot have more than 6 choices`);
|
|
123
|
+
}
|
|
124
|
+
let r = {
|
|
125
|
+
title: e,
|
|
126
|
+
questions: n
|
|
127
|
+
};
|
|
128
|
+
return {
|
|
129
|
+
message: `Quiz presented with ${n.length} question${n.length > 1 ? "s" : ""}`,
|
|
130
|
+
jsonData: r,
|
|
131
|
+
instructions: "The quiz has been presented to the user. Wait for the user to submit their answers. They will tell you their answers in text format."
|
|
132
|
+
};
|
|
133
|
+
} catch (e) {
|
|
134
|
+
return console.error("Quiz creation error", e), {
|
|
135
|
+
message: `Quiz error: ${e instanceof Error ? e.message : "Unknown error"}`,
|
|
136
|
+
instructions: "Acknowledge that there was an error creating the quiz and suggest trying again."
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}, i = {
|
|
140
|
+
toolDefinition: t,
|
|
141
|
+
execute: r,
|
|
142
|
+
generatingMessage: "Preparing quiz...",
|
|
143
|
+
isEnabled: () => !0,
|
|
144
|
+
samples: n
|
|
145
|
+
};
|
|
146
|
+
//#endregion
|
|
147
|
+
export { e as a, t as i, i as n, n as r, r as t };
|
package/dist/react.cjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);const t=require(`./plugin-BDTug9SB.cjs`);;/* empty css */let n=require(`react`);var r=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),i=e((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===O?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(typeof e.tag==`number`&&console.error(`Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.`),e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=k.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(A.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){N||(N=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}n.isReactWarning=!0,Object.defineProperty(e,`key`,{get:n,configurable:!0})}function l(){var e=t(this.type);return P[e]||(P[e]=!0,console.error(`Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.`)),e=this.props.ref,e===void 0?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,`ref`,{enumerable:!1,value:null}):Object.defineProperty(e,`ref`,{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,`validated`,{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,`_debugInfo`,{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,`_debugStack`,{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,`_debugTask`,{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(j(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}else console.error(`React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.`);else f(p);if(A.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,L[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,
|
|
7
|
-
${
|
|
8
|
-
`)}`;c(f)};return l?t.jsx("div",{className:"w-full min-h-96 overflow-y-auto p-8 bg-slate-900 rounded-lg",children:t.jsxs("div",{className:"max-w-3xl mx-auto",children:[l.title&&t.jsx("h2",{className:"text-gray-100 text-3xl font-bold mb-8 text-center",children:l.title}),t.jsx("div",{className:"flex flex-col gap-6",children:l.questions.map((s,f)=>t.jsxs("div",{className:"bg-slate-800 rounded-lg p-6 border-2 border-slate-700",children:[t.jsxs("div",{className:"text-white text-lg font-semibold mb-4",children:[t.jsxs("span",{className:"text-blue-400 mr-2",children:[f+1,"."]}),s.question]}),t.jsx("div",{className:"flex flex-col gap-3",children:s.choices.map((m,b)=>t.jsxs("label",{className:`flex items-start p-4 rounded-lg cursor-pointer transition-all duration-200 border-2 ${N(f,b)}`,children:[t.jsx("input",{type:"radio",name:`question-${f}`,value:b,checked:u[f]===b,onChange:()=>O(f,b),className:"mt-1 mr-3 size-4 shrink-0"}),t.jsxs("span",{className:"text-white flex-1",children:[t.jsxs("span",{className:"font-semibold mr-2",children:[String.fromCharCode(65+b),"."]}),m]})]},b))})]},f))}),t.jsx("div",{className:"mt-8 flex justify-center",children:t.jsx("button",{onClick:R,disabled:!_,className:`py-3 px-8 rounded-lg text-white font-semibold text-lg transition-colors border-none cursor-pointer ${_?"bg-blue-600 hover:bg-blue-700":"bg-gray-600 cursor-not-allowed opacity-50"}`,children:"Submit Answers"})}),t.jsxs("div",{className:"mt-4 text-center text-gray-400 text-sm",children:[j," / ",l.questions.length," questions answered"]})]})}):null}function G({result:i}){const c=i.jsonData;return c?t.jsx("div",{className:"p-3 bg-blue-50 rounded-md",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("div",{className:"text-sm font-semibold text-gray-800 text-center",children:c.title||"Quiz"}),t.jsx("div",{className:"text-center",children:t.jsxs("span",{className:"inline-block bg-blue-600 text-white text-xs font-bold py-1 px-3 rounded-full",children:[c.questions.length," ",c.questions.length===1?"Question":"Questions"]})}),t.jsx("div",{className:"text-xs text-gray-600 overflow-hidden line-clamp-2",children:c.questions[0]?.question}),t.jsxs("div",{className:"flex justify-center gap-1",children:[Array.from({length:Math.min(c.questions[0]?.choices.length||0,4)}).map((x,l)=>t.jsx("div",{className:"size-2 bg-gray-400 rounded-full"},l)),(c.questions[0]?.choices.length||0)>4&&t.jsxs("span",{className:"text-xs text-gray-500",children:["+",c.questions[0].choices.length-4]})]})]})}):null}const X={...h.pluginCore,ViewComponent:J,PreviewComponent:G},ie={plugin:X};exports.SAMPLES=h.SAMPLES;exports.TOOL_DEFINITION=h.TOOL_DEFINITION;exports.TOOL_NAME=h.TOOL_NAME;exports.executeQuiz=h.executeQuiz;exports.pluginCore=h.pluginCore;exports.Preview=G;exports.View=J;exports.default=ie;exports.plugin=X;
|
|
6
|
+
<%s key={someKey} {...props} />`,o,p,m,p),L[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require(`react`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),I=M(i(o)),L={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)}})()})),a=e(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=r():t.exports=i()}))();function o({selectedResult:e,sendTextMessage:t,onUpdateResult:r}){let[i,o]=(0,n.useState)(null),[s,c]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(e?.toolName===`putQuestions`&&e.jsonData){let t=e.jsonData;o(t),e.viewState?.userAnswers?c(e.viewState.userAnswers):c(Array(t.questions.length).fill(null))}},[e]);let l=(0,n.useCallback)(e=>{c(e),r&&r({viewState:{userAnswers:e}})},[r]),u=(e,t)=>{let n=[...s];n[e]=t,l(n)},d=s.filter(e=>e!==null).length,f=i&&d===i.questions.length,p=(e,t)=>s[e]===t?`border-blue-500 bg-blue-500/20`:`border-slate-600 hover:border-slate-500 hover:bg-slate-500/20`;return i?(0,a.jsx)(`div`,{className:`w-full min-h-96 overflow-y-auto p-8 bg-slate-900 rounded-lg`,children:(0,a.jsxs)(`div`,{className:`max-w-3xl mx-auto`,children:[i.title&&(0,a.jsx)(`h2`,{className:`text-gray-100 text-3xl font-bold mb-8 text-center`,children:i.title}),(0,a.jsx)(`div`,{className:`flex flex-col gap-6`,children:i.questions.map((e,t)=>(0,a.jsxs)(`div`,{className:`bg-slate-800 rounded-lg p-6 border-2 border-slate-700`,children:[(0,a.jsxs)(`div`,{className:`text-white text-lg font-semibold mb-4`,children:[(0,a.jsxs)(`span`,{className:`text-blue-400 mr-2`,children:[t+1,`.`]}),e.question]}),(0,a.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.choices.map((e,n)=>(0,a.jsxs)(`label`,{className:`flex items-start p-4 rounded-lg cursor-pointer transition-all duration-200 border-2 ${p(t,n)}`,children:[(0,a.jsx)(`input`,{type:`radio`,name:`question-${t}`,value:n,checked:s[t]===n,onChange:()=>u(t,n),className:`mt-1 mr-3 size-4 shrink-0`}),(0,a.jsxs)(`span`,{className:`text-white flex-1`,children:[(0,a.jsxs)(`span`,{className:`font-semibold mr-2`,children:[String.fromCharCode(65+n),`.`]}),e]})]},n))})]},t))}),(0,a.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,a.jsx)(`button`,{onClick:()=>{!i||!f||t(`Here are my answers:\n${s.map((e,t)=>e===null?null:`Q${t+1}: ${String.fromCharCode(65+e)} - ${i.questions[t].choices[e]}`).filter(e=>e!==null).join(`
|
|
7
|
+
`)}`)},disabled:!f,className:`py-3 px-8 rounded-lg text-white font-semibold text-lg transition-colors border-none cursor-pointer ${f?`bg-blue-600 hover:bg-blue-700`:`bg-gray-600 cursor-not-allowed opacity-50`}`,children:`Submit Answers`})}),(0,a.jsxs)(`div`,{className:`mt-4 text-center text-gray-400 text-sm`,children:[d,` / `,i.questions.length,` questions answered`]})]})}):null}function s({result:e}){let t=e.jsonData;return t?(0,a.jsx)(`div`,{className:`p-3 bg-blue-50 rounded-md`,children:(0,a.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,a.jsx)(`div`,{className:`text-sm font-semibold text-gray-800 text-center`,children:t.title||`Quiz`}),(0,a.jsx)(`div`,{className:`text-center`,children:(0,a.jsxs)(`span`,{className:`inline-block bg-blue-600 text-white text-xs font-bold py-1 px-3 rounded-full`,children:[t.questions.length,` `,t.questions.length===1?`Question`:`Questions`]})}),(0,a.jsx)(`div`,{className:`text-xs text-gray-600 overflow-hidden line-clamp-2`,children:t.questions[0]?.question}),(0,a.jsxs)(`div`,{className:`flex justify-center gap-1`,children:[Array.from({length:Math.min(t.questions[0]?.choices.length||0,4)}).map((e,t)=>(0,a.jsx)(`div`,{className:`size-2 bg-gray-400 rounded-full`},t)),(t.questions[0]?.choices.length||0)>4&&(0,a.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[`+`,t.questions[0].choices.length-4]})]})]})}):null}var c={...t.n,ViewComponent:o,PreviewComponent:s},l={plugin:c};exports.Preview=s,exports.SAMPLES=t.r,exports.TOOL_DEFINITION=t.i,exports.TOOL_NAME=t.a,exports.View=o,exports.default=l,exports.executeQuiz=t.t,exports.plugin=c,exports.pluginCore=t.n;
|